in src/build/FacebookIPRangesBuildStep.php [19:61]
public function buildAll(): void {
if (Str\ends_with(\php_uname('n'), '.facebook.com')) {
Log::v("\nFBONLY: Creating empty list of FB employee IP addresses...");
\file_put_contents(BuildPaths::FB_IP_RANGES_JSON, \json_encode(
shape('ipv4' => vec[], 'ipv6' => vec[]),
\JSON_PRETTY_PRINT,
));
return;
}
Log::v("\nCreating list of FB employee IP addresses...");
$errno = null;
$errstr = null;
$handle = \stream_socket_client(
'tcp://whois.radb.net:43',
inout $errno,
inout $errstr,
);
if ($handle === false) {
\fprintf(
\STDERR,
"Failed to open whois connection: %d: %s\n",
$errno,
$errstr,
);
exit(1);
}
// Persistent connection
\fwrite($handle, "!!\n");
\fwrite($handle, "!gas54115\n");
$ipv4 = self::readRadbRanges($handle);
\fwrite($handle, "!6as54115\n");
$ipv6 = self::readRadbRanges($handle);
\fclose($handle);
\file_put_contents(
BuildPaths::FB_IP_RANGES_JSON,
\json_encode(shape('ipv4' => $ipv4, 'ipv6' => $ipv6), \JSON_PRETTY_PRINT),
);
}