zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
U
Z±d˜ã@s\ddlZddlZddlmZddedœdd„Zddddœd    d
„Zddddejd œd d „ZdS)éNé)Ú DEFAULT_DELAYF)Úhttps_compatibleÚ ssl_contextÚhappy_eyeballs_delaycÃsTtj|||dIdH}|dkrBt ¡}ttdƒrB|jtjM_tj||||dS)aTMake 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.
 
    )rNÚOP_IGNORE_UNEXPECTED_EOF)Úserver_hostnamer)ÚtrioZopen_tcp_streamÚsslÚcreate_default_contextÚhasattrÚoptionsrZ    SSLStream)ÚhostÚportrrrZ
tcp_stream©rúRd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\trio/_highlevel_ssl_helpers.pyÚopen_ssl_over_tcp_streams"ÿ 
ÿr©rrÚbacklogcƒs.tj|||dIdH}‡‡fdd„|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.
 
    )rrNcsg|]}tj|ˆˆd‘qS))r)r    Z SSLListener)Ú.0Z tcp_listener©rrrrÚ
<listcomp>Psÿz/open_ssl_over_tcp_listeners.<locals>.<listcomp>)r    Zopen_tcp_listeners)rrrrrZ tcp_listenersZ ssl_listenersrrrÚopen_ssl_over_tcp_listeners@s
 þr)rrrÚhandler_nurseryÚ task_statusc    Ãs6tj|||||dIdH}tj||||dIdHdS)uOListen 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.
 
    rN)rr)r    rZserve_listeners)    ÚhandlerrrrrrrrZ    listenersrrrÚserve_ssl_over_tcpWs:û ÿr)r    r
Z_highlevel_open_tcp_streamrrrZTASK_STATUS_IGNOREDrrrrrÚ<module>s  ú 1ÿ ÷