HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/dns/__pycache__/reversename.cpython-310.pyc
o

!we��	@s�dZddlZddlZddlZddlZej�d�Zej�d�Z	ee	fde
dejjdejjdejjfd	d
�Zee	fdejjdejjdejjde
fdd
�Z
dS)zDNS Reverse Map Names.�Nz
in-addr.arpa.z	ip6.arpa.�text�	v4_origin�	v6_origin�returncCs�z,tj�|�}tj�|�rdd�|dd�D�}|}ndd�tt�|����D�}|}WntyBdd�tj	�|�D�}|}Ynwtj
jd�t
|��|d�S)	a�Convert an IPv4 or IPv6 address in textual form into a Name object whose
    value is the reverse-map domain name of the address.

    *text*, a ``str``, is an IPv4 or IPv6 address in textual form
    (e.g. '127.0.0.1', '::1')

    *v4_origin*, a ``dns.name.Name`` to append to the labels corresponding to
    the address if the address is an IPv4 address, instead of the default
    (in-addr.arpa.)

    *v6_origin*, a ``dns.name.Name`` to append to the labels corresponding to
    the address if the address is an IPv6 address, instead of the default
    (ip6.arpa.)

    Raises ``dns.exception.SyntaxError`` if the address is badly formed.

    Returns a ``dns.name.Name``.
    cS�g|]}d|�qS�z%d���.0�byterr�H/home/arjun/projects/env/lib/python3.10/site-packages/dns/reversename.py�
<listcomp>9�z from_address.<locals>.<listcomp>�NcSsg|]}|�qSrr)r
�xrrrr
<scSrrrr	rrrr
?r�.)�origin)�dns�ipv6�	inet_aton�	is_mapped�str�binascii�hexlify�decode�	Exception�ipv4�name�	from_text�join�reversed)rrr�v6�partsrrrr�from_addresss��r#rc	Cs�|�|�r|�|�}d�t|j��}tj�tj�|��S|�|�rW|�|�}t	t|j��}g}t
dt|�d�D]}|�d�|||d���q7d�|�}tj
�tj
�|��Stj�d��)aConvert a reverse map domain name into textual address form.

    *name*, a ``dns.name.Name``, an IPv4 or IPv6 address in reverse-map name
    form.

    *v4_origin*, a ``dns.name.Name`` representing the top-level domain for
    IPv4 addresses, instead of the default (in-addr.arpa.)

    *v6_origin*, a ``dns.name.Name`` representing the top-level domain for
    IPv4 addresses, instead of the default (ip6.arpa.)

    Raises ``dns.exception.SyntaxError`` if the name does not have a
    reverse-map form.

    Returns a ``str``.
    �.r���:z"unknown reverse-map address family)�is_subdomain�
relativizerr �labelsrr�	inet_ntoar�list�range�len�appendr�	exception�SyntaxError)rrrrr*r"�irrr�
to_addressDs




r3)�__doc__r�dns.ipv4r�dns.ipv6�dns.namerr�ipv4_reverse_domain�ipv6_reverse_domainr�Namer#r3rrrr�<module>s:����
�(�����