#[non_exhaustive]pub struct PingoraConfig {Show 16 fields
pub enabled: bool,
pub bind: String,
pub fallback: Fallback,
pub trusted_proxies: Vec<String>,
pub connect_timeout_ms: u64,
pub read_timeout_ms: u64,
pub write_timeout_ms: u64,
pub max_retries: usize,
pub health_check_interval_ms: u64,
pub health_check_timeout_ms: u64,
pub max_request_body_bytes: u64,
pub max_connections: usize,
pub max_connections_per_ip: usize,
pub shutdown_grace_ms: u64,
pub metrics: bool,
pub routes: Vec<Route>,
}Expand description
Settings for the proxy.
For a setting that says “0: off”, the value 0 removes that limit.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.enabled: boolStart the proxy. Default: true.
bind: StringListen address, IP:port. Port 0 picks a free port. Empty: the
profile decides. dev and test use 127.0.0.1:8080. Other
profiles use 0.0.0.0:8080. Default: empty.
fallback: FallbackWhere unmatched requests go: app (the Autumn app) or none
(404). Default: app.
trusted_proxies: Vec<String>Peers (IPs or CIDR ranges) whose X-Forwarded-* and other identity
headers the proxy keeps. For other peers, the proxy replaces them.
Put only your own load balancers here. Default: empty.
connect_timeout_ms: u64Upstream connect timeout. Must be more than 0. Default: 5000.
read_timeout_ms: u64Upstream read timeout. 0: off. Default: 60000.
write_timeout_ms: u64Upstream write timeout. 0: off. Default: 60000.
max_retries: usizeConnect retries on another upstream. Pingora also retries an
idempotent request once or twice when a pooled connection is stale.
Default: 1.
health_check_interval_ms: u64Upstream TCP health check interval. 0: off. Default: 5000.
health_check_timeout_ms: u64Health check connect timeout. Must be more than 0.
Default: 1000.
max_request_body_bytes: u64Largest request body. Bigger requests get 413. 0: off.
Default: 10485760 (10 MiB).
max_connections: usizeMaximum open client connections. At the limit, the proxy stops
accepting until a connection closes. 0: no limit. At most
1000000. Default: 10000.
max_connections_per_ip: usizeMaximum open connections from one client IP. The proxy closes
connections over the limit at once. Keep 0 behind a load balancer,
because all connections then have its IP. 0: no limit.
Default: 0.
shutdown_grace_ms: u64Time for open requests to finish at shutdown. Must be more than
0. The plugin caps it to fit server.shutdown_timeout_secs.
Default: 10000.
metrics: boolRecord pingora_proxy_* metrics. Default: true.
routes: Vec<Route>The routes. Env: AUTUMN_PINGORA__ROUTES replaces all routes with
a TOML array.
Implementations§
Source§impl PingoraConfig
impl PingoraConfig
Sourcepub fn bind_addr(&self, development: bool) -> Result<SocketAddr, ConfigError>
pub fn bind_addr(&self, development: bool) -> Result<SocketAddr, ConfigError>
The listen address. An empty bind gives 127.0.0.1:8080 in
development and 0.0.0.0:8080 in other profiles.
§Errors
Returns ConfigError when bind is not IP:port.
Sourcepub const fn connect_timeout(&self) -> Duration
pub const fn connect_timeout(&self) -> Duration
Upstream connect timeout.
Sourcepub const fn read_timeout(&self) -> Option<Duration>
pub const fn read_timeout(&self) -> Option<Duration>
Upstream read timeout.
Sourcepub const fn write_timeout(&self) -> Option<Duration>
pub const fn write_timeout(&self) -> Option<Duration>
Upstream write timeout.
Sourcepub const fn health_check_interval(&self) -> Option<Duration>
pub const fn health_check_interval(&self) -> Option<Duration>
Health check interval.
Sourcepub const fn health_check_timeout(&self) -> Duration
pub const fn health_check_timeout(&self) -> Duration
Health check connect timeout.
Sourcepub const fn shutdown_grace(&self) -> Duration
pub const fn shutdown_grace(&self) -> Duration
Shutdown grace period.
Sourcepub fn from_toml_str(text: &str, section: &str) -> Result<Self, ConfigError>
pub fn from_toml_str(text: &str, section: &str) -> Result<Self, ConfigError>
Parse [section] from a whole autumn.toml text. No profiles and
no environment.
§Errors
Returns ConfigError for bad TOML, unknown keys, wrong types or
values that validate rejects.
Sourcepub fn resolve(section: &str) -> Result<Resolved, ConfigError>
pub fn resolve(section: &str) -> Result<Resolved, ConfigError>
Resolve [section] from the app’s files and the process environment.
§Errors
Returns ConfigError when a file cannot be read or parsed, or when
the merged section is not valid.
Sourcepub fn resolve_with_env(
section: &str,
env: &dyn Env,
) -> Result<Resolved, ConfigError>
pub fn resolve_with_env( section: &str, env: &dyn Env, ) -> Result<Resolved, ConfigError>
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Trait Implementations§
Source§impl Clone for PingoraConfig
impl Clone for PingoraConfig
Source§impl Debug for PingoraConfig
impl Debug for PingoraConfig
Source§impl Default for PingoraConfig
impl Default for PingoraConfig
Source§impl<'de> Deserialize<'de> for PingoraConfigwhere
PingoraConfig: Default,
impl<'de> Deserialize<'de> for PingoraConfigwhere
PingoraConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for PingoraConfig
Source§impl PartialEq for PingoraConfig
impl PartialEq for PingoraConfig
Source§impl Serialize for PingoraConfig
impl Serialize for PingoraConfig
impl StructuralPartialEq for PingoraConfig
Auto Trait Implementations§
impl Forget for PingoraConfig
impl Freeze for PingoraConfig
impl RefUnwindSafe for PingoraConfig
impl Send for PingoraConfig
impl Sync for PingoraConfig
impl Unpin for PingoraConfig
impl UnsafeUnpin for PingoraConfig
impl UnwindSafe for PingoraConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> JsonSink for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Scoped for T
impl<T> Scoped for T
Source§fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.