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
108
109
110
111
112
113
114
115
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2024 Praxis Contributors
//! Core configuration, error types, and server factory for Praxis.
//!
//! `praxis-core` is the leaf of the crate dependency flow
//! `server -> protocol -> filter -> core -> tls`: it depends only on
//! [`praxis_tls`] and is depended on by every other Praxis crate. It
//! exists to give the filter, protocol, and server layers a single
//! source of truth for what a valid proxy looks like, so a parsed
//! configuration can be treated as already well-formed downstream.
//!
//! Responsibilities:
//! - YAML configuration parsing and validation with serde ([`config`]).
//! - Error types shared across the workspace ([`errors`], re-exported as [`ProxyError`]).
//! - Health state for active health checking ([`health`]) and the key-value store trait and registry ([`kv`]).
//! - The network backend contract ([`server::ServerRuntime`], [`egress`]) with the build's selected backend behind
//! [`backend`], the runtime options ([`RuntimeOptions`]) and tracing setup ([`TracingGuard`], [`logging`]).
//!
//! Configuration types validate at load time, upholding the invariant
//! that higher layers never re-check structural validity of a [`config`]
//! value they receive.
/// Circuit breaker state machine for sub-request fault isolation.
/// YAML configuration parsing and validation.
/// Upstream connection options and endpoint types.
/// Backend-neutral egress: peers, connectors, and sessions.
/// Error types shared across the workspace.
/// Process-wide file descriptor pressure monitoring.
/// Shared gRPC protocol utilities.
/// Shared health state types for active health checking.
/// Hedge-copy admission budget and the per-request race.
/// Per-instance request ID generation.
/// Key-value store trait and registry.
/// Tracing subscriber setup.
/// Process-wide memory pressure monitoring.
/// Hop-by-hop and reserved-header stripping for the next HTTP hop.
/// Reserved internal header prefixes for proxy-internal metadata.
/// Shared retry budget and per-cluster active-request tracking.
/// Server factory and runtime options.
/// Shared HTTP connector for sub-request execution.
/// Wall-clock time abstraction for filters.
/// W3C trace-context extraction and injection when the `otel` feature is enabled.
/// Shared W3C `tracestate` validation and normalization.
pub use ProxyError;
pub use TracingGuard;
pub use PingoraServerRuntime;
pub use ;
// -----------------------------------------------------------------------------
// Backend Selection
// -----------------------------------------------------------------------------
/// The network backend this build runs on.
///
/// Exactly one backend is selected at build time with a Cargo feature, and
/// these names resolve to its types: `Runtime` implements [`ServerRuntime`]
/// and `Connector` implements [`egress::Connector`]. Under the `pingora`
/// feature both are the Pingora implementations. Without a backend feature
/// the library still compiles: `Connector` refuses every connection and
/// `Runtime` has nothing to serve, and the `praxis-proxy` binary refuses to
/// build. Adding a backend means adding its feature here; see
/// `docs/developing/adding-backends.md`.
///
/// ```
/// use praxis_core::{backend, egress::Connector as _};
/// praxis_tls::provider::install(); // required before any connector is built
///
/// let connector = backend::Connector::new(16);
/// let _shared = connector.clone();
/// ```
///
/// [`ServerRuntime`]: crate::server::ServerRuntime
/// [`egress::Connector`]: crate::egress::Connector