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: u64Default 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: u32Default 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
impl Config
Sourcepub fn load_from_path(path: &str) -> Result<Config, ConfigError>
pub fn load_from_path(path: &str) -> Result<Config, ConfigError>
Parse a TOML file and build a config out of it
Sourcepub fn generate_config_messages(
&self,
) -> Result<Vec<WorkerRequest>, ConfigError>
pub fn generate_config_messages( &self, ) -> Result<Vec<WorkerRequest>, ConfigError>
yields requests intended to recreate a proxy that match the config
Sourcepub fn command_socket_path(&self) -> Result<String, ConfigError>
pub fn command_socket_path(&self) -> Result<String, ConfigError>
Get the path of the UNIX socket used to communicate with Sōzu
Sourcepub fn load_file_bytes(path: &str) -> Result<Vec<u8>, ConfigError>
pub fn load_file_bytes(path: &str) -> Result<Vec<u8>, ConfigError>
read any file to bytes
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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>,
Source§impl From<&Config> for ServerConfig
reduce the config to the bare minimum needed by a worker
impl From<&Config> for ServerConfig
reduce the config to the bare minimum needed by a worker
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.