Gets the host information
@param  string $hostname Hostname
@param  callable $cb Callback
@callback $cb ( )
@return void
971055
public function get($hostname, $cb)
    {
        $this->onResponse->push($cb);
        $this->setFree(false);
        $e = explode(':', $hostname, 3);
        $hostname = $e[0];
        $qtype = isset($e[1]) ? $e[1] : 'A';
        $qclass = isset($e[2]) ? $e[2] : 'IN';
        $QD = [];
        $qtypeInt = array_search($qtype, Pool::$type, true);
        $qclassInt = array_search($qclass, Pool::$class, true);

        if (($qtypeInt === false) || ($qclassInt === false)) {
            $cb(false);
            return;
        }

        $q = Binary::labels($hostname) . // domain
            Binary::word($qtypeInt) .
            Binary::word($qclassInt);

        $QD[] = $q;

        $packet = Binary::word(++$this->seq) . // Query ID
            Binary::bitmap2bytes(
                '0' . // QR = 0
                '0000' . // OPCODE = 0000 (standard query)
                '0' . // AA = 0
                '0' . // TC = 0
                '1' . // RD = 1
                '0' . // RA = 0,
                '000' . // reserved
                '0000', // RCODE
                2
            ) .
            Binary::word(sizeof($QD)) . // QDCOUNT
            Binary::word(0) . // ANCOUNT
            Binary::word(0) . // NSCOUNT
            Binary::word(0) . // ARCOUNT
            implode('', $QD);

        if ($this->type === 'udp') {
            $this->write($packet);
        } else {
            $this->write(Binary::word(mb_orig_strlen($packet)) . $packet);
        }
    }
375505
public function hostname(Hostname $hostname = null): ?Hostname
    {
        if ($hostname !== null) {
            $this->app->instance(CurrentHostname::class, $hostname);

            $this->emitEvent(new Events\Hostnames\Switched($hostname));

            return $hostname;
        }

        return $this->app->make(CurrentHostname::class);
    }
1114644
function getFqdnForHostname(hostname, cb) {
  let addressIndex = 0;

  dns.lookup(hostname, { all: true }, function (err, addresses, family) {
    const tryNextAddressOrComplete = (err, fqdn) => {
      addressIndex++;
      if (!err) {
        cb(err, fqdn);
      } else if (addressIndex != addresses.length) {
        getFqdnForIpAddress(addresses[addressIndex].address, tryNextAddressOrComplete);
      } else {
        cb(err);
      }
    };

    if (!err) {
      getFqdnForIpAddress(addresses[addressIndex].address, tryNextAddressOrComplete);
    } else {
      cb(err);
    }
  });
}
745168
public function connect($hostname, $username, $password)
    {
        try {
            $this->pdo = new \PDO('mysql:host=' . $hostname . ';', $username, $password);
            $result = Events::dispatch('onPDOCreated', array(&$this->pdo));
            if (intval($this->pdo->errorCode()) === 0) {
                $this->pdo->exec('SET NAMES utf8');
                $this->pdo->exec('SET sql_mode = \'\'');
                $this->pdo->exec('SET FOREIGN_KEY_CHECKS=0');
                return true;
            }
        } catch (\Exception $ex) {
//            print_debug($ex);
            Events::dispatch('onException', $ex);
            $this->lastError = $ex;
//            throw $ex;
        }
        return false;
    }
312838
final List<? extends E> get(String hostname) {
        Entries entries = resolveCache.get(hostname);
        return entries == null ? null : entries.get();
    }
422552
public static function tryParse(string $hostname): ?HostnameInterface
    {
        if (!self::myParse($hostname, $domainParts, $tld)) {
            return null;
        }

        return new self($domainParts, $tld);
    }
555739
public function execute($hostname)
    {
        $server = $this->getContext();

        $result = @file($this->location);

        $response = new Response\NetDnsResponse();
        $response->setHostname($hostname);
        $response->setServer($server);
        $response->setQuery($this->location);

        if ($result) {
            foreach ($result as $value) {
                if (trim($hostname) === trim($value)) {
                    $response->listed();
                }
            }
        }

        return $response;
    }
904351
private String getDestinationHostName(String hostName) {
        List<ServerRedirect> servers = serverRedirectService
            .tableServers(requestInformation.get().client.getId());
        for (ServerRedirect server : servers) {
            if (server.getSrcUrl().compareTo(hostName) == 0) {
                if (server.getDestUrl() != null && server.getDestUrl().compareTo("") != 0) {
                    return server.getDestUrl();
                } else {
                    logger.warn("Using source URL as destination URL since no destination was specified for: {}",
                                server.getSrcUrl());
                }

                // only want to apply the first host name change found
                break;
            }
        }

        return hostName;
    }
713831
public function setHost($host)
    {
        $this->host = trim(strtolower($host));

        if ('' === $this->host) {
            $this->merge();

            return;
        }

        if (!isset($this->cache['hosts-configuration'])) {
            $this->merge();

            return;
        }

        foreach ($this->cache['hosts-configuration'] as $hostConf) {
            if (!isset($hostConf['servername'])) {
                continue;
            }
            if ($this->match($this->host, $hostConf['servername'])) {
                $this->merge($hostConf);
                break;
            }
            if (!isset($hostConf['hosts'])) {
                continue;
            }
            foreach ((array) $hostConf['hosts'] as $hostname) {
                if ($this->match($this->host, $hostname)) {
                    $this->merge($hostConf);
                    break 2;
                }
            }
        }
    }
495492
protected function setHost($hostname) {
        if (!is_string($hostname)) throw new IllegalTypeException('Illegal type of parameter $hostname: '.gettype($hostname));
        if (!strlen($hostname))    throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (empty)');

        $host = $hostname;
        $port = null;

        if (strpos($host, ':') !== false) {
            list($host, $port) = explode(':', $host, 2);
            $host = trim($host);
            if (!strlen($host)) throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (empty host name)');

            $port = trim($port);
            if (!ctype_digit($port)) throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (not a port)');
            $port = (int) $port;
            if (!$port || $port > 65535) throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (illegal port)');
        }

        $this->host = $host;
        $this->port = $port;
        return $this;
    }
315720
public static function getEnvNameByHost(string $defaultEnv = null, string $hostname = null): string
    {
        $hostname = $hostname ?: gethostname();

        if (!$hostname) {
            return $defaultEnv;
        }

        foreach (self::$host2env as $kw => $env) {
            if (false !== strpos($hostname, $kw)) {
                return $env;
            }
        }

        return $defaultEnv;
    }
1211795
public static void enableHost(String hostName) throws Exception {
        Registry myRegistry = LocateRegistry.getRegistry("127.0.0.1", port);
        com.groupon.odo.proxylib.hostsedit.rmi.Message impl = (com.groupon.odo.proxylib.hostsedit.rmi.Message) myRegistry.lookup(SERVICE_NAME);

        impl.enableHost(hostName);
    }
828691
public function equals(HostnameInterface $hostname): bool
    {
        return $this->getDomainParts() === $hostname->getDomainParts() && $this->getTld() === $hostname->getTld();
    }
1353093
public static function isValid($hostname)
    {
        $hostname = trim($hostname);

        // Strip the wrapping square brackets from IPv6 addresses.

        if (Str::startsWith($hostname, '[') && Str::endsWith($hostname, ']')) {
            $hostname = substr($hostname, 1, -1);
        }

        return (bool)filter_var($hostname, FILTER_VALIDATE_IP);
    }
1173483
public static function getCleanHostname($hostname)
    {
        $extToExclude = array(
            'com', 'net', 'org', 'co'
        );

        $off = strrpos($hostname, '.');
        $ext = substr($hostname, $off);

        if (empty($off) || is_numeric($ext) || strlen($hostname) < 5) {
            return 'Ip';
        } else {
            $cleanHostname = null;

            /**
             * Triggered when prettifying a hostname string.
             *
             * This event can be used to customize the way a hostname is displayed in the
             * Providers report.
             *
             * **Example**
             *
             *     public function getCleanHostname(&$cleanHostname, $hostname)
             *     {
             *         if ('fvae.VARG.ceaga.site.co.jp' == $hostname) {
             *             $cleanHostname = 'site.co.jp';
             *         }
             *     }
             *
             * @param string &$cleanHostname The hostname string to display. Set by the event
             *                               handler.
             * @param string $hostname The full hostname.
             */
            Piwik::postEvent('Provider.getCleanHostname', array(&$cleanHostname, $hostname));
            if ($cleanHostname !== null) {
                return $cleanHostname;
            }

            $e = explode('.', $hostname);
            $s = sizeof($e);

            // if extension not correct
            if (isset($e[$s - 2]) && in_array($e[$s - 2], $extToExclude)) {
                return $e[$s - 3] . "." . $e[$s - 2] . "." . $e[$s - 1];
            } else {
                return $e[$s - 2] . "." . $e[$s - 1];
            }
        }
    }
1218426
public function getkey($key, $cb = null)
    {
        $this->redis->get($this->config->redisprefix->value . $key, $cb);
    }
410998
def __get_known_node_by_host(self, hostname):
        '''
        
        '''
        for n in self.nodes:
            if (n.name == hostname):
                return n
        return None