Skip to main content

Cluster

Struct Cluster 

Source
pub struct Cluster {
Show 15 fields pub cluster_id: String, pub sticky_session: bool, pub https_redirect: bool, pub proxy_protocol: Option<i32>, pub load_balancing: i32, pub answer_503: Option<String>, pub load_metric: Option<i32>, pub http2: Option<bool>, pub answers: BTreeMap<String, String>, pub https_redirect_port: Option<u32>, pub authorized_hashes: Vec<String>, pub www_authenticate: Option<String>, pub max_connections_per_ip: Option<u64>, pub retry_after: Option<u32>, pub health_check: Option<HealthCheckConfig>,
}
Expand description

A cluster is what binds a frontend to backends with routing rules

Fields§

§cluster_id: String§sticky_session: bool

wether a connection from a client shall be always redirected to the same backend

§https_redirect: bool§proxy_protocol: Option<i32>§load_balancing: i32§answer_503: Option<String>§load_metric: Option<i32>§http2: Option<bool>

Backend-capability hint: set to true when THE BACKEND speaks HTTP/2 (h2c or h2+TLS). This does NOT gate H2 acceptance at the frontend — frontend H2 is negotiated via TLS ALPN independently of per-cluster configuration (see alpn_protocols on the listener).

§answers: BTreeMap<String, String>

Per-cluster HTTP answer template overrides keyed by HTTP status code (e.g. “503”). Override a listener-level answer for this cluster only.

§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: Vec<String>

Authorized credentials for HTTP basic authentication. Each entry is formatted as username:hex(sha256(password)) (lower-case hex). The mux compares the supplied Authorization: Basic header in constant-time against the full list. Empty list disables auth even when a frontend sets required_auth = true — those requests are rejected with a 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). Defaults to a generic realm if unset.

§max_connections_per_ip: Option<u64>

Per-cluster override for the global max_connections_per_ip. None (field absent) inherits the global default. Some(0) is explicit “unlimited for this cluster”. Some(n > 0) overrides with the cluster-specific limit. Counts are kept per (cluster_id, source_ip) pair, so two clusters never share a counter even from the same IP.

§retry_after: Option<u32>

Per-cluster override for the global retry_after header value (seconds, HTTP 429 only). None inherits the global default. Some(0) omits the header.

§health_check: Option<HealthCheckConfig>

Optional HTTP health check configuration for backends in this cluster. Tag 8 in this message is the http2 backend-capability hint and tags 9-14 cover answers/redirect/auth/limits, so health-check configuration occupies tag 15.

Implementations§

Source§

impl Cluster

Source

pub fn proxy_protocol(&self) -> ProxyProtocolConfig

Returns the enum value of proxy_protocol, or the default if the field is unset or set to an invalid enum value.

Source

pub fn set_proxy_protocol(&mut self, value: ProxyProtocolConfig)

Sets proxy_protocol to the provided enum value.

Source

pub fn load_balancing(&self) -> LoadBalancingAlgorithms

Returns the enum value of load_balancing, or the default if the field is set to an invalid enum value.

Source

pub fn set_load_balancing(&mut self, value: LoadBalancingAlgorithms)

Sets load_balancing to the provided enum value.

Source

pub fn answer_503(&self) -> &str

Returns the value of answer_503, or the default value if answer_503 is unset.

Source

pub fn load_metric(&self) -> LoadMetric

Returns the enum value of load_metric, or the default if the field is unset or set to an invalid enum value.

Source

pub fn set_load_metric(&mut self, value: LoadMetric)

Sets load_metric to the provided enum value.

Source

pub fn http2(&self) -> bool

Returns the value of http2, or the default value if http2 is unset.

Source

pub fn https_redirect_port(&self) -> u32

Returns the value of https_redirect_port, or the default value if https_redirect_port is unset.

Source

pub fn www_authenticate(&self) -> &str

Returns the value of www_authenticate, or the default value if www_authenticate is unset.

Source

pub fn max_connections_per_ip(&self) -> u64

Returns the value of max_connections_per_ip, or the default value if max_connections_per_ip is unset.

Source

pub fn retry_after(&self) -> u32

Returns the value of retry_after, or the default value if retry_after is unset.

Trait Implementations§

Source§

impl Clone for Cluster

Source§

fn clone(&self) -> Cluster

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 Cluster

Source§

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

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

impl Default for Cluster

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Cluster

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 Hash for Cluster

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 Message for Cluster

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl Ord for Cluster

Source§

fn cmp(&self, other: &Cluster) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Cluster

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Cluster

Source§

fn partial_cmp(&self, other: &Cluster) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Cluster

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 Eq for Cluster

Source§

impl StructuralPartialEq for Cluster

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
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> Reset for T
where T: Default + Clone,

Source§

fn reset(&mut self)

Source§

impl<T> Reset for T
where T: Default + Clone,

Source§

fn reset(&mut self)

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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