contains returns true if the IPv6Net contains the IPv6
165074
def contains(ip)
			if (!ip.kind_of?(IPv6))
				raise ArgumentError, "Expected an IPv6 object for 'ip' but got a #{ip.class}."
			end
			if (@base.addr == ip.addr & @m128.mask)
				return true
			end
			return false
		end
469868
def is_reserved(self):
        
        reserved_nets = [IPv6Network('::/8'), IPv6Network('100::/8'),
                         IPv6Network('200::/7'), IPv6Network('400::/6'),
                         IPv6Network('800::/5'), IPv6Network('1000::/4'),
                         IPv6Network('4000::/3'), IPv6Network('6000::/3'),
                         IPv6Network('8000::/3'), IPv6Network('A000::/3'),
                         IPv6Network('C000::/3'), IPv6Network('E000::/4'),
                         IPv6Network('F000::/5'), IPv6Network('F800::/6'),
                         IPv6Network('FE00::/9')]

        return any(self in x for x in reserved_nets)
268199
def _ipaddress_match(ipname, host_ip):
    
    # OpenSSL may add a trailing newline to a subjectAltName's IP address
    ip = ipaddress.ip_address(six.text_type(ipname.rstrip()))
    return ip == host_ip
1048467
def is_valid_ipv6_prefix(ipv6_prefix):
    """"""

    # Validate input type
    if not isinstance(ipv6_prefix, str):
        return False

    tokens = ipv6_prefix.split('/')
    if len(tokens) != 2:
        return False

    # Validate address/mask and return
    return is_valid_ipv6(tokens[0]) and is_valid_ip_prefix(tokens[1], 128)
946341
protected Boolean comesFromInternalNode(Response externalResponse,InvocationContext ctx,String host,Integer port,String transport,Boolean isIpV6)
	{
		boolean found = false;
		if(host!=null && port!=null)
		{
			if(ctx.sipNodeMap(isIpV6).containsKey(new KeySip(host, port,isIpV6)))
				found = true;
//			for(Node node : ctx.nodes) {
//				if(node.getIp().equals(host)) {
//					if(port.equals(node.getProperties().get(transport+"Port"))) {
//						found = true;
//						break;
//					}
//				}
//			}
		}
		return found;
	}
1311520
public function containsIP($ip): bool
    {
        if (!$ip instanceof IP) {
            $ip = IP::create($ip);
        }

        return ($ip->numeric() >= $this->getFirstIp()->numeric()) && ($ip->numeric() <= $this->getLastIp()->numeric());
    }
313682
def in_subnet(cidr, addr=None):
    '''
    
    '''
    try:
        cidr = ipaddress.ip_network(cidr)
    except ValueError:
        log.error('Invalid CIDR \'%s\'', cidr)
        return False

    if addr is None:
        addr = ip_addrs()
        addr.extend(ip_addrs6())
    elif not isinstance(addr, (list, tuple)):
        addr = (addr,)

    return any(ipaddress.ip_address(item) in cidr for item in addr)
1235964
func (n *network) contains(ip net.IP) bool {
	for _, s := range n.subnets {
		if s.subnetIP.Contains(ip) {
			return true
		}
	}

	return false
}
535192
public static boolean isInetAddress(String host) {
		int colons = 0;
		int dots = 0;
		byte[] bytes = encodeAscii(host);

		// expect ipv6 address
		if (bytes[0] == '[') {
			return bytes[bytes.length - 1] == ']' && checkIpv6(bytes, 1, bytes.length - 1);
		}

		// assume ipv4 could be as oct, bin, dec; ipv6 - hex
		for (byte b : bytes) {
			if (b == '.') {
				dots++;
			} else if (b == ':') {
				if (dots != 0) {
					return false;
				}
				colons++;
			} else if (Character.digit(b, 16) == -1) {
				return false;
			}
		}

		if (dots < 4) {
			if (colons > 0 && colons < 8) {
				return checkIpv6(bytes, 0, bytes.length);
			}
			return checkIpv4(bytes, 0, bytes.length);
		}
		return false;
	}
492635
def in6_isvalid(address):
    """"""

    try:
        socket.inet_pton(socket.AF_INET6, address)
        return True
    except Exception:
        return False
1065640
def ContainsAddressStr(self, address):
        
        for key, contract in self._contracts.items():
            if contract.Address == address:
                return True
        return False
1158821
def hasIP(self, ip):
        """"""

        for f in self.features:
            if (f.prop.startswith("net_interface.") and
                    f.prop.endswith(".ip") and f.value == ip):
                return True
        return False
60340
func (ipv4 IPv4Addr) Contains(sa SockAddr) bool {
	ipv4b, ok := sa.(IPv4Addr)
	if !ok {
		return false
	}

	return ipv4.ContainsNetwork(ipv4b)
}
1362935
def _get_ipv6addrs(self):
        
        addrs = self._get_addrs()
        ipv6addrs = addrs.get(netifaces.AF_INET6)
        if not ipv6addrs:
            return {}
        return ipv6addrs[0]
834234
def is_reserved_ip(self, ip):
        
        theip = ipaddress(ip)
        for res in self._reserved_netmasks:
            if theip in ipnetwork(res):
                return True
        return False
241126
def _is_ipv6(addr):
    """"""
    try:
        socket.inet_pton(socket.AF_INET6, addr)
        return True
    except socket.error:
        return False
11798
func (s *awsIPs) contains(ip net.IP) bool {
	networks := s.getCandidateNetworks(ip)
	for _, network := range networks {
		if network.Contains(ip) {
			return true
		}
	}
	return false
}