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 in accordance with RFC 4291.

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

Instance Methods
 
__init__(self)
Constructor.
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 IPv6 address.
source code
 
int_to_str(self, int_val, compact=True, word_fmt=None)
Returns: The IPv6 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: __repr__, 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__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

Constructor.

Overrides: object.__init__

valid_str(self, addr)

source code 
Parameters:
  • addr - An IPv6 address in string form.
Returns:
True if IPv6 network address string is valid, False otherwise.
Overrides: AddrStrategy.valid_str

str_to_int(self, addr)

source code 
Parameters:
  • addr - An IPv6 address in string form.
Returns:
The equivalent network byte order integer for a given IPv6 address.
Overrides: AddrStrategy.str_to_int

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

source code 
Parameters:
  • int_val - A network byte order integer.
  • compact - (optional) A boolean flag indicating if compact formatting should be used. If True, this method uses the '::' string to represent the first adjacent group of words with a value of zero. Default: True
  • word_fmt - (optional) The Python format string used to override formatting for each word.
Returns:
The IPv6 string form equal to the network byte order integer value provided.
Overrides: AddrStrategy.int_to_str

int_to_arpa(self, int_val)

source code 
Parameters:
  • int_val - A network byte order integer.
Returns:
The reverse DNS lookup for an IPv6 address in network byte order integer form.