returns True if 'host' is not public
973379
def _is_non_public_numeric_address(host):
    
    # for numeric hostnames, skip RFC1918 addresses, since no Tor exit
    # node will be able to reach those. Likewise ignore IPv6 addresses.
    try:
        a = ipaddress.ip_address(six.text_type(host))
    except ValueError:
        return False        # non-numeric, let Tor try it
    if a.is_loopback or a.is_multicast or a.is_private or a.is_reserved \
       or a.is_unspecified:
        return True         # too weird, don't connect
    return False
1051018
public function isLinked(string $host = null): bool
    {
        // link exists?
        // e.g: isLinked('localhost')
        if ($host && isset($this->links[$host])) {
            return ($this->links[$host]->status() === Link::STATUS_CONNECTED);
        }

        // without master/slave directives
        // e.g: isLinked()
        if (true !== $this->config->get('sharding')) {
            foreach ($this->links as $link) {
                return ($link->status() === Link::STATUS_CONNECTED);
            }
        }

        // with master/slave directives, check by host
        switch (trim((string) $host)) {
            // e.g: isLinked(), isLinked('master')
            case '':
            case Link::TYPE_MASTER:
                foreach ($this->links as $link) {
                    if ($link->getType() == Link::TYPE_MASTER) {
                        return ($link->status() === Link::STATUS_CONNECTED);
                    }
                }
                break;
            // e.g: isLinked('slave1.mysql.local'), isLinked('slave')
            case Link::TYPE_SLAVE:
                foreach ($this->links as $link) {
                    if ($link->getType() == Link::TYPE_SLAVE) {
                        return ($link->status() === Link::STATUS_CONNECTED);
                    }
                }
                break;
        }

        return false;
    }
1153262
def is_private(self):
        
        return (self in IPv6Network('::1/128') or
                self in IPv6Network('::/128') or
                self in IPv6Network('::ffff:0:0/96') or
                self in IPv6Network('100::/64') or
                self in IPv6Network('2001::/23') or
                self in IPv6Network('2001:2::/48') or
                self in IPv6Network('2001:db8::/32') or
                self in IPv6Network('2001:10::/28') or
                self in IPv6Network('fc00::/7') or
                self in IPv6Network('fe80::/10'))
18953
def is_available(self):
        
        if self.scheme in NOOP_PROTOCOLS:
            return True

        if not self.port:
            raise RuntimeError('port is required')

        s = socket.socket()
        try:
            s.connect((self.host, self.port))
        except Exception:
            return False
        else:
            return True
777507
def proxy_bypass? host, port
    host = host.downcase
    host_port = [host, port].join ':'

    @no_proxy.each do |name|
      return true if host[-name.length, name.length] == name or
         host_port[-name.length, name.length] == name
    end

    false
  end
1190165
def is_private(self, key, sources):
        """"""
        # aliases are always public.
        if key == ENTRY.ALIAS:
            return False
        return all([
            SOURCE.PRIVATE in self.get_source_by_alias(x)
            for x in sources.split(',')
        ])
354113
def disable_host_check(self, host):
        
        if host.active_checks_enabled:
            host.modified_attributes |= DICT_MODATTR["MODATTR_ACTIVE_CHECKS_ENABLED"].value
            host.disable_active_checks(self.daemon.checks)
            self.send_an_element(host.get_update_status_brok())
1013485
private boolean inHostsList(TaskTrackerStatus status) {
    Set<String> hostsList = hostsReader.getHosts();
    return (hostsList.isEmpty() || hostsList.contains(status.getHost()));
  }
764607
def is_server_running(host, port):
    
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try:
        return s.connect_ex((host, port)) == 0
    finally:
        s.close()
348918
private boolean isNonProxyHost(String host, String nonProxyHosts) {
        if (host == null || nonProxyHosts == null) {
            return false;
        }

        // construct pattern
        StringBuilder patternBuilder = new StringBuilder();
        for (int i = 0; i < nonProxyHosts.length(); i++) {
            char c = nonProxyHosts.charAt(i);
            switch (c) {
            case '.':
                patternBuilder.append("\\.");
                break;
            case '*':
                patternBuilder.append(".*");
                break;
            default:
                patternBuilder.append(c);
            }
        }
        // check whether the host is the nonProxyHosts.
        String pattern = patternBuilder.toString();
        return host.matches(pattern);
    }
1215329
def is_safe_url(url, host=None):
    
    if not url:
        return False
    netloc = urlparse.urlparse(url)[1]
    return not netloc or netloc == host
5940
def has_public(self):
        """"""
        if self.is_symmetric:
            return False
        reg = JWKValuesRegistry[self._params['kty']]
        for value in reg:
            if reg[value].public and value in self._key:
                return True
251671
def has_host_match(log_data, hosts):
    
    hostname = getattr(log_data, 'host', None)
    if hostname and hostname not in host_cache:
        for host_pattern in hosts:
            if host_pattern.search(hostname) is not None:
                host_cache.add(hostname)
                return True
        else:
            return False
    return True
1153478
def is_public(addr):
    # type: (Union[str, unicode]) -> bool
    
    addr_domain = domain(addr)
    if not addr_domain:
        # anybody can use invalid email
        return True
    chunks = addr_domain.rsplit(".", 1)

    return len(chunks) < 2 \
        or addr_domain.endswith("local") \
        or addr_domain in public_domains()
1221167
def valid_host_with_port(hostport):
    
    host, port = hostport.rsplit(":", 1) if ":" in hostport else (hostport, None)

    # first, validate host or IP
    if not valid_ipv4(host) and not valid_host(host):
        return False

    # now, validate port
    if port is not None and not valid_port(port):
        return False

    return True
557784
def __get_host(node, vm_):
    '''
    
    '''
    if __get_ssh_interface(vm_) == 'private_ips' or vm_['external_ip'] is None:
        ip_address = node.private_ips[0]
        log.info('Salt node data. Private_ip: %s', ip_address)
    else:
        ip_address = node.public_ips[0]
        log.info('Salt node data. Public_ip: %s', ip_address)

    if ip_address:
        return ip_address

    return node.name
1344235
private boolean isHeaderExternal(String host, int port,String transport, boolean isIpv6) 
    {  

    	if(!isIpv6)
    	{
    		if (host.equalsIgnoreCase(balancerRunner.balancerContext.externalHost))
    		{
    			if(balancerRunner.balancerContext.getExternalPortByTransport(transport,false)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,false)==port)
    				return false;
    		}

    		if(host.equalsIgnoreCase(balancerRunner.balancerContext.internalHost))
    		{
    			if(balancerRunner.balancerContext.getInternalPortByTransport(transport,false)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,false)==port)
    				return false;
    		}
		
    		if(balancerRunner.balancerContext.externalIpLoadBalancerAddresses!=null&&
    				balancerRunner.balancerContext.externalIpLoadBalancerAddresses.contains(host))
    		{
    			if(balancerRunner.balancerContext.getExternalPortByTransport(transport,false)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,false)==port)
    				return false;
    		}
		
    		if(balancerRunner.balancerContext.internalIpLoadBalancerAddresses!=null&&
    				balancerRunner.balancerContext.internalIpLoadBalancerAddresses.contains(host))
    		{
    			if(balancerRunner.balancerContext.getInternalPortByTransport(transport,false)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,false)==port)
    				return false;
    		}
		
    		if(host.equalsIgnoreCase(balancerRunner.balancerContext.publicIP))
    		{
    			if(balancerRunner.balancerContext.getExternalPortByTransport(transport,false)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,false)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getInternalPortByTransport(transport,false)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,false)==port)
    				return false;
    		}

    		return true;
    	}
    	else
    	{
    		String cleanHost=host;
    		if(cleanHost.startsWith("["))
    			cleanHost=cleanHost.substring(1);
    		
    		if(cleanHost.endsWith("]"))
    			cleanHost=cleanHost.substring(0,cleanHost.length()-1);
    		
    		InetAddress address=null;
    		try
    		{
    			address=InetAddress.getByName(cleanHost);
    		}
    		catch(UnknownHostException ex)
    		{
    			
    		}
    		
    		if(address==null)
    			return false;
    		
    		if (address.equals(balancerRunner.balancerContext.externalIpv6HostAddress))
    		{    			
    			if(balancerRunner.balancerContext.getExternalPortByTransport(transport,true)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,true)==port)
    				return false;
    		}
    			

    		if(address.equals(balancerRunner.balancerContext.internalIpv6HostAddress))
    		{
    			if(balancerRunner.balancerContext.getInternalPortByTransport(transport,true)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,true)==port)
    				return false;
    		}
    		
    		if(balancerRunner.balancerContext.externalIpv6LoadBalancerAddressHosts.contains(address))
    		{
    			if(balancerRunner.balancerContext.getExternalPortByTransport(transport,true)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,true)==port)
    				return false;
    		}
    		
    		if(balancerRunner.balancerContext.internalIpv6LoadBalancerAddressHosts.contains(address))
    		{
    			if(balancerRunner.balancerContext.getInternalPortByTransport(transport,true)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,true)==port)
    				return false;
    		}
    		
    		if(address.equals(balancerRunner.balancerContext.publicIPv6Host))
    		{
    			if(balancerRunner.balancerContext.getExternalPortByTransport(transport,true)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,true)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getInternalPortByTransport(transport,true)==port)
    				return false;
			
    			if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,true)==port)
    				return false;
    		}

		return true;
    	}
    }