Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 44 fields pub config_path: String, pub command_socket: String, pub command_buffer_size: u64, pub max_command_buffer_size: u64, pub max_connections: usize, pub min_buffers: u64, pub max_buffers: u64, pub buffer_size: u64, pub saved_state: Option<String>, pub automatic_state_save: bool, pub log_level: String, pub log_target: String, pub log_colored: bool, pub audit_logs_target: Option<String>, pub audit_logs_json_target: Option<String>, pub access_logs_target: Option<String>, pub access_logs_format: Option<AccessLogFormat>, pub access_logs_colored: Option<bool>, pub worker_count: u16, pub worker_automatic_restart: bool, pub metrics: Option<MetricsConfig>, pub disable_cluster_metrics: bool, pub http_listeners: Vec<HttpListenerConfig>, pub https_listeners: Vec<HttpsListenerConfig>, pub tcp_listeners: Vec<TcpListenerConfig>, pub clusters: HashMap<String, ClusterConfig>, pub handle_process_affinity: bool, pub ctl_command_timeout: u64, pub pid_file_path: Option<String>, pub activate_listeners: bool, pub front_timeout: u32, pub back_timeout: u32, pub connect_timeout: u32, pub zombie_check_interval: u32, pub accept_queue_timeout: u32, pub evict_on_queue_full: bool, pub request_timeout: u32, pub worker_timeout: u32, pub slab_entries_per_connection: Option<u64>, pub command_allowed_uids: Option<Vec<u32>>, pub basic_auth_max_credential_bytes: Option<u64>, pub max_connections_per_ip: u64, pub retry_after: u32, pub splice_pipe_capacity_bytes: Option<u64>,
}
Expand description

Sōzu configuration, populated with clusters and listeners.

This struct is used on startup to generate WorkerRequests

Fields§

§config_path: String§command_socket: String§command_buffer_size: u64§max_command_buffer_size: u64§max_connections: usize§min_buffers: u64§max_buffers: u64§buffer_size: u64§saved_state: Option<String>§automatic_state_save: bool§log_level: String§log_target: String§log_colored: bool§audit_logs_target: Option<String>

Optional dedicated file path for the control-plane audit log. See FileConfig::audit_logs_target for rationale.

§audit_logs_json_target: Option<String>

Optional JSON mirror of the audit log; see FileConfig::audit_logs_json_target.

§access_logs_target: Option<String>§access_logs_format: Option<AccessLogFormat>§access_logs_colored: Option<bool>§worker_count: u16§worker_automatic_restart: bool§metrics: Option<MetricsConfig>§disable_cluster_metrics: bool§http_listeners: Vec<HttpListenerConfig>§https_listeners: Vec<HttpsListenerConfig>§tcp_listeners: Vec<TcpListenerConfig>§clusters: HashMap<String, ClusterConfig>§handle_process_affinity: bool§ctl_command_timeout: u64§pid_file_path: Option<String>§activate_listeners: bool§front_timeout: u32§back_timeout: u32§connect_timeout: u32§zombie_check_interval: u32§accept_queue_timeout: u32§evict_on_queue_full: bool§request_timeout: u32§worker_timeout: u32§slab_entries_per_connection: Option<u64>

Slab-entries-per-connection multiplier exposed for operators with fan-out topologies that exceed the default 4 backends per session. None means the default (4) applies; set values are clamped to [ServerConfig::MIN_SLAB_ENTRIES_PER_CONNECTION, ServerConfig::MAX_SLAB_ENTRIES_PER_CONNECTION] = [2, 32]. Slab capacity is 10 + slab_entries_per_connection * max_connections.

§command_allowed_uids: Option<Vec<u32>>

Optional allowlist of UIDs permitted to invoke command-socket requests. None keeps the historical “any same-UID local process” behaviour. When Some, every request whose SO_PEERCRED UID is not in the list is rejected before reaching dispatch.

§basic_auth_max_credential_bytes: Option<u64>

Maximum length, in bytes, of a base64-decoded Authorization: Basic payload accepted by mux::auth. None keeps the compile-time default of 4096. Set once on each worker at boot via ServerConfig::basic_auth_max_credential_bytes.

§max_connections_per_ip: u64

Default per-(cluster, source-IP) connection limit. 0 means unlimited. Each cluster may override via its own max_connections_per_ip. Source IP attribution honours the proxy-protocol header when present.

§retry_after: u32

Default Retry-After header value (seconds) emitted on HTTP 429 responses. 0 omits the header.

§splice_pipe_capacity_bytes: Option<u64>

Requested kernel-pipe capacity, in bytes, for each splice(2) zero-copy direction. None keeps the kernel default of 64 KiB. Applied via fcntl(F_SETPIPE_SZ) per pipe at SplicePipe::new; the kernel rounds up to a page boundary and clamps at /proc/sys/fs/pipe-max-size. Linux-only; ignored on builds without the splice feature.

Implementations§

Source§

impl Config

Source

pub fn load_from_path(path: &str) -> Result<Config, ConfigError>

Parse a TOML file and build a config out of it

Source

pub fn generate_config_messages( &self, ) -> Result<Vec<WorkerRequest>, ConfigError>

yields requests intended to recreate a proxy that match the config

Source

pub fn command_socket_path(&self) -> Result<String, ConfigError>

Get the path of the UNIX socket used to communicate with Sōzu

Source

pub fn load_file(path: &str) -> Result<String, ConfigError>

read any file to a string

Source

pub fn load_file_bytes(path: &str) -> Result<Vec<u8>, ConfigError>

read any file to bytes

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

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 Config

Source§

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

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

impl Default for Config

Source§

fn default() -> Config

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

impl<'de> Deserialize<'de> for Config

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 From<&Config> for ServerConfig

reduce the config to the bare minimum needed by a worker

Source§

fn from(config: &Config) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Config

Source§

fn eq(&self, other: &Config) -> 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 Serialize for Config

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 Config

Source§

impl StructuralPartialEq for Config

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> 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>,