Skip to main content

Module config

Module config 

Source
Expand description

Configuration file loading and validation.

The configuration is TOML. Unknown keys are rejected so typos surface at startup instead of being silently ignored:

[server]
listen = "0.0.0.0:443"
cert   = "/etc/volto/fullchain.pem"
key    = "/etc/volto/privkey.pem"
alpn   = ["h3"]      # optional, this is the default
shutdown_grace = 5   # seconds to let tunnels finish after SIGTERM, 0..3600

[auth]
users = [{ username = "user1", password = "..." }]

[limits]
udp_session_timeout  = 180   # seconds
max_targets_per_conn = 256
max_connections      = 256
connect_timeout      = 10    # seconds, 0 disables the budget
ip_family_preference = "ipv4" # ipv4 | ipv6 | system
max_streams_bidi     = 1024  # 1..65536
max_idle_timeout     = 60    # seconds
keep_alive_interval  = 20    # seconds, must be < max_idle_timeout / 2
initial_mtu          = 1200  # bytes, 1200..1452
mtu_discovery        = true
mtu_upper_bound      = 1452  # bytes, initial_mtu..1472
congestion_control   = "bbr" # bbr | cubic | newreno
initial_rtt_ms       = 333   # milliseconds, 10..10000
socket_recv_buffer   = 2097152 # bytes, 0 keeps the OS default
socket_send_buffer   = 2097152 # bytes, 0 keeps the OS default

[security]
allow_private_networks   = false
denied_ports             = [25]
unanswered_packet_budget = 64
max_auth_failures        = 5
expected_sni             = []   # non-empty turns the SNI gate on

[log]
level  = "info"      # optional, this is the default
keylog = false       # write TLS secrets to $SSLKEYLOGFILE (debug only)

Every section except [server] is optional, and every key within them has a default, so a minimal file is four lines. Two consequences of that are worth stating explicitly, because they are the difference between a safe and an unsafe deployment:

  • an absent or empty [auth].users disables authentication, and
  • [security] defaults deny private address space but nothing else.

Config::warnings reports the first of those at startup.

Rejecting unknown keys also makes a configuration file forward-only: one written for this version does not load on a release that predates any key in it, so the file has to be edited before a rollback rather than after the service fails to start. docs/configuration.md carries the operator’s half of that (which key arrived in which release, and why the policy stays).

Structs§

Auth
[auth] — the accepted credentials.
Config
The complete server configuration.
Limits
[limits] — resource and lifetime limits.
Log
[log] — logging settings.
Security
[security] — destination policy and abuse mitigations.
Server
[server] — the QUIC listener and its TLS identity.
User
One set of HTTP Basic credentials.

Enums§

CongestionControl
QUIC congestion controller, selected by [limits].congestion_control.
IpFamilyPreference
Which address family a target name is tried on first, selected by [limits].ip_family_preference.

Constants§

DEFAULT_ALPN
ALPN protocol identifiers advertised when the config does not say otherwise.
DEFAULT_CONNECT_TIMEOUT
Default budget for reaching a target, in seconds.
DEFAULT_DENIED_PORTS
Ports no target may be reached on unless the operator says otherwise.
DEFAULT_INITIAL_MTU
Default initial QUIC packet size, in bytes.
DEFAULT_INITIAL_RTT_MS
Default round-trip time assumed before the first measurement, in milliseconds.
DEFAULT_KEEP_ALIVE_INTERVAL
Default keep-alive interval, in seconds.
DEFAULT_LOG_LEVEL
Log level used when [log].level is absent.
DEFAULT_MAX_AUTH_FAILURES
Default number of authentication failures tolerated on one connection.
DEFAULT_MAX_CONNECTIONS
Default cap on simultaneously open QUIC connections.
DEFAULT_MAX_IDLE_TIMEOUT
Default QUIC idle timeout, in seconds.
DEFAULT_MAX_STREAMS_BIDI
Default concurrent client-initiated bidirectional streams per connection.
DEFAULT_MAX_TARGETS_PER_CONN
Default number of concurrent tunnels allowed on one QUIC connection.
DEFAULT_MTU_UPPER_BOUND
Default ceiling for path MTU discovery, in bytes.
DEFAULT_SHUTDOWN_GRACE
Default grace period for a graceful shutdown, in seconds.
DEFAULT_SOCKET_RECV_BUFFER
Default UDP socket receive buffer to request, in bytes.
DEFAULT_SOCKET_SEND_BUFFER
Default UDP socket send buffer to request, in bytes.
DEFAULT_UDP_SESSION_TIMEOUT
Default UDP session idle timeout, in seconds.
DEFAULT_UNANSWERED_PACKET_BUDGET
Default number of packets a UDP session may send before the target answers.
EXAMPLE_PLACEHOLDER_PASSWORD
The password script/config.example.toml ships, which no running server may keep.
MAX_EXPECTED_SNI
The longest host name a server_name extension can carry, in bytes.
MAX_INITIAL_MTU
The largest initial_mtu this server accepts, in bytes.
MAX_MTU_UPPER_BOUND
The largest mtu_upper_bound this server accepts, in bytes.
MIN_INITIAL_MTU
The smallest initial_mtu QUIC permits (RFC 9000 §14).