U mf@sdZddlZddlZddlZddlZejdZejdZ ee fe ejj ejj ejj dddZ ee fejj ejj ejj e dd d Z dS) zDNS Reverse Map Names.Nz in-addr.arpa.z ip6.arpa.)text v4_origin v6_originreturncCszXtj|}tj|r6dd|ddD}|}n ddtt|D}|}Wn.tk rddtj |D}|}YnXtj j d t ||dS) aConvert 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``. cSsg|] }d|qSz%d.0byterr=/opt/hc_python/lib/python3.8/site-packages/dns/reversename.py 9sz from_address.. NcSsg|]}|qSrr)r xrrr r <scSsg|] }d|qSrrrrrr r ?s.)origin)dnsipv6 inet_atonZ is_mappedstrbinasciihexlifydecode Exceptionipv4name from_textjoinreversed)rrrZv6partsrrrr from_addresss   r)rrrrc Cs||r8||}dt|j}tjtj|S||r||}t t|j}g}t dt |dD] }| d|||dqnd|}tj tj |StjddS)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 familyN)Z is_subdomainZ relativizerrlabelsrr inet_ntoarlistrangelenappendr exception SyntaxError)rrrrr$rirrr to_addressDs     r-)__doc__rZdns.ipv4rZdns.ipv6Zdns.namerrZipv4_reverse_domainZipv6_reverse_domainrNamerr-rrrr s,   (