AlkantarClanX12

Your IP : 18.191.212.146


Current Path : /proc/self/root/usr/lib/python3.6/site-packages/dns/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3.6/site-packages/dns/__pycache__/ipv6.cpython-36.pyc

3

�b�W��@s�dZddlZddlZddlZddlZddlmZmZm	Z	ej
d�Zdd�Zej
d�Z
ej
d	�Zej
d
�Zdd�ZdZdd�ZdS)zIPv6 helper functions.�N�)�xrange�binary_type�maybe_decodes
0+([0-9a-f]+)cCs�t|�dkrtd��tj|�}g}d}t|�}xJ||krx|||d�}tj|�}|dk	rd|jd�}|j|�|d7}q0Wd}d}d}	d}
xNtd�D]B}||d	kr�|
r�|}||	}||kr�|	}|}d}
q�|
s�|}	d
}
q�W|
�r�d}||	}||k�r�|	}|}|dk�r�|dk�rb|dk�s4|dk�rb|dd
k�rb|dk�rDd}
nd}
|
t	j
j|dd��}n,dj|d|��ddj|||d��}n
dj|�}t
|�S)z�Convert a network format IPv6 address into text.

    @param address: the binary address
    @type address: string
    @rtype: string
    @raises ValueError: the address isn't 16 bytes long
    �z IPv6 addresses are 16 bytes longr�NrF��0T��sffffs::s::ffff:��:���)�len�
ValueError�binasciiZhexlify�
_leading_zero�match�group�appendr�dns�ipv4�	inet_ntoa�joinr)�address�hex�chunks�i�l�chunk�mZ
best_startZbest_len�startZ
last_was_zero�endZcurrent_len�prefix�r$�/usr/lib/python3.6/ipv6.pyrs^	










rs(.*):(\d+\.\d+\.\d+\.\d+)$s::.*s.*::$c
Cs�t|t�s|j�}|dkrd}tj|�}|dk	rvttjj|j	d���}d|j	d�j
�|d|d|d|dfj�}tj|�}|dk	r�|dd�}ntj|�}|dk	r�|dd�}|j
d	�}t|�}|d
kr�tjj�d}g}x�|D]�}|dk�r.|�rtjj�d
}xftdd
|d�D]}|jd��qWq�t|�}	|	dk�rHtjj�|	dk�rbdd|	|}|j|�q�W|d
k�r�|�r�tjj�dj|�}y
tj|�Stjtfk
�r�tjj�YnXdS)z�Convert a text format IPv6 address into network format.

    @param text: the textual address
    @type text: string
    @rtype: string
    @raises dns.exception.SyntaxError: the text was not properly formatted
    s::s0::N�z%s:%02x%02x:%02x%02xrr�r
rF�Ts0000rr	r)�
isinstancer�encode�
_v4_endingr�	bytearrayrr�	inet_atonr�decode�_colon_colon_start�_colon_colon_end�splitrZ	exception�SyntaxErrorrrrrZ	unhexlify�Error�	TypeError)
�textr �brrZ
seen_emptyZ	canonical�crZlcr$r$r%r-bsR










r-��
s��cCs
|jt�S)N)�
startswith�_mapped_prefix)rr$r$r%�	is_mapped�sr<s
s��)�__doc__�rerZ
dns.exceptionrZdns.ipv4Z_compatrrr�compilerrr+r/r0r-r;r<r$r$r$r%�<module>s
C


G