21 private $proxyServers;
24 private $proxyServersComplex;
47 $this->proxyServers = $proxyServers;
48 $this->proxyServersComplex = $proxyServersComplex;
49 $this->hookRunner =
new HookRunner( $hookContainer );
50 $this->cache = $cache;
58 private function getIPSet() {
59 if ( $this->proxyIPSet ) {
60 return $this->proxyIPSet;
64 $this->cache->makeGlobalKey(
'ProxyLookup',
'ipset', crc32( json_encode( $this->proxyServersComplex ) ) ),
65 BagOStuff::TTL_INDEFINITE,
66 fn () =>
new IPSet( $this->proxyServersComplex )
69 return $this->proxyIPSet;
80 if ( in_array( $ip, $this->proxyServers,
true ) ) {
85 return $this->getIPSet()->match( $ip );
98 $this->hookRunner->onIsTrustedProxy( $ip, $trusted );
104class_alias( ProxyLookup::class,
'ProxyLookup' );