ó
    ¸®i‡  ã                  ó"  • S SK Jr  S SKrS SKJrJrJr  S SKrSSKJ	r	  \" S5      r
\(       a  S SKJrJr  SSKJr  S	S\	S
.           SS jjrSS	SS.           SS jjrSS	SS\R$                  S.                 SS jjrg)é    )ÚannotationsN)ÚTYPE_CHECKINGÚNoReturnÚTypeVaré   )ÚDEFAULT_DELAYÚT)Ú	AwaitableÚCallable)ÚSocketStreamF)Úhttps_compatibleÚssl_contextÚhappy_eyeballs_delayc             ƒ  ó  #   • [         R                  " U UUS9I Sh  v•N nUcN  [        R                  " 5       n[	        [        S5      (       a$  U=R
                  [        R                  ) -  sl        [         R                  " UUU US9$  Nl7f)a  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)ÚhostÚportr   r   r   Ú
tcp_streams         ÚHC:\des-py\RoboSAPF\venv\Lib\site-packages\trio/_highlevel_ssl_helpers.pyÚopen_ssl_over_tcp_streamr      s†   é € ôD ×+Ò+ØØØ1ñ÷ €Jð
 ÑÜ×0Ò0Ó2ˆä”3Ð2×3Ñ3Ø×Ò¤C×$@Ñ$@Ð#@Ñ@Õä�>Š>ØØØØ)ñ	ð ñùs   ‚BœB	�A-B©r   r   Úbacklogc          	   ƒ  ó    #   • [         R                  " XUS9I Sh  v•N nU Vs/ s H  n[         R                  " XaUS9PM     nnU$  N+s  snf 7f)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    N)r   )r   Úopen_tcp_listenersÚSSLListener)r   r   r   r   r    Útcp_listenersÚtcp_listenerÚssl_listenerss           r   Úopen_ssl_over_tcp_listenersr'   P   s_   é € ô( ×1Ò1°$È7ÑS×S€Mñ *óâ)ˆLô 	×Ò˜ÐEUÔVÙ)ð ð ð Ðñ Tùòùs    ‚A›AœA¤A	ÁAÁ	A)r   r   r    Úhandler_nurseryÚtask_statusc             ƒ  ó’   #   • [         R                  " UUUUUS9I Sh  v•N n[         R                  " U UUUS9I Sh  v•N   g N$ N7f)uÏ  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)r(   r)   )r   r'   Úserve_listeners)	Úhandlerr   r   r   r   r    r(   r)   Ú	listenerss	            r   Úserve_ssl_over_tcpr.   l   s\   é € ôx ×6Ò6ØØØØ)Øñ÷ €Iô ×
Ò
ØØØ'Øñ	÷ ñ ññùs   ‚AžAŸA½A¾AÁA)r   zstr | bytesr   Úintr   Úboolr   zssl.SSLContext | Noner   zfloat | NoneÚreturnztrio.SSLStream[SocketStream])r   r/   r   ússl.SSLContextr   ústr | bytes | Noner   r0   r    ú
int | Noner1   z$list[trio.SSLListener[SocketStream]])r,   z;Callable[[trio.SSLStream[SocketStream]], Awaitable[object]]r   r/   r   r2   r   r3   r   r0   r    r4   r(   ztrio.Nursery | Noner)   z5trio.TaskStatus[list[trio.SSLListener[SocketStream]]]r1   r   )Ú
__future__r   r   Útypingr   r   r   r   Ú_highlevel_open_tcp_streamr   r	   Úcollections.abcr
   r   Ú_highlevel_socketr   r   r'   ÚTASK_STATUS_IGNOREDr.   © ó    r   Ú<module>r=      s9  ðÝ "ã 
ß 3Ñ 3ã å 5áˆCƒL€æß3å/ð  #Ø)-Ø)6ñ2Ø
ð2à
ð2ð ð	2ð
 'ð2ð 'ð2ð "õ2ðr  $Ø"ØñØ
ðàðð ð	ð
 ðð ðð *õðB  $Ø"ØØ+/ð 	× Ñ ñHØHðHà
ðHð  ðHð
 ðHð ðHð ðHð )ðHððHð öHr<   