Generate a random IPv6 address.

        :return: Random IPv6 address.

        :Example:
            2001:c244:cf9d:1fb1:c56d:f52c:8a04:94f3
435045
def ip_v6(self) -> str:
        
        ipv6 = IPv6Address(
            self.random.randint(
                0, 2 ** 128 - 1,
            ),
        )
        return str(ipv6)
50601
public static IpAddress createIp6(String value, String admDom) {
		return createIp(IpAddressType.IPv6, value, admDom);
	}
389859
public IPv6Address getIPv6Address(IPv6AddressSegment segs[]) {
		IPv6AddressCreator creator = getIPv6Network().getAddressCreator();
		return creator.createAddress(IPv6AddressSection.createSection(creator, segs, this)); /* address creation */
	}
448872
def ip_address(self):
        
        networks = self.get("networks", {})
        v4nets = networks.get("v4", [])
        v6nets = networks.get("v6", [])
        try:
            return (v4nets + v6nets)[0].ip_address
        except IndexError:
            return None
684590
def get_if_raw_addr6(iff):
    
    #r = filter(lambda x: x[2] == iff and x[1] == IPV6_ADDR_GLOBAL, in6_getifaddr())
    r = [ x for x in in6_getifaddr() if x[2] == iff and x[1] == IPV6_ADDR_GLOBAL]
    if len(r) == 0:
        return None
    else:
        r = r[0][0] 
    return inet_pton(socket.AF_INET6, r)
324564
def str_to_inet(address):
    
    # First try ipv4 and then ipv6
    try:
        return socket.inet_pton(socket.AF_INET, address)
    except socket.error:
        return socket.inet_pton(socket.AF_INET6, address)
320473
def address(self):
        
        pattern = self.random_element(self.address_formats)
        return self.generator.parse(pattern)
742063
def create_api_ipv6(self):
        """"""

        return ApiIPv6(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
3169
def create_api_network_ipv6(self):
        """"""

        return ApiNetworkIPv6(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
915464
def randomwif(prefix, num):
    
    from bitsharesbase.account import PrivateKey

    t = [["wif", "pubkey"]]
    for n in range(0, num):
        wif = PrivateKey()
        t.append([str(wif), format(wif.pubkey, prefix)])
    print_table(t)
123646
def gethost(self, ip_addr):
        
        # Handle silly fake ipv6 addresses
        try:
            if ip_addr[:7] == '::ffff:':
                ip_addr = ip_addr[7:]
        except TypeError:
            pass

        if ip_addr[0] in string.letters:
            return ip_addr

        try:
            return self.hostsmap[ip_addr]
        except KeyError:
            pass

        try:
            name = socket.gethostbyaddr(ip_addr)[0]
        except socket.error:
            name = ip_addr

        self.hostsmap[ip_addr] = name
        return name
1262070
def teredo(self):
        
        if (self._ip >> 96) != 0x20010000:
            return None
        return (IPv4Address((self._ip >> 64) & 0xFFFFFFFF),
                IPv4Address(~self._ip & 0xFFFFFFFF))
66330
def generate_random_string(length=6):
    '''
    
    '''
    n = int(length / 2 + 1)
    x = binascii.hexlify(os.urandom(n))
    s = x[:length]
    return s.decode('utf-8')
88036
def to_ipv6(key):
    """"""

    if key[-2:] != '.k':
        raise ValueError('Key does not end with .k')

    key_bytes = base32.decode(key[:-2])
    hash_one = sha512(key_bytes).digest()
    hash_two = sha512(hash_one).hexdigest()

    return ':'.join([hash_two[i:i+4] for i in range(0, 32, 4)])
1362935
def _get_ipv6addrs(self):
        
        addrs = self._get_addrs()
        ipv6addrs = addrs.get(netifaces.AF_INET6)
        if not ipv6addrs:
            return {}
        return ipv6addrs[0]
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())
1038133
def target_to_ipv6_short(target):
    

    splitted = target.split('-')
    if len(splitted) != 2:
        return None
    try:
        start_packed = inet_pton(socket.AF_INET6, splitted[0])
        end_value = int(splitted[1], 16)
    except (socket.error, ValueError):
        return None
    start_value = int(binascii.hexlify(start_packed[14:]), 16)
    if end_value < 0 or end_value > 0xffff or end_value < start_value:
        return None
    end_packed = start_packed[:14] + struct.pack('!H', end_value)
    return ipv6_range_to_list(start_packed, end_packed)