Module

net.tls

TLS context creation for pounce.

Creates and configuresssl.SSLContext from ServerConfigfields. Uses stdlibsslwith secure defaults (TLSv1.2+, no compression, cipher order honoured). Optionally usestruststore(via pounce[tls]) for system certificate store integration.

ALPN protocols are advertised so HTTP/2 negotiation works when the h2 protocol handler is available.

Functions

create_tls_context 1 ssl.SSLContext
Build an ``ssl.SSLContext`` from server configuration.
def create_tls_context(config: ServerConfig) -> ssl.SSLContext
Parameters
Name Type Description
config ServerConfig

Server configuration withssl_certfile and ssl_keyfileset.

Returns
ssl.SSLContext
_build_alpn_protocols 0 list[str]
Return the ALPN protocol list based on available optional deps. If h2 is insta…
def _build_alpn_protocols() -> list[str]

Return the ALPN protocol list based on available optional deps.

If h2 is installed, advertiseh2first (preferred), then http/1.1 as fallback. Otherwise only http/1.1.

Returns
list[str]
is_tls_configured 1 bool
Return True if TLS is configured in the server config.
def is_tls_configured(config: ServerConfig) -> bool
Parameters
Name Type Description
config ServerConfig
Returns
bool