Get maximum host IP address as array of quads: [xxx, xxx, xxx, xxx]

@return array min host portion as dotted quads
550187
public function getMaxHostQuads()
    {
        if ($this->network_size === 32 || $this->network_size === 31) {
            return $this->quads;
        }
        return explode('.', $this->maxHostCalculation(self::FORMAT_QUADS, '.'));
    }
1119253
public function getDescription(): string
    {
        if (!empty($this->networkRange)) {
            $message = $this->networkRange['min'];
            if (isset($this->networkRange['max'])) {
                $message .= '-' . $this->networkRange['max'];
            } else {
                $message .= '/' . long2ip((string)bindec($this->networkRange['mask']));
            }
            return __('must be an IP address in the "%s" range', $message);
        }
        return __('must be an IP address');
    }
128459
protected function getAllowedIpAddresses()
    {
        return collect($this->config->allowedIpAddresses)
            ->map(function ($address) {
                return collect($address)
                    ->filter()
                    ->pop();
            })->filter()->toArray();
    }
401307
public long[][] getRemoteSites() {
        int localhost = VoltDB.instance().getHostMessenger().getHostId();
        long[][] retval = new long[m_allHostsImmutable.size() - 1][];
        int i = 0;
        for (int host : m_allHostsImmutable) {
            if (host != localhost) {
                retval[i++] = longListToArray(m_hostsToSitesImmutable.get(host));
            }
        }
        return retval;
    }
1198839
public static function getHost()
    {
        $host = '';
        if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && $host = $_SERVER['HTTP_X_FORWARDED_HOST']) {
            $elements = explode(',', $host);
            $host     = trim(end($elements));
        } else {
            if (isset($_SERVER['HTTP_HOST']) && !$host = $_SERVER['HTTP_HOST']) {
                if (isset($_SERVER['SERVER_NAME']) && !$host = $_SERVER['SERVER_NAME']) {
                    $host = !empty($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
                }
            }
        }
        // Remove port number from host
        $host = preg_replace('/:\d+$/', '', $host);

        return trim($host);
    }
1230910
public function getClientIp()
    {
        foreach (['HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
                     'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',] as $key) {
            if ($ips = $this->request->getServer($key, false)) {
                foreach (explode(',', $ips) as $ip) {
                    $ip = trim($ip); // just to be safe
                    if (filter_var(
                            $ip,
                            FILTER_VALIDATE_IP,
                            FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE
                        ) !== false) {
                        return $ip;
                    }
                }
            }
        }
    }
1299935
public function getServersAsArray()
    {

        // initialize the array for the servers
        $servers = array();

        // iterate over all found servers and assemble the array
        /** @var \AppserverIo\Appserver\Core\Api\Node\ServerNodeInterface $server */
        foreach ($this->getServers() as $server) {
            $servers[$server->getName()] = $server;
        }

        // return the array with the servers
        return $servers;
    }
1012087
public function getSubdomains()
    {
        $current = $this->server['HTTP_HOST'];
        $parts = explode('.', $current);

        // two steps back
        array_pop($parts);
        array_pop($parts);

        return $parts;
    }
30513
public function getMinHostBinary()
    {
        if ($this->network_size === 32 || $this->network_size === 31) {
            return implode('', array_map(
                function ($quad) {
                    return sprintf(self::FORMAT_BINARY, $quad);
                },
                $this->quads
            ));
        }
        return $this->minHostCalculation(self::FORMAT_BINARY);
    }
1195300
public function getFullHost()
    {
        // Case 1: Host hasn't suffix, possibly IP.

        if (null === $this->suffix) {
            return $this->hostname;
        }

        // Case 2: Domain with suffix, but without subdomain.

        if (null === $this->subdomain) {
            return $this->hostname . '.' . $this->suffix;
        }

        // Case 3: Domain with suffix & subdomain.

        return implode('.', [$this->subdomain, $this->hostname, $this->suffix]);
    }
992210
public function clientIp()
    {
        if ($this->trustProxy && $this->getEnv('HTTP_X_FORWARDED_FOR')) {
            $addresses = array_map('trim', explode(',', $this->getEnv('HTTP_X_FORWARDED_FOR')));
            $trusted = (count($this->trustedProxies) > 0);
            $n = count($addresses);

            if ($trusted) {
                $trusted = array_diff($addresses, $this->trustedProxies);
                $trusted = (count($trusted) === 1);
            }

            if ($trusted) {
                return $addresses[0];
            }

            return $addresses[$n - 1];
        }

        if ($this->trustProxy && $this->getEnv('HTTP_X_REAL_IP')) {
            $ipaddr = $this->getEnv('HTTP_X_REAL_IP');
        } elseif ($this->trustProxy && $this->getEnv('HTTP_CLIENT_IP')) {
            $ipaddr = $this->getEnv('HTTP_CLIENT_IP');
        } else {
            $ipaddr = $this->getEnv('REMOTE_ADDR');
        }

        return trim($ipaddr);
    }
69578
protected static function GetRemoteAddr()
    {
        $ipSet = new IPSet(IPSet::PRIVATE_NETS);
        if ( ! $ipSet->match($_SERVER["REMOTE_ADDR"])) {
            return $_SERVER["REMOTE_ADDR"]; // Remote ADDR is Public Address: Use this! (We want Load-Balancers with private IPs only!)
        }
        if (isset ($_SERVER["HTTP_X_FORWARDED_FOR"])) {
            $forwardsRev = array_reverse($forwards = explode(",", $_SERVER["HTTP_X_FORWARDED_FOR"]));
            for ($i=0; $i<count ($forwardsRev); $i++) {
                if ( ! $ipSet->match(trim ($forwardsRev[$i]))) {
                    return $forwardsRev[$i]; // Return first non-private IP from last to first
                }
            }
            return $forwards[0]; // Return first IP if no public IP found.
        }
        return $_SERVER["REMOTE_ADDR"]; // Return the private Remote-ADDR
    }
454120
def divideHosts(self, hosts, qty):
        """"""
        maximumWorkers = sum(host[1] for host in hosts)

        # If specified amount of workers is greater than sum of each specified.
        if qty > maximumWorkers:
            index = 0
            while qty > maximumWorkers:
                hosts[index] = (hosts[index][0], hosts[index][1] + 1)
                index = (index + 1) % len(hosts)
                maximumWorkers += 1

        # If specified amount of workers if lower than sum of each specified.
        elif qty < maximumWorkers:

            while qty < maximumWorkers:
                maximumWorkers -= hosts[-1][1]
                if qty > maximumWorkers:
                    hosts[-1] = (hosts[-1][0], qty - maximumWorkers)
                    maximumWorkers += hosts[-1][1]
                else:
                    del hosts[-1]


        # Checking if the broker if externally routable
        if self.externalHostname in utils.loopbackReferences and \
                len(hosts) > 1 and \
                not self.tunnel:
            raise Exception("\n"
                            "Could not find route from external worker to the "
                            "broker: Unresolvable hostname or IP address.\n "
                            "Please specify your externally routable hostname "
                            "or IP using the --external-hostname parameter or "
                            "use the --tunnel flag.")
        return hosts
71527
public function getBroadcastAddress()
    {
        $network_quads         = $this->getNetworkPortionQuads();
        $number_ip_addresses   = $this->getNumberIPAddresses();

        $network_range_quads   = [];
        $network_range_quads[] = sprintf(self::FORMAT_QUADS, ( $network_quads[0] & ( $this->subnet_mask >> 24 ) ) + ( ( ( $number_ip_addresses - 1 ) >> 24 ) & 0xFF ));
        $network_range_quads[] = sprintf(self::FORMAT_QUADS, ( $network_quads[1] & ( $this->subnet_mask >> 16 ) ) + ( ( ( $number_ip_addresses - 1 ) >> 16 ) & 0xFF ));
        $network_range_quads[] = sprintf(self::FORMAT_QUADS, ( $network_quads[2] & ( $this->subnet_mask >>  8 ) ) + ( ( ( $number_ip_addresses - 1 ) >>  8 ) & 0xFF ));
        $network_range_quads[] = sprintf(self::FORMAT_QUADS, ( $network_quads[3] & ( $this->subnet_mask >>  0 ) ) + ( ( ( $number_ip_addresses - 1 ) >>  0 ) & 0xFF ));

        return implode('.', $network_range_quads);
    }
452965
public function getIPs()
	{
		(isset($_SERVER['HTTP_CLIENT_IP'])) ? $httpClientIp = $_SERVER['HTTP_CLIENT_IP'] : $httpClientIp = Null;
		(isset($_SERVER['REMOTE_ADDR'])) ? $remoteAddr = $_SERVER['REMOTE_ADDR'] : $remoteAddr = Null;
		(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $httpForwardedFor = $_SERVER['HTTP_X_FORWARDED_FOR'] : $httpForwardedFor = Null;
		$allIPs = array( $httpClientIp, $remoteAddr, $httpForwardedFor );
		$IPs 		= $this->checkIPs($allIPs);
		return $IPs;
	}
822812
public function getSortedServersArray()
    {
        $servers = empty($this->config->getServers()) ? $this->getServersFromDns() : $this->config->getServers();

        if (self::SELECT_RANDOM == $this->selectionMethod) {
            $servers = $this->shuffleServers($servers);
        }

        return $servers;
    }
238391
protected function getHosts(): array
    {
        $domains = [];
        foreach ($this->siteFinder->getAllSites() as $site) {
            foreach ($site->getAllLanguages() as $language) {
                $domains[] = $language->getBase()->getHost();
            }
        }
        $domains = array_unique($domains);
        sort($domains, SORT_NATURAL);
        return $domains;
    }