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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2024 Praxis Contributors
//! Protocol adapters for Praxis.
//!
//! `praxis-protocol` sits below `server` and above `filter` in the
//! crate dependency flow `server -> protocol -> filter -> core -> tls`.
//! It binds the [`praxis_filter`] pipeline engine to the network backend's
//! HTTP and TCP services, so that inbound connections are served, filters
//! run at the right lifecycle points, and requests are forwarded to
//! upstream clusters.
//!
//! Responsibilities:
//! - HTTP protocol implementations and the backend adapters ([`http`]).
//! - Raw TCP/L4 forwarding ([`tcp`]).
//! - Active health-check probes and admin/observability endpoints.
//! - TLS listener setup (the `tls_setup` module), plus holding the certificate hot-reload watcher shutdown handles so
//! those watchers can be stopped early ([`CertWatcherShutdowns`]).
//! - The build's selected backend behind [`backend`]: its protocol adapters and admin-surface registration.
//!
//! Boundary with the backend (Pingora today): the backend owns
//! request-smuggling prevention, HTTP/2 backpressure, connection-pool
//! safety, and HTTP/1.1 upgrade detection with bidirectional forwarding
//! (WebSocket and similar). Praxis code in this crate and in
//! [`praxis_filter`] owns hop-by-hop header stripping (with conditional
//! preservation for upgrade requests), Host validation, `X-Forwarded-*`
//! injection, and retry logic. See `docs/developing/adding-backends.md`
//! for what a backend provides.
pub use CertWatcherShutdowns;
pub use ListenerPipelines;
pub use Protocol;
/// Process-wide connection limit.
/// HTTP protocol implementations.
/// Raw TCP/L4 forwarding protocol.
/// Shared TLS settings builder for HTTP and TCP listeners.
// -----------------------------------------------------------------------------
// Backend Selection
// -----------------------------------------------------------------------------
/// The protocol adapters and admin surface of the build's network backend.
///
/// Together with [`praxis_core::backend`], this is every name the server
/// bootstrap and the test harness need from a backend: `Http` and `Tcp`
/// implement [`Protocol`] and bind listeners onto the runtime, and
/// [`admin`] registers the management, health and metrics listeners. Under
/// the `pingora` feature they resolve to the Pingora adapters. A build with
/// no backend feature has none of them, so nothing can bind a listener; see
/// `docs/developing/adding-backends.md` for what a new backend supplies.
///
/// [`admin`]: crate::backend::admin
/// [`praxis_core::backend`]: praxis_core::backend
/// [`Protocol`]: crate::Protocol