ó
    ÌÅLgŒ  ã                   ó
  • S r SSKrSSKJrJrJr  SSKrSSKr\R                  r	\R                  r
S\S\S\4S jrS\S\S\4S	 jrS\S\4S
 jrS\S\4S jrS\S\4S jr SS\\\4   S\\   S\4S jjrS rS\S\4S jrg)z*Generic Internet address helper functions.é    N)ÚAnyÚOptionalÚTupleÚfamilyÚtextÚreturnc                 ó´   • U [         :X  a  [        R                  R                  U5      $ U [        :X  a   [        R
                  R                  US5      $ [        e)a  Convert the textual form of a network address into its binary form.

*family* is an ``int``, the address family.

*text* is a ``str``, the textual address.

Raises ``NotImplementedError`` if the address family specified is not
implemented.

Returns a ``bytes``.
T)ÚAF_INETÚdnsÚipv4Ú	inet_atonÚAF_INET6Úipv6ÚNotImplementedError)r   r   s     Ú*/usr/lib/python3/dist-packages/dns/inet.pyÚ	inet_ptonr   !   sF   € ð ”ÓÜ�x‰x×!Ñ! $Ó'Ð'Ø	”8Ó	Ü�x‰x×!Ñ! $¨Ó-Ð-ä!Ð!ó    Úaddressc                 ó²   • U [         :X  a  [        R                  R                  U5      $ U [        :X  a  [        R
                  R                  U5      $ [        e)a  Convert the binary form of a network address into its textual form.

*family* is an ``int``, the address family.

*address* is a ``bytes``, the network address in binary form.

Raises ``NotImplementedError`` if the address family specified is not
implemented.

Returns a ``str``.
)r
   r   r   Ú	inet_ntoar   r   r   )r   r   s     r   Ú	inet_ntopr   6   sD   € ð ”ÓÜ�x‰x×!Ñ! 'Ó*Ð*Ø	”8Ó	Ü�x‰x×!Ñ! 'Ó*Ð*ä!Ð!r   c                 óä   •  [         R                  R                  U 5        [        $ ! [         a>     [         R
                  R                  U S5        [        s $ ! [         a    [        ef = ff = f)zÐDetermine the address family of a textual-form network address.

*text*, a ``str``, the textual address.

Raises ``ValueError`` if the address family cannot be determined
from the input.

Returns an ``int``.
T)r   r   r   r
   Ú	Exceptionr   r   Ú
ValueError©r   s    r   Úaf_for_addressr   K   s`   € ðÜ�‰×Ñ˜4Ô ÜˆøÜó ð	Ü�H‰H×Ñ˜t TÔ*ÜŠOøÜó 	ÜÐð	úð	ús    ‚$' §
A/²%AÁA/ÁA+Á+A/c                 ó  •  [         R                  R                  U 5      S   nUS:¬  =(       a    US:*  $ ! [         a@     [         R                  R                  U S5      S   nUS:H  s $ ! [         a    [
        ef = ff = f)zÉIs the textual-form network address a multicast address?

*text*, a ``str``, the textual address.

Raises ``ValueError`` if the address family cannot be determined
from the input.

Returns a ``bool``.
r   éà   éï   Téÿ   )r   r   r   r   r   r   )r   Úfirsts     r   Úis_multicastr"   a   s�   € ðÜ—‘×"Ñ" 4Ó(¨Ñ+ˆØ˜‰|×, ¨¡Ð,øÜó ð	Ü—H‘H×&Ñ& t¨TÓ2°1Ñ5ˆEØ˜C‘<ÒøÜó 	ÜÐð	úð	ús!   ‚25 µ
A?Á 'A*Á'A?Á*A;Á;A?c                 óÈ   •  [         R                  R                  U 5        g! [         a5     [         R                  R                  U S5         g! [         a      gf = ff = f)zoIs the specified string an IPv4 or IPv6 address?

*text*, a ``str``, the textual address.

Returns a ``bool``.
TF)r   r   r   r   r   r   s    r   Ú
is_addressr$   w   sY   € ðÜ�‰×Ñ˜4Ô ØøÜó ð	Ü�H‰H×Ñ˜t TÔ*ÙøÜó 	Úð	úð	ús&   ‚" ¢
A!­ AÁ
AÁA!ÁAÁA!Ú
high_tupleÚafc                 ó°  • U u  p#Uc  [        U5      nU[        :X  a  X#4$ U[        :X  ae  UR                  S5      nUS:  a  X#SS4$ USU nX$S-   S nUR	                  5       (       a  XSS[        U5      4$  XSS[        R                  " U5      4$ [        SU 35      e! [         a.    [        R                  n[        R                  " X#US9tGt p‰nU	s $ f = f)a@  Given a "high-level" address tuple, i.e.
an (address, port) return the appropriate "low-level" address tuple
suitable for use in socket calls.

If an *af* other than ``None`` is provided, it is assumed the
address in the high-level tuple is valid and has that af.  If af
is ``None``, then af_for_address will be called.
NÚ%r   é   )Úflagsúunknown address family )r   r
   r   ÚfindÚisdigitÚintÚsocketÚif_nametoindexÚAttributeErrorÚAI_NUMERICHOSTÚgetaddrinfor   )
r%   r&   r   ÚportÚiÚaddrpartÚscopeÚai_flagsÚ_Útups
             r   Úlow_level_address_tupler;   Š   sò   € ð �M€GØ	�zÜ˜GÓ$ˆØ	ŒWƒ}ØˆÐØ	Œx‹Ø�L‰L˜ÓˆØˆq‹5à 1 aÐ(Ð(à˜2˜A�;ˆØ˜A™˜Ð ˆØ�=‰=�?‰?Ø A¤s¨5£zÐ2Ð2ð	Ø A¤v×'<Ò'<¸UÓ'CÐDÐDô "Ð$;¸B¸4Ð"@ÓAÐAøô ó 	Ü×,Ñ,ˆHÜ$×0Ò0°ÀhÑOˆO‰Yˆq˜ØŠJð	ús   Á6B Â5CÃCc                 ór   • U [         R                  :X  a  gU [         R                  :X  a  g[        SU  35      e)z:Return the 'any' address for the specified address family.z0.0.0.0z::r+   )r/   r
   r   r   )r&   s    r   Ú
any_for_afr=   ®   s3   € à	ŒV�^‰^ÓØØ	Œv�‰Ó	ØÜ
Ð 7¸°tÐ<Ó
=Ð=r   c                 óÊ   •  [         R                  R                  U 5      $ ! [         a7     [         R                  R                  U 5      s $ ! [         a    [
        ef = ff = f)zðVerify that *address* is a valid text form IPv4 or IPv6 address and return its
canonical text form.  IPv6 addresses with scopes are rejected.

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

Raises ``ValueError`` if the text is not valid.
)r   r   Úcanonicalizer   r   r   r   s    r   r?   r?   ·   sZ   € ðÜ�x‰x×$Ñ$ TÓ*Ð*øÜó ð	Ü—8‘8×(Ñ(¨Ó.Ò.øÜó 	ÜÐð	úðús    ‚! ¡
A"¬AÁ
A"ÁAÁA")N)Ú__doc__r/   Útypingr   r   r   Údns.ipv4r   Údns.ipv6r
   r   r.   ÚstrÚbytesr   r   r   Úboolr"   r$   r;   r=   r?   © r   r   Ú<module>rH      så   ðñ$ 1ã ß 'Ñ 'ã Û ð
 �.‰.€Ø�?‰?€ð"�cð " ð "¨ô "ð*"�cð " Eð "¨cô "ð*˜ð  ô ð,�sð ˜tô ð,�Sð ˜Tô ð( 6:ñ!BØ�c˜3�h‘ð!BØ%-¨c¡]ð!Bàõ!BòH>ð�sð ˜sõ r   