MCPcopy Create free account
hub / github.com/Rello/analytics / isPublicIp

Method isPublicIp

lib/Security/ExternalUrlValidator.php:81–94  ·  view source on GitHub ↗
(string $address)

Source from the content-addressed store, hash-verified

79 }
80
81 private static function isPublicIp(string $address): bool {
82 if (preg_match('/^::ffff:(\d{1,3}(?:\.\d{1,3}){3})$/i', $address, $matches)) {
83 $address = $matches[1];
84 }
85 if (filter_var($address, FILTER_VALIDATE_IP) === false) {
86 return false;
87 }
88
89 return filter_var(
90 $address,
91 FILTER_VALIDATE_IP,
92 FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE
93 ) !== false;
94 }
95}

Callers 1

validateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected