SealSkin

main

Server entry point: generates the Caddyfile, starts Caddy and uvicorn.

attributelogger
= logging.getLogger(__name__)
attributecaddy_processsubprocess.Popen | None
= None
attributeHTTP_SITE
= 'http://:{port} {{\n @stranger not remote_ip {networks}\n handle @stranger {{\n respond "This port serves the reverse proxies in SEALSKIN_TRUSTED_PROXIES alone, and {{remote_host}} is not one." 403\n }}\n @clear {{\n header X-Forwarded-Proto http\n header X-Forwarded-Proto ws\n }}\n handle @clear {{\n redir {public}{{uri}} 308\n }}\n @secure {{\n header X-Forwarded-Proto https\n header X-Forwarded-Proto wss\n }}\n handle @secure {{\n import entrance\n }}\n handle {{\n respond "The reverse proxy must send X-Forwarded-Proto: https with what it received over HTTPS." 403\n }}\n}}\n'
funchttp_listener() -> bool

Whether the plain HTTP listener is opened: http_port is set and a proxy is trusted to use it.

Returns

bool
funcadvertises_own_port() -> bool

Whether browsers reach the session port under its own number, with no reverse proxy before it.

Caddy offers HTTP/3 in an Alt-Svc header that names the port it listens on. Behind a reverse proxy or a remapped port that is another service's port, or nobody's, so HTTP/3 is left off there.

Returns

bool
funcrun_caddy() -> None

Render the Caddyfile template and start Caddy as a child process.

Returns

None
funcreload_caddy() -> None

Have the running Caddy read its configuration again, as when the peer trust bundle changed.

Returns

None
funcstop_caddy(signum=None, frame=None) -> None

Stop the Caddy process group if it is still running.

paramsignumint | None
= None

Signal number when invoked as a signal handler.

paramframeAny
= None

Current stack frame (unused).

Returns

None
func_serve() -> None

Start Caddy and the API server, waiting until shutdown.

Returns

None
funcmain() -> None

Synchronous entry point: install uvloop, install signal handlers, run.

Returns

None