%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/dns/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/dns/__pycache__/ipv6.cpython-312.pyc

�

5��e���&�dZddlZddlZddlmZmZddlZddlZejd�Z
dedefd�Z
ejd�Zejd	�Zejd
�Zddeeefdedefd
�ZdZdedefd�Zdeeefdefd�Zy)zIPv6 helper functions.�N)�List�Unionz
0+([0-9a-f]+)�address�returnc��t|�dk7rtd��tj|�}g}d}t|�}||krZ|||dzj	�}t
j
|�}|�|jd�}|j|�|dz
}||kr�Zd}d}d}	d}
td	�D]'}||d
k7r|
s�|}||	z
}||kDr|	}|}d}
�!|
r�$|}	d}
�)|
rd	}||	z
}||kDr|	}|}|dkDry|dk(rC|dk(s
|d
k(r9|d
dk(r1|dk(rd}
nd}
|
tjj|dd�z}|Sdj|d|�dzdj|||zd�z}|Sdj|�}|S)z�Convert an IPv6 address in binary form to text form.

    *address*, a ``bytes``, the IPv6 address in binary form.

    Raises ``ValueError`` if the address isn't 16 bytes long.
    Returns a ``str``.
    �z IPv6 addresses are 16 bytes longr�N����F��0T���ffffz::z::ffff:��:)�len�
ValueError�binascii�hexlify�decode�
_leading_zero�match�group�append�range�dns�ipv4�	inet_ntoa�join)r�hex�chunks�i�l�chunk�m�
best_start�best_len�start�
last_was_zero�end�current_len�prefix�thexs               �*/usr/lib/python3/dist-packages/dns/ipv6.pyrrs����7�|�r���;�<�<�
�
�
�7�
#�C�
�F�	�A��C��A�
�a�%��A��A���%�%�'��
����&���=��G�G�A�J�E��
�
�e��	�Q����a�%��J��H��E��M�
�1�X�!���!�9������!�E�k����)�!&�J�*�H� %�
���E� �M�!�����E�k����!��J�"�H��!�|���?��A�
��Q��6�!�9�PV�CV��1�}���"���C�H�H�.�.�w�r�s�|�<�<�D��K�
������,�-����(�(�6�*�x�"7�"9�:�;�<�
��K��x�x�����K�s(.*):(\d+\.\d+\.\d+\.\d+)$s::.*s.*::$�text�ignore_scopec�`�t|t�s|j�}n|}|rF|jd�}t	|�}|dk(r|d}n|dkDrt
jj�|dk(rt
jj�|jd�r+|jd�st
jj�|jd�r+|jd�st
jj�|dk(rd}tj|�}|�zt
jj|jd��}d	j|jd
�j!�|d|d
|d|d�j�}t"j|�}|�|d
d}nt$j|�}|�|dd}|jd�}t	|�}|d
kDrt
jj�d}g}	|D]�}
|
dk(rG|rt
jj�d}t'dd
|z
d
z�D]}|	j)d���Ot	|
�}|dkDrt
jj�|dk7rdd|z
z|
z}
|	j)|
���|d
kr|st
jj�dj+|	�}	t-j.|�S#t,j0t2f$rt
jj�wxYw)a+Convert an IPv6 address in text form to binary form.

    *text*, a ``str`` or ``bytes``, the IPv6 address in textual form.

    *ignore_scope*, a ``bool``.  If ``True``, a scope will be ignored.
    If ``False``, the default, it is an error for a scope to be present.

    Returns a ``bytes``.
    �%�rr0�:s::s0::Nz{}:{:02x}{:02x}:{:02x}{:02x}r
�rrFTs0000r	�0)�
isinstance�bytes�encode�splitrr�	exception�SyntaxError�endswith�
startswith�
_v4_endingrr�	inet_atonr�formatr�_colon_colon_start�_colon_colon_endrrr r�	unhexlify�Error�	TypeError)
r1r2�btext�partsr$r&�br"�
seen_empty�	canonical�c�_�lcs
             r/rBrBhs����d�E�"����
��������D�!����J����6��!�H�E�
��U��-�-�+�+�+���|��m�m�'�'�'�	����	�e�n�n�U�&;��m�m�'�'�'�	�	�	�$�	��(8�(8��(?��m�m�'�'�'�	�%����	�����A��}��H�H���q�w�w�q�z�*��*�1�1�����
�!�!�#�Q�q�T�1�Q�4��1��q��t�
��&�(�		�	� � ��'�A��}��a�b�	���"�"�5�)���=��#�2�J�E��[�[��
�F��F��A��1�u��m�m�'�'�'��J��I�
�
 ����8���m�m�/�/�/��J��1�a�!�e�a�i�(�
*��� � ��)�
*��Q��B��A�v��m�m�/�/�/��Q�w��Q��V�_��)�����Q��
 �	�1�u�Z��m�m�'�'�'��H�H�Y��E�
(��!�!�%�(�(���N�N�I�&�(��m�m�'�'�'�(�s�$K9�94L-s��c�,�|jt�S)z�Is the specified address a mapped IPv4 address?

    *address*, a ``bytes`` is an IPv6 address in binary form.

    Returns a ``bool``.
    )r@�_mapped_prefix)rs r/�	is_mappedrS�s�����n�-�-r0c�z�tjjtjj|��S)aVerify that *address* is a valid text form IPv6 address and return its
    canonical text form.  Addresses with scopes are rejected.

    *text*, a ``str`` or ``bytes``, the IPv6 address in textual form.

    Raises ``dns.exception.SyntaxError`` if the text is not valid.
    )r�ipv6rrB)r1s r/�canonicalizerV�s(���8�8���c�h�h�0�0��6�7�7r0)F)�__doc__r�re�typingrr�
dns.exceptionr�dns.ipv4�compilerr:�strrrArDrE�boolrBrRrSrV�r0r/�<module>r`s���$��	������
�
�+�,�
�B�u�B��B�J�R�Z�Z�6�
7�
��R�Z�Z��)���2�:�:�i�(��Z(�E�#�u�*�%�Z(�T�Z(�e�Z(�z,��.�u�.��.�8�u�S�%�Z�(�8�S�8r0

Zerion Mini Shell 1.0