
    Eqg              	       F   d Z ddlZddlZddlZddlZej                            d          Zej                            d          Z	ee	fde
dej        j        dej        j        dej        j        fd	Zee	fd
ej        j        dej        j        dej        j        de
fdZdS )zDNS Reverse Map Names.    Nzin-addr.arpa.z	ip6.arpa.text	v4_origin	v6_originreturnc                 &   	 t           j                            |           }t           j                            |          rd |dd         D             }|}n?d t	          t          j        |                                                    D             }|}n;# t          $ r. d t           j	                            |           D             }|}Y nw xY wt           j
                            d                    t          |                    |          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``.
    c                     g | ]}d |z  S z%d .0bytes     A/var/www/html/env/lib/python3.11/site-packages/dns/reversename.py
<listcomp>z from_address.<locals>.<listcomp>9   s    555TTD[555       Nc                     g | ]}|S r
   r
   )r   xs     r   r   z from_address.<locals>.<listcomp><   s    CCC1QCCCr   c                     g | ]}d |z  S r	   r
   r   s     r   r   z from_address.<locals>.<listcomp>?   s    BBBBBBr   .)origin)dnsipv6	inet_aton	is_mappedstrbinasciihexlifydecode	Exceptionipv4name	from_textjoinreversed)r   r   r   v6partsr   s         r   from_addressr'      s   0
X%%8b!! 	55RW555EFFCCH$4R$8$8$?$?$A$A B BCCCEF   BB););D)A)ABBB 8chhx77GGGs   BB 5CCr!   c           	      >   |                      |          rx|                     |          } d                    t          | j                            }t
          j                            t
          j                            |                    S |                      |          r|                     |          } t          t          | j                            }g }t          dt          |          d          D ]5}|                    d                    |||dz                                 6d                    |          }t
          j                            t
          j                            |                    S t
          j                            d          )a  Convert 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      r      :z"unknown reverse-map address family)is_subdomain
relativizer#   r$   labelsr   r    	inet_ntoar   listrangelenappendr   	exceptionSyntaxError)r!   r   r   r   r.   r&   is          r   
to_addressr7   D   sN   , ## Ny))yy$+..//x!!#("4"4T":":;;;			9	%	% 
Ny))ht{++,,q#f++q)) 	6 	6ALL&QU"3445555yyx!!#("4"4T":":;;;m''(LMMMr   )__doc__r   dns.ipv4r   dns.ipv6dns.namer!   r"   ipv4_reverse_domainipv6_reverse_domainr   Namer'   r7   r
   r   r   <module>r?      s  $      h((99 h((55 
  32#H #H
#Hx}#H x}#H 	X]	#H #H #H #HP  32%N %N
(-%Nx}%N x}%N 		%N %N %N %N %N %Nr   