public static function isLocalAddress($socketAddress)
    {
        static $localAddresses = null;
        if (self::isUnixAddress($socketAddress)) {
            return true;
        }
        if ($localAddresses === null) {
            $localAddresses = array_merge([
                '0.0.0.0',
                '127.0.0.1',
                '[::]',
                '[::1]',
            ], gethostbynamel(gethostname()));
        }
        foreach ($localAddresses as $address) {
            if (strpos($socketAddress, $address) !== false) {
                return true;
            }
        }

        return false;
    }
public static function isLocalAddress($socketAddress)
    {
        static $localAddresses = null;
        if (self::isUnixAddress($socketAddress)) {
            return true;
        }
        if ($localAddresses === null) {
            $localAddresses = array_merge([
                '0.0.0.0',
                '127.0.0.1',
                '[::]',
                '[::1]',
            ], gethostbynamel(gethostname()));
        }
        foreach ($localAddresses as $address) {
            if (strpos($socketAddress, $address) !== false) {
                return true;
            }
        }

        return false;
    }
@param string $socketAddress

@return bool