Skip to main content

FileClusterConfig

Struct FileClusterConfig 

Source
pub struct FileClusterConfig {
Show 25 fields pub frontends: Vec<FileClusterFrontendConfig>, pub backends: Vec<FileBackendConfig>, pub protocol: FileClusterProtocolConfig, pub sticky_session: Option<bool>, pub https_redirect: Option<bool>, pub send_proxy: Option<bool>, pub load_balancing: LoadBalancingAlgorithms, pub answer_503: Option<String>, pub load_metric: Option<LoadMetric>, pub http2: Option<bool>, pub answers: Option<BTreeMap<String, String>>, pub https_redirect_port: Option<u32>, pub authorized_hashes: Option<Vec<String>>, pub www_authenticate: Option<String>, pub max_connections_per_ip: Option<u64>, pub max_connections_per_subnet: Option<u64>, pub retry_after: Option<u32>, pub health_check: Option<FileHealthCheckConfig>, pub udp: Option<FileUdpClusterConfig>, pub affinity_header: Option<String>, pub affinity_cookie: Option<String>, pub shard_percent: Option<u32>, pub shard_min_backends: Option<u32>, pub shard_mode: Option<ShardMode>, pub max_connection_attempts: Option<u32>,
}

Fields§

§frontends: Vec<FileClusterFrontendConfig>§backends: Vec<FileBackendConfig>§protocol: FileClusterProtocolConfig§sticky_session: Option<bool>§https_redirect: Option<bool>§send_proxy: Option<bool>§load_balancing: LoadBalancingAlgorithms§answer_503: Option<String>§load_metric: Option<LoadMetric>§http2: Option<bool>

Backend-capability hint: true when the backend speaks HTTP/2 (h2c or h2+TLS once #1218 lands). Does NOT gate H2 at the frontend — frontend H2 is ALPN-negotiated independently (see alpn_protocols).

§answers: Option<BTreeMap<String, String>>

Per-cluster HTTP answer template overrides keyed by HTTP status code (e.g. "503"). Each value is either a filesystem path or an inline:<body> literal — see resolve_answer_source. Loaded into Cluster::answers at build time via load_answers.

Layering: an entry here overrides the listener-level [listeners.<id>.answers] default for the matching status on requests routed to this cluster. The listener-level map is the global default; the cluster-level map is the per-cluster override.

§https_redirect_port: Option<u32>

Optional explicit port to use when building the Location header for an https_redirect. When unset, the listener’s effective HTTPS port is used. Lets operators front a non-standard HTTPS port (e.g. 8443) on the redirect target while keeping https_redirect = true.

§authorized_hashes: Option<Vec<String>>

Authorized credentials for HTTP basic authentication, formatted as username:hex(sha256(password)) (lower-case hex). Empty list disables auth even when a frontend sets required_auth = true — such requests are rejected with 401.

§www_authenticate: Option<String>

Realm string emitted in WWW-Authenticate: Basic realm="…" when an unauthenticated request is rejected. Treated as an opaque value (no template substitution).

§max_connections_per_ip: Option<u64>

Override the global per-(cluster, source-IP) connection limit for this cluster. None (field absent) inherits the global default max_connections_per_ip. Some(0) is explicit “unlimited for this cluster”. Some(n > 0) overrides with the cluster-specific limit. The source IP is taken from the parsed proxy-protocol header when present, else peer_addr. On a UDP cluster it limits concurrent flows per datagram source address; UDP never inherits the global default.

§max_connections_per_subnet: Option<u64>

Override the global per-(cluster, source-SUBNET) connection limit for this cluster. Same three-state semantics as FileClusterConfig::max_connections_per_ip: None inherits, Some(0) is explicit unlimited, Some(n > 0) overrides. This is an independent counter — a connection must satisfy BOTH caps. The mask itself is global and boot-time only (subnet_ipv4_prefix / subnet_ipv6_prefix), not overridable per cluster.

§retry_after: Option<u32>

Override the global Retry-After header value (seconds) emitted on HTTP 429 responses for this cluster. None inherits the global default. Some(0) omits the header. TCP clusters carry this field for shape uniformity but never emit the header (no HTTP envelope).

§health_check: Option<FileHealthCheckConfig>

Optional HTTP health-check configuration. The probe wire format follows cluster.http2: HTTP/1.1 when false, HTTP/2 prior-knowledge (h2c) when true.

§udp: Option<FileUdpClusterConfig>

Optional UDP-specific cluster configuration, parsed from a [clusters.<id>.udp] block. Additive: clusters without a udp block produce udp: None on the resulting Cluster.

§affinity_header: Option<String>

Key an HTTP/HTTPS cluster’s HRW/MAGLEV selection on the value of this request header instead of the client’s source IP. A request without the header falls back to its source IP. Mutually exclusive with affinity_cookie; refused on a TCP cluster, which has no request headers and always keys on the source IP.

§affinity_cookie: Option<String>

Same as affinity_header, on the value of this request cookie.

§shard_percent: Option<u32>

Shuffle sharding: restrict each client to a shard of max(2, ceil(shard_percent × N / 100)) of the cluster’s N primary backends, the top of the rendezvous ranking of its affinity key. Off when unset. See validate_shuffle_sharding.

§shard_min_backends: Option<u32>

Sharding applies only from this many primary backends; defaults to DEFAULT_SHARD_MIN_BACKENDS.

§shard_mode: Option<ShardMode>

FALLBACK (default) spills an exhausted shard over to the rest of the cluster; STRICT refuses.

§max_connection_attempts: Option<u32>

Override the global max_connection_attempts for this cluster: how many backend connections a request may try, the first included, before it is answered 503 (HTTP) or closed (TCP). None inherits the global value. See validate_max_connection_attempts.

Implementations§

Source§

impl FileClusterConfig

Source

pub fn to_cluster_config( self, cluster_id: &str, expect_proxy: &HashSet<SocketAddr>, ) -> Result<ClusterConfig, ConfigError>

Source

pub fn to_cluster_config_with( self, cluster_id: &str, expect_proxy: &HashSet<SocketAddr>, resolver: Option<&BackendResolver<'_>>, ) -> Result<ClusterConfig, ConfigError>

FileClusterConfig::to_cluster_config with the backend resolver chosen by the caller. None leaves every host:port entry out and keeps only socket-address literals: a control command reads the configuration for its scalar settings and must not depend on DNS.

Trait Implementations§

Source§

impl Clone for FileClusterConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileClusterConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FileClusterConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for FileClusterConfig

Source§

impl Hash for FileClusterConfig

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FileClusterConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for FileClusterConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FileClusterConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.