final class TrustedProxyMatcher (View source)

Matches peer IP addresses against an explicit, prevalidated set of exact addresses and CIDR networks.

Methods

__construct(array $trustedProxies = [])

Compiles trusted IPv4 and IPv6 entries without resolving hostnames or consulting network state.

bool
isTrusted(string $ip)

Reports whether the supplied literal IP address belongs to an explicitly trusted network.

bool

Details

__construct

__construct(array $trustedProxies = [])

Compiles trusted IPv4 and IPv6 entries without resolving hostnames or consulting network state.

Parameters

array $trustedProxies

Exceptions

InvalidArgumentException

isTrusted

bool isTrusted(string $ip)

Reports whether the supplied literal IP address belongs to an explicitly trusted network.

Parameters

string $ip

Return Value

bool