§
    ¯õi‡  ã                  ó¼   — d dl mZ d dlZd dlmZmZmZ d dlZddlm	Z	  ed¦  «        Z
erd dlmZmZ ddlmZ d	de	d
œd(d„Zdd	ddœd)d„Zdd	ddej        dœd*d'„ZdS )+é    )ÚannotationsN)ÚTYPE_CHECKINGÚNoReturnÚTypeVaré   )ÚDEFAULT_DELAYÚT)Ú	AwaitableÚCallable)ÚSocketStreamF)Úhttps_compatibleÚssl_contextÚhappy_eyeballs_delayÚhostústr | bytesÚportÚintr   Úboolr   ússl.SSLContext | Noner   úfloat | NoneÚreturnútrio.SSLStream[SocketStream]c             ƒ  óú   K  — t          j        | ||¬¦  «        ƒ d{V —†}|€Ct          j        ¦   «         }t	          t          d¦  «        r|xj        t          j         z  c_        t          j        ||| |¬¦  «        S )aT  Make a TLS-encrypted Connection to the given host and port over TCP.

    This is a convenience wrapper that calls :func:`open_tcp_stream` and
    wraps the result in an :class:`~trio.SSLStream`.

    This function does not perform the TLS handshake; you can do it
    manually by calling :meth:`~trio.SSLStream.do_handshake`, or else
    it will be performed automatically the first time you send or receive
    data.

    Args:
      host (bytes or str): The host to connect to. We require the server
          to have a TLS certificate valid for this hostname.
      port (int): The port to connect to.
      https_compatible (bool): Set this to True if you're connecting to a web
          server. See :class:`~trio.SSLStream` for details. Default:
          False.
      ssl_context (:class:`~ssl.SSLContext` or None): The SSL context to
          use. If None (the default), :func:`ssl.create_default_context`
          will be called to create a context.
      happy_eyeballs_delay (float): See :func:`open_tcp_stream`.

    Returns:
      trio.SSLStream: the encrypted connection to the server.

    )r   NÚOP_IGNORE_UNEXPECTED_EOF)Úserver_hostnamer   )ÚtrioÚopen_tcp_streamÚsslÚcreate_default_contextÚhasattrÚoptionsr   Ú	SSLStream)r   r   r   r   r   Ú
tcp_streams         úg/var/www/html/nodeJS/PythonScripts/venv3.11/lib/python3.11/site-packages/trio/_highlevel_ssl_helpers.pyÚopen_ssl_over_tcp_streamr%      s°   è è € õD Ô+ØØØ1ðñ ô ð ð ð ð ð ð €Jð
 ÐÝÔ0Ñ2Ô2ˆå•3Ð2Ñ3Ô3ð 	AØÐÔ¥CÔ$@Ð#@Ñ@ÐÔåŒ>ØØØØ)ð	ñ ô ð ó    ©r   r   Úbacklogússl.SSLContextústr | bytes | Noner(   ú
int | Noneú$list[trio.SSLListener[SocketStream]]c             ƒ  óf   ‡‡K  — t          j        | ||¬¦  «        ƒ d{V —†}ˆˆfd„|D ¦   «         }|S )a*  Start listening for SSL/TLS-encrypted TCP connections to the given port.

    Args:
      port (int): The port to listen on. See :func:`open_tcp_listeners`.
      ssl_context (~ssl.SSLContext): The SSL context to use for all incoming
          connections.
      host (str, bytes, or None): The address to bind to; use ``None`` to bind
          to the wildcard address. See :func:`open_tcp_listeners`.
      https_compatible (bool): See :class:`~trio.SSLStream` for details.
      backlog (int or None): See :func:`open_tcp_listeners` for details.

    )r   r(   Nc                ó>   •— g | ]}t          j        |‰‰¬ ¦  «        ‘ŒS ))r   )r   ÚSSLListener)Ú.0Útcp_listenerr   r   s     €€r$   ú
<listcomp>z/open_ssl_over_tcp_listeners.<locals>.<listcomp>e   s<   ø€ ð ð ð àõ 	Ô˜ {ÐEUÐVÑVÔVðð ð r&   )r   Úopen_tcp_listeners)r   r   r   r   r(   Útcp_listenersÚssl_listenerss    ` `   r$   Úopen_ssl_over_tcp_listenersr6   P   sh   øøè è € õ( Ô1°$¸TÈ7ÐSÑSÔSÐSÐSÐSÐSÐSÐS€Mðð ð ð ð à)ðñ ô €Mð Ðr&   )r   r   r(   Úhandler_nurseryÚtask_statusÚhandlerú;Callable[[trio.SSLStream[SocketStream]], Awaitable[object]]r7   útrio.Nursery | Noner8   ú5trio.TaskStatus[list[trio.SSLListener[SocketStream]]]r   c             ƒ  ó„   K  — t          j        |||||¬¦  «        ƒ d{V —†}t          j        | |||¬¦  «        ƒ d{V —† dS )uO  Listen for incoming TCP connections, and for each one start a task
    running ``handler(stream)``.

    This is a thin convenience wrapper around
    :func:`open_ssl_over_tcp_listeners` and :func:`serve_listeners` â€“ see them
    for full details.

    .. warning::

       If ``handler`` raises an exception, then this function doesn't do
       anything special to catch it â€“ so by default the exception will
       propagate out and crash your server. If you don't want this, then catch
       exceptions inside your ``handler``, or use a ``handler_nursery`` object
       that responds to exceptions in some other way.

    When used with ``nursery.start`` you get back the newly opened listeners.
    See the documentation for :func:`serve_tcp` for an example where this is
    useful.

    Args:
      handler: The handler to start for each incoming connection. Passed to
          :func:`serve_listeners`.

      port (int): The port to listen on. Use 0 to let the kernel pick
          an open port. Ultimately passed to :func:`open_tcp_listeners`.

      ssl_context (~ssl.SSLContext): The SSL context to use for all incoming
          connections. Passed to :func:`open_ssl_over_tcp_listeners`.

      host (str, bytes, or None): The address to bind to; use ``None`` to bind
          to the wildcard address. Ultimately passed to
          :func:`open_tcp_listeners`.

      https_compatible (bool): Set this to True if you want to use
          "HTTPS-style" TLS. See :class:`~trio.SSLStream` for details.

      backlog (int or None): See :class:`~trio.SSLStream` for details.

      handler_nursery: The nursery to start handlers in, or None to use an
          internal nursery. Passed to :func:`serve_listeners`.

      task_status: This function can be used with ``nursery.start``.

    Returns:
      This function only returns when cancelled.

    r'   N)r7   r8   )r   r6   Úserve_listeners)	r9   r   r   r   r   r(   r7   r8   Ú	listenerss	            r$   Úserve_ssl_over_tcpr@   l   s�   è è € õx Ô6ØØØØ)Øðñ ô ð ð ð ð ð ð €Iõ Ô
ØØØ'Øð	ñ ô ð ð ð ð ð ð ð ð ð r&   )r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r)   r   r*   r   r   r(   r+   r   r,   )r9   r:   r   r   r   r)   r   r*   r   r   r(   r+   r7   r;   r8   r<   r   r   )Ú
__future__r   r   Útypingr   r   r   r   Ú_highlevel_open_tcp_streamr   r	   Úcollections.abcr
   r   Ú_highlevel_socketr   r%   r6   ÚTASK_STATUS_IGNOREDr@   © r&   r$   ú<module>rH      s2  ðØ "Ð "Ð "Ð "Ð "Ð "à 
€
€
€
Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3à €€€à 5Ð 5Ð 5Ð 5Ð 5Ð 5à€GˆC�L„L€àð 0Ø3Ð3Ð3Ð3Ð3Ð3Ð3Ð3à/Ð/Ð/Ð/Ð/Ð/ð  #Ø)-Ø)6ð2ð 2ð 2ð 2ð 2ð 2ðr  $Ø"Øðð ð ð ð ð ðB  $Ø"ØØ+/ð 	Ô ðHð Hð Hð Hð Hð Hð Hð Hr&   