Returns the IPv6 address of the network interface.

        If multiple interfaces are provided,
        the address of the first found is returned.
434226
def ip6_address(self):
        
        if self._ip6_address is None and self.network is not None:
            self._ip6_address = self._get_ip_address(
                libvirt.VIR_IP_ADDR_TYPE_IPV6)

        return self._ip6_address
573994
public static InetAddress getLocalIPAddress() {
        Enumeration<NetworkInterface> enumeration = null;
        try {
            enumeration = NetworkInterface.getNetworkInterfaces();
        } catch (SocketException e) {
            e.printStackTrace();
        }
        if (enumeration != null) {
            while (enumeration.hasMoreElements()) {
                NetworkInterface nif = enumeration.nextElement();
                Enumeration<InetAddress> inetAddresses = nif.getInetAddresses();
                if (inetAddresses != null) {
                    while (inetAddresses.hasMoreElements()) {
                        InetAddress inetAddress = inetAddresses.nextElement();
                        if (!inetAddress.isLoopbackAddress() && isIPv4Address(inetAddress.getHostAddress())) {
                            return inetAddress;
                        }
                    }
                }
            }
        }
        return null;
    }
688855
def _find_interfaces_mac(ip):  # pylint: disable=invalid-name
    '''
    
    '''
    all_interfaces = _get_mine('net.interfaces')
    all_ipaddrs = _get_mine('net.ipaddrs')

    for device, device_ipaddrs in six.iteritems(all_ipaddrs):
        if not device_ipaddrs.get('result', False):
            continue
        for interface, interface_ipaddrs in six.iteritems(device_ipaddrs.get('out', {})):
            ip_addresses = interface_ipaddrs.get('ipv4', {}).keys()
            ip_addresses.extend(interface_ipaddrs.get('ipv6', {}).keys())
            for ipaddr in ip_addresses:
                if ip != ipaddr:
                    continue
                interface_mac = all_interfaces.get(device, {}).get('out', {}).get(interface, {}).get('mac_address', '')
                return device, interface, interface_mac

    return ('', '', '')
3702
def getInterfaceAddresses(self, node, interface):
        '''
        
        '''
        intf = self.getNode(node)['nodeobj'].getInterface(interface)
        return intf.ethaddr,intf.ipaddr,intf.netmask
42388
def host(self):
        
        raw = self.raw_host
        if raw is None:
            return None
        if "%" in raw:
            # Hack for scoped IPv6 addresses like
            # fe80::2%Проверка
            # presence of '%' sign means only IPv6 address, so idna is useless.
            return raw

        try:
            return idna.decode(raw.encode("ascii"))
        except UnicodeError:  # e.g. '::1'
            return raw.encode("ascii").decode("idna")
1047523
public int getHostPort() {
        String host = requestHeaders.getFirst(Headers.HOST);
        if (host != null) {
            //for ipv6 addresses we make sure we take out the first part, which can have multiple occurrences of :
            final int colonIndex;
            if (host.startsWith("[")) {
                colonIndex = host.indexOf(':', host.indexOf(']'));
            } else {
                colonIndex = host.indexOf(':');
            }
            if (colonIndex != -1) {
                try {
                    return Integer.parseInt(host.substring(colonIndex + 1));
                } catch (NumberFormatException ignore) {}
            }
            if (getRequestScheme().equals("https")) {
                return 443;
            } else if (getRequestScheme().equals("http")) {
                return 80;
            }

        }
        return getDestinationAddress().getPort();
    }
237736
def ip4_address(self):
        
        if self._ip4_address is None and self.network is not None:
            self._ip4_address = self._get_ip_address(
                libvirt.VIR_IP_ADDR_TYPE_IPV4)

        return self._ip4_address
442455
def address_family(self):
        
        if len(self.raw) >= 20:
            v = i(self.raw[0]) >> 4
            if v == 4:
                return socket.AF_INET
            if v == 6:
                return socket.AF_INET6
392774
public IPv6AddressPool allocate()
    {
        if (!isExhausted())
        {
            // get the first range of free subnets, and take the first subnet of that range
            final IPv6AddressRange firstFreeRange = freeRanges.first();
            final IPv6Network allocated = IPv6Network.fromAddressAndMask(firstFreeRange.getFirst(), allocationSubnetSize);

            return doAllocate(allocated, firstFreeRange);
        }
        else
        {
            // exhausted
            return null;
        }
    }
321225
public static List<InetAddress> getMulticastAddresses() throws SocketException {
        Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
        List<InetAddress> ret = new ArrayList<InetAddress>();
        while (nifs.hasMoreElements()) {
            NetworkInterface nif = nifs.nextElement();
            if (checkMethod(nif, supportsMulticast) && checkMethod(nif, isUp)) {
                Enumeration<InetAddress> addresses = nif.getInetAddresses();
                while (addresses.hasMoreElements()) {
                    InetAddress addr = addresses.nextElement();
                    // TODO: IpV6 support
                    if (!(addr instanceof Inet6Address)) {
                        ret.add(addr);
                    }
                }
            }
        }
        return ret;
    }
370335
private static boolean mayBeIPv6Address(String input) {
        if (input == null) {
            return false;
        }

        boolean result = false;
        int colonsCounter = 0;
        int length = input.length();
        for (int i = 0; i < length; i++) {
            char c = input.charAt(i);
            if (c == '.' || c == '%') {
                // IPv4 in IPv6 or Zone ID detected, end of checking.
                break;
            }
            if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')
                    || (c >= 'A' && c <= 'F') || c == ':')) {
                return false;
            } else if (c == ':') {
                colonsCounter++;
            }
        }
        if (colonsCounter >= 2) {
            result = true;
        }
        return result;
    }
608708
public static String ipV6Address() {
        StringBuffer sb = new StringBuffer();
        sb.append(String.format("%04X", JDefaultNumber.randomIntBetweenTwoNumbers(1, 65535)));
        sb.append(":");
        sb.append(String.format("%04X", JDefaultNumber.randomIntBetweenTwoNumbers(1, 65535)));
        sb.append(":");
        sb.append(String.format("%04X", JDefaultNumber.randomIntBetweenTwoNumbers(1, 65535)));
        sb.append(":");
        sb.append(String.format("%04X", JDefaultNumber.randomIntBetweenTwoNumbers(1, 65535)));
        sb.append(":");
        sb.append(String.format("%04X", JDefaultNumber.randomIntBetweenTwoNumbers(1, 65535)));
        sb.append(":");
        sb.append(String.format("%04X", JDefaultNumber.randomIntBetweenTwoNumbers(1, 65535)));
        sb.append(":");
        sb.append(String.format("%04X", JDefaultNumber.randomIntBetweenTwoNumbers(1, 65535)));
        sb.append(":");
        sb.append(String.format("%04X", JDefaultNumber.randomIntBetweenTwoNumbers(1, 65535)));

        return sb.toString();

    }
1352151
def ipaddr(value, options=None):
    '''
    
    '''
    ipv4_obj = ipv4(value, options=options)
    ipv6_obj = ipv6(value, options=options)
    if ipv4_obj is None or ipv6_obj is None:
        # an IP address can be either IPv4 either IPv6
        # therefofe if the value passed as arg is not a list, at least one of the calls above will return None
        # if one of them is none, means that we should return only one of them
        return ipv4_obj or ipv6_obj  # one of them
    else:
        return ipv4_obj + ipv6_obj
533678
def get_host_ipv6addr_info(ipv6addr=None, mac=None,
                                        discovered_data=None,
                                        return_fields=None, **api_opts):
    '''
    
    '''
    infoblox = _get_infoblox(**api_opts)
    return infoblox.get_host_ipv6addr_object(ipv6addr, mac, discovered_data, return_fields)
100506
public function getIpV6() : ?string 
    {
        if ( ! $this->hasIpV6()) {
            $this->setIpV6($this->getDefaultIpV6());
        }
        return $this->ipV6;
    }
1103584
def ip_address_list(ips):
    
    # first, try it as a single IP address
    try:
        return ip_address(ips)
    except ValueError:
        pass
    # then, consider it as an ipaddress.IPv[4|6]Network instance and expand it
    return list(ipaddress.ip_network(u(ips)).hosts())
874129
def ip_address(self,
                   container: Container,
                   raise_error: bool = False
                   ) -> Optional[Union[IPv4Address, IPv6Address]]:
        
         # TODO: refactor!
        api_client = docker.APIClient(base_url='unix://var/run/docker.sock')
        docker_info = api_client.inspect_container(container.id)
        address = docker_info['NetworkSettings']['IPAddress']
        try:
            return IPv4Address(address)
        except ipaddress.AddressValueError:
            try:
                return IPv6Address(address)
            except ipaddress.AddressValueError:
                if raise_error:
                    raise
                return None