
    kj                    ,    d dl mZ d dlZdddZdddZy)    )annotationsNc                R   d}	 t        j                   t         j                  t         j                        }|j                  | df       |j	                         d   ||j                          S S # t        $ r Y ||j                          yyw xY w# ||j                          w w xY w)z
    Get the default local outgoing IPv4 address without sending any packets.
    This will fail if the target address is known to be unreachable.
    We use Google DNS's IPv4 address as the default.
    NP   r   )socketAF_INET
SOCK_DGRAMconnectgetsocknamecloseOSError	reachabless     _/home/ubuntu/.cache/pipx/cdb5059130eadca/lib/python3.12/site-packages/mitmproxy/net/local_ip.pyget_local_ipr      s     	AMM&..&*;*;<			9b/"}}q! =GGI   =GGI  =GGI $   AA/ /	B8B BB B&c                R   d}	 t        j                   t         j                  t         j                        }|j                  | df       |j	                         d   ||j                          S S # t        $ r Y ||j                          yyw xY w# ||j                          w w xY w)z
    Get the default local outgoing IPv6 address without sending any packets.
    This will fail if the target address is known to be unreachable.
    We use Google DNS's IPv6 address as the default.
    Nr   r   )r   AF_INET6r   r	   r
   r   r   r   s     r   get_local_ip6r      s     	AMM&//6+<+<=			9b/"}}q! =GGI   =GGI  =GGI r   )z8.8.8.8)r   strreturnz
str | None)z2001:4860:4860::8888)
__future__r   r   r   r        r   <module>r      s    " &r   