
    kjZ                         d dl Z defdZy)    Nreturnc                     t        d      D ]  } t        j                  t        j                  t        j                        }t        j                  t        j                  t        j                        }	 |j                  d       |j                         d   }|j                  d|f       |j                          ||j                          c S  y# t        $ r Y nw xY w	 |j                          # |j                          w xY w)z
    Get a port that's free for both TCP and UDP.

    This method never raises. If no free port can be found, 0 is returned.
    
   ) r      r   r   )	rangesocketAF_INETSOCK_STREAM
SOCK_DGRAMbindgetsocknamecloseOSError)_tcpudpports       `/home/ubuntu/.cache/pipx/cdb5059130eadca/lib/python3.12/site-packages/mitmproxy/net/free_port.pyget_free_portr      s     2Y mmFNNF,>,>?mmFNNF,=,=>		HHW)!,DHHb$Z IIK IIK   		IIKCIIKs%   4AC	CC2CC22D)r	   intr        r   <module>r      s    s r   