Package netaddr :: Module strategy :: Class IPv6Strategy
[frames] | no frames]

Class IPv6Strategy

source code

  object --+    
           |    
AddrStrategy --+
               |
              IPv6Strategy

Implements the operations that can be performed on an Internet Protocol version 6 network address.

Supports all address formats detailed in RFC 4291.

NB - This class would benefit greatly from access to inet_pton/inet_ntop() function calls in Python's socket module. Sadly, it isn't available so we'll have to put up with the pure-Python implementation here for now.

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
valid_str(self, addr)
Returns True if IPv6 network address string is valid, False otherwise.
source code
 
str_to_int(self, addr)
Returns the equivalent network byte order integer for a given IP version 6 address.
source code
 
int_to_str(self, int_val, compact=True, word_fmt=None)
Returns the IP version 6 string form equal to the network byte order integer value provided.
source code
 
int_to_arpa(self, int_val)
Returns the reverse DNS lookup for an IPv6 address in network byte order integer form.
source code

Inherited from AddrStrategy: bits_to_int, bits_to_str, bits_to_words, description, int_to_bits, int_to_words, str_to_bits, str_to_words, valid_bits, valid_int, valid_words, word_to_bits, words_to_bits, words_to_int, words_to_str

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

valid_str(self, addr)

source code 

Returns True if IPv6 network address string is valid, False otherwise.

Overrides: AddrStrategy.valid_str

str_to_int(self, addr)

source code 

Returns the equivalent network byte order integer for a given IP version 6 address.

e.g. '::1' -> 1 (loopback)

Overrides: AddrStrategy.str_to_int

int_to_str(self, int_val, compact=True, word_fmt=None)

source code 

Returns the IP version 6 string form equal to the network byte order integer value provided. The output is configurable :-

compact - (optional) if True, use '::' to represent the first adjacent group of words with a value of zero. (default: True).

Overrides: AddrStrategy.int_to_str