
    \d                        d Z ddlZddlmZmZ ddlmZ ddlmZ ddl	Z	ddl
mZ ddlmZ ddlmZmZ dd	lmZ  ee           e	j        d
d
           G d d                                  Z ee           e	j        d
d
           G d d                                  Z ee           G d d                      Z e	j        d
d
           ee           G d d                                  Z e	j        dddd
           ee           G d d                                  Z G d de          ZdS )z*
Address objects for network connections.
    N)OptionalUnion)warn)implementer)Literal)IAddress)_asFilesystemBytes_coerceToFilesystemEncoding)platformT)hashauto_attribsc                       e Zd ZU dZ ej        ej                            ddg                    Ze	e
d         e
d         f         ed<   eed<   eed<   dS )	IPv4Addressat  
    An L{IPv4Address} represents the address of an IPv4 socket endpoint.

    @ivar type: A string describing the type of transport, either 'TCP' or
        'UDP'.

    @ivar host: A string containing a dotted-quad IPv4 address; for example,
        "127.0.0.1".
    @type host: C{str}

    @ivar port: An integer representing the port number.
    @type port: C{int}
    TCPUDP	validatortypehostportN)__name__
__module____qualname____doc__attrib
validatorsin_r   r   r   __annotations__strint     8lib/python3.11/site-packages/twisted/internet/address.pyr   r      s           3:$'/%%uen553 3 3D%.
/    III
IIIIIr#   r   c                       e Zd ZU dZ ej        ej                            ddg                    Ze	e
d         e
d         f         ed<   eed<   eed<   dZeed	<   dZe	eef         ed
<   dS )IPv6Addressa  
    An L{IPv6Address} represents the address of an IPv6 socket endpoint.

    @ivar type: A string describing the type of transport, either 'TCP' or
        'UDP'.

    @ivar host: A string containing a colon-separated, hexadecimal formatted
        IPv6 address; for example, "::1".
    @type host: C{str}

    @ivar port: An integer representing the port number.
    @type port: C{int}

    @ivar flowInfo: the IPv6 flow label.  This can be used by QoS routers to
        identify flows of traffic; you may generally safely ignore it.
    @type flowInfo: L{int}

    @ivar scopeID: the IPv6 scope identifier - roughly analagous to what
        interface traffic destined for this address must be transmitted over.
    @type scopeID: L{int} or L{str}
    r   r   r   r   r   r   r   flowInfoscopeIDN)r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r'   r(   r"   r#   r$   r&   r&   /   s          , 3:$'/%%uen553 3 3D%.
/    III
IIIHc GU38_     r#   r&   c                       e Zd ZdZdS )_ProcessAddresszD
    An L{interfaces.IAddress} provider for process transports.
    N)r   r   r   r   r"   r#   r$   r*   r*   Q   s           r#   r*   c                   (    e Zd ZU dZeed<   eed<   dS )HostnameAddressa  
    A L{HostnameAddress} represents the address of a L{HostnameEndpoint}.

    @ivar hostname: A hostname byte string; for example, b"example.com".
    @type hostname: L{bytes}

    @ivar port: An integer representing the port number.
    @type port: L{int}
    hostnamer   N)r   r   r   r   bytesr   r!   r"   r#   r$   r,   r,   X   s.           OOO
IIIIIr#   r,   F)r   repreqr   c                       e Zd ZU dZ ej        ej                            e                    Z	e
e         ed<    eej        dd          	dedefdZndedefd	Zdefd
Zd ZdS )UNIXAddressz
    Object representing a UNIX socket endpoint.

    @ivar name: The filename associated with this socket.
    @type name: C{bytes}
    )	converternamesamefileNotherreturnc                 P   t          || j                  st          S | j        |j        k    }|sw| j        rp|j        ri	 t          j                            | j        |j                  S # t          $ r Y n2t          t          f$ r}t          j                    s|Y d}~nd}~ww xY w|S )z
            Overriding C{attrs} to ensure the os level samefile
            check is done if the name attributes do not match.
            N)
isinstance	__class__NotImplementedr4   ospathr5   OSError	TypeError
ValueErrorr   isLinux)selfr6   reses       r$   __eq__zUNIXAddress.__eq__y   s    
 eT^44 &%%)uz)C 	 49 	  	  7++DIuzBBB   D!:.       $+--            
 Js   )A( (
B#4B#BB#c                 Z    t          || j                  r| j        |j        k    S t          S N)r9   r:   r4   r;   )rB   r6   s     r$   rE   zUNIXAddress.__eq__   s+    %00 /yEJ..!!r#   c                 J    | j         }|rt          d| j                   }d|dS )N zUNIXAddress())r4   r
   )rB   r4   s     r$   __repr__zUNIXAddress.__repr__   s3    y 	>.r49==D'd''''r#   c                     | j         t          | j        d f          S 	 t          j        | j                   }t          |j        |j        f          S # t          $ r t          | j                   cY S w xY wrG   )r4   r   r:   r<   statst_inost_devr>   )rB   s1s     r$   __hash__zUNIXAddress.__hash__   s{    9.///	###BBI./// 	# 	# 	#	??"""	#s   3A A43A4)r   r   r   r   r   r   
convertersoptionalr	   r4   r   r.   r   getattrr<   r=   objectboolrE   r    rK   rQ   r"   r#   r$   r2   r2   i   s           $DG/**+=>>  D(5/    wrw
D))5	 	4 	 	 	 	 	,	" 	"4 	" 	" 	" 	"
(# ( ( ( (# # # # #r#   r2   c                   "    e Zd ZdZdedefdZdS )_ServerFactoryIPv4Addressz@Backwards compatibility hack. Just like IPv4Address in practice.r6   r7   c                    t          |t                    r)t          dt          d           | j        | j        f|k    S t          |t                    r.| j        | j        | j        f}|j        |j        |j        f}||k    S t          S )Nz?IPv4Address.__getitem__ is deprecated.  Use attributes instead.   )category
stacklevel)	r9   tupler   DeprecationWarningr   r   r   r   r;   )rB   r6   abs       r$   rE   z _ServerFactoryIPv4Address.__eq__   s    eU## 
	T+   
 Ity)U22{++ 	DIty1AUZ4A6Mr#   N)r   r   r   r   rU   rV   rE   r"   r#   r$   rX   rX      s<        JJF t      r#   rX   )r   r<   typingr   r   warningsr   zope.interfacer   r   typing_extensionsr   twisted.internet.interfacesr   twisted.python.filepathr	   r
   twisted.python.runtimer   sr   r&   r*   r,   r2   rX   r"   r#   r$   <module>ri      s   
 
			 " " " " " " " "       & & & & & &  % % % % % % 0 0 0 0 0 0 S S S S S S S S + + + + + + XT%%%       &% , XT%%%! ! ! ! ! ! ! &% !@ X        T%%%X        &% U5t<<<X6# 6# 6# 6# 6# 6# 6#  =<6#z         r#   