pub struct Config {
pub WGPROXY_SERVER: String,
pub WGPROXY_PUBKEY: [u8; 32],
pub WGPROXY_LISTEN: SocketAddr,
pub WGPROXY_TIMEOUT: Duration,
pub WGPROXY_LOGLEVEL: u8,
}Expand description
The server config
Fields§
§WGPROXY_SERVER: String§WGPROXY_PUBKEY: [u8; 32]The server public key for handshake validation
§Note
The public key is used for handshake verfication and quick rejection when a new proxy connection is created. This is a security feature to ensure that the relay will not forward arbitrary rogue packets. If the handshake does not match the configured public key, the packet will be dropped.
WGPROXY_LISTEN: SocketAddrThe address to listen on and to use for relaying
§Example
An inclusive range of ports, defaults to Self::WGPROXY_LISTEN_DEFAULT
WGPROXY_TIMEOUT: DurationThe timeout duration for NAT mappings to expire
§Example
A duration in seconds, defaults to Self::WGPROXY_TIMEOUT_DEFAULT
WGPROXY_LOGLEVEL: u8The log level
§Possible Values
Possible values are:
0: Logs errors only1: Logs warnings and errors2: Logs informational messages, warnings, and errors3: Logs debug and informational messages, warnings, and errors
§Example
A positive integer value, defaults to Self::WGPROXY_LOGLEVEL_DEFAULT
Implementations§
Source§impl Config
impl Config
Sourcepub const WGPROXY_LISTEN_DEFAULT: &str = "[::]:51820"
pub const WGPROXY_LISTEN_DEFAULT: &str = "[::]:51820"
The default listening address if Self::WGPROXY_LISTEN is not specified
Sourcepub const WGPROXY_TIMEOUT_DEFAULT: &str = "60"
pub const WGPROXY_TIMEOUT_DEFAULT: &str = "60"
The default timeout in seconds if Self::WGPROXY_TIMEOUT is not specified
Sourcepub const WGPROXY_LOGLEVEL_DEFAULT: &str = "1"
pub const WGPROXY_LOGLEVEL_DEFAULT: &str = "1"
The default loglevel if Self::WGPROXY_LOGLEVEL is not specified
Sourcepub fn wgproxy_loglevel() -> Result<u8, Error>
pub fn wgproxy_loglevel() -> Result<u8, Error>
Parses the WGPROXY_LOGLEVEL environment variable, or falls back to Self::WGPROXY_LOGLEVEL_DEFAULT