
    mbi:                        d dl mZ d dlZd dlZd dlZd dlmZ d dlmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZ d	d
lmZmZ dgZ eed          sde_        ededddd dd"d!            ZdS )#    )annotationsN)asynccontextmanager)AsyncGeneratorCallablecast   )QuicConfiguration)QuicConnection)SessionTicketHandler   )QuicConnectionProtocolQuicStreamHandlerconnectIPPROTO_IPV6)   T)configurationcreate_protocolsession_ticket_handlerstream_handlerwait_connected
local_porthoststrportintr   QuicConfiguration | Noner   Callable | Noner   SessionTicketHandler | Noner   QuicStreamHandler | Noner   boolr   return&AsyncGenerator[QuicConnectionProtocol]c                K   t          j                    }d}		 t          j        |            d}
n# t          $ r | }
Y nw xY w|                    | |t          j                   d{V }|d         d         }t          |          dk    rd|d         z   |d         ddf}|t          d	
          }|j
        |
|_
        t          ||          t          j        t          j        t          j                  }d}	 |                    t          j        t          j        d           |                    |	|ddf           d	}|s|                                 n# |s|                                 w w xY w|                    fd|           d{V \  }}t'          t(          |          }	 |                    |           |r|                                 d{V  |W V  |                                 |                                 d{V  |                                 dS # |                                 |                                 d{V  |                                 w xY w)aa  
    Connect to a QUIC server at the given `host` and `port`.

    :meth:`connect()` returns an awaitable. Awaiting it yields a
    :class:`~qh3.asyncio.QuicConnectionProtocol` which can be used to
    create streams.

    :func:`connect` also accepts the following optional arguments:

    * ``configuration`` is a :class:`~qh3.quic.configuration.QuicConfiguration`
      configuration object.
    * ``create_protocol`` allows customizing the :class:`~asyncio.Protocol` that
      manages the connection. It should be a callable or class accepting the same
      arguments as :class:`~qh3.asyncio.QuicConnectionProtocol` and returning
      an instance of :class:`~qh3.asyncio.QuicConnectionProtocol` or a subclass.
    * ``session_ticket_handler`` is a callback which is invoked by the TLS
      engine when a new session ticket is received.
    * ``stream_handler`` is a callback which is invoked whenever a stream is
      created. It must accept two arguments: a :class:`asyncio.StreamReader`
      and a :class:`asyncio.StreamWriter`.
    * ``local_port`` is the UDP port number that this client wants to bind.
    z::N)typer      r   z::ffff:r   T)	is_client)r   r   Fc                                 S )N)r    )
connectionr   r   s   b/var/www/html/mdtn/previsions/meteo_cartes/venv/lib/python3.11/site-packages/qh3/asyncio/client.py<lambda>zconnect.<locals>.<lambda>\   s    
>JJJ     )sock)asyncioget_running_loop	ipaddress
ip_address
ValueErrorgetaddrinfosocket
SOCK_DGRAMlenr	   server_namer
   AF_INET6
setsockoptr   IPV6_V6ONLYbindclosecreate_datagram_endpointr   r   r   r   wait_closed)r   r   r   r   r   r   r   r   loop
local_hostr7   infosaddrr-   	completed	transportprotocolr)   s      ` `           @r*   r   r      s     D #%%DJT"""    ""4F4E"FFFFFFFFE8A;D
4yyA~~DG#T!Wa3 )D999 ($/!#<R  J
 =&*;<<DI+V-?CCC		:z1a0111	 	JJLLL  	JJLLLL	 !% = =JJJJJJ !> ! !      Ix *H55H 	,))+++++++++""$$$$$$$$$ 	""$$$$$$$$$s)   3 AA AE E646H. .AI2)r   r   r   r   r   r   r   r   r   r   r   r   r   r    r   r   r!   r"   )
__future__r   r.   r0   r4   
contextlibr   typingr   r   r   quic.configurationr	   quic.connectionr
   tlsr   rE   r   r   __all__hasattrr   r   r(   r,   r*   <module>rN      s)   " " " " " "       * * * * * * 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 , , , , , , & & & & & & ? ? ? ? ? ? ? ?+ wv~&& F 
 /3'=:>/3R R R R R R R Rr,   