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].usersdisables 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§
- Congestion
Control - QUIC congestion controller, selected by
[limits].congestion_control. - IpFamily
Preference - 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].levelis 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.tomlships, which no running server may keep. - MAX_
EXPECTED_ SNI - The longest host name a
server_nameextension can carry, in bytes. - MAX_
INITIAL_ MTU - The largest
initial_mtuthis server accepts, in bytes. - MAX_
MTU_ UPPER_ BOUND - The largest
mtu_upper_boundthis server accepts, in bytes. - MIN_
INITIAL_ MTU - The smallest
initial_mtuQUIC permits (RFC 9000 §14).