[−][src]Trait roughenough::config::ServerConfig
Specifies parameters needed to configure a Roughenough server.
Parameters labeled "Required" must always be provided and have no default value while those labeled "Optional" provide sane default values that can be overridden.
YAML Key | Environment Variable | Necessity | Description |
---|---|---|---|
interface | ROUGHENOUGH_INTERFACE | Required | IP address or interface name for listening to client requests |
port | ROUGHENOUGH_PORT | Required | UDP port to listen for requests |
seed | ROUGHENOUGH_SEED | Required | A 32-byte hexadecimal value used to generate the server's long-term key pair. This is a secret value and must be un-guessable, treat it with care. (If compiled with KMS support, length will vary) |
batch_size | ROUGHENOUGH_BATCH_SIZE | Optional | The maximum number of requests to process in one batch. All nonces in a batch are used to build a Merkle tree, the root of which is signed. Default is 64 requests per batch. |
status_interval | ROUGHENOUGH_STATUS_INTERVAL | Optional | Number of seconds between each logged status update. Default is 600 seconds (10 minutes). |
health_check_port | ROUGHENOUGH_HEALTH_CHECK_PORT | Optional | If present, enable an HTTP health check responder on the provided port. Use with caution. |
kms_protection | ROUGHENOUGH_KMS_PROTECTION | Optional | If compiled with KMS support, the ID of the KMS key used to protect the long-term identity. |
client_stats | ROUGHENOUGH_CLIENT_STATS | Optional | A value of on or yes will enable tracking of per-client request statistics that will be output each time server status is logged. Default is off (disabled). |
fault_percentage | ROUGHENOUGH_FAULT_PERCENTAGE | Optional | Likelihood (as a percentage) that the server will intentionally return an invalid client response. An integer range from 0 (disabled, all responses valid) to 50 (50% of responses will be invalid). Default is 0 (disabled). |
Implementations of this trait obtain a valid configuration from different back-end sources. See:
- FileConfig - configure via a YAML file
- EnvironmentConfig - configure via environment variables
Required methods
fn interface(&self) -> &str
[Required] IP address or interface name to listen for client requests
fn port(&self) -> u16
[Required] UDP port to listen for requests
fn seed(&self) -> Vec<u8>
[Required] A 32-byte hexadecimal value used to generate the server's long-term key pair. This is a secret value and must be un-guessable, treat it with care.
fn batch_size(&self) -> u8
[Optional] The maximum number of requests to process in one batch. All nonces in a batch are used to build a Merkle tree, the root of which is signed. Defaults to DEFAULT_BATCH_SIZE
fn status_interval(&self) -> Duration
[Optional] Amount of time between each logged status update. Defaults to DEFAULT_STATUS_INTERVAL
fn kms_protection(&self) -> &KmsProtection
[Optional] Method used to protect the seed for the server's long-term key pair.
Defaults to "plaintext
" (no encryption, seed is in the clear).
fn health_check_port(&self) -> Option<u16>
[Optional] If present, the TCP port to respond to Google-style HTTP "legacy health check". This is a very simplistic check, it emits a fixed HTTP response to all TCP connections. https://cloud.google.com/load-balancing/docs/health-checks#legacy-health-checks
fn client_stats_enabled(&self) -> bool
[Optional] A value of on
or yes
will enable tracking of per-client request statistics
that will be output each time server status is logged. Default is off
(disabled).
fn fault_percentage(&self) -> u8
[Optional] Likelihood (as a percentage) that the server will intentionally return an
invalid client response. An integer range from 0
(disabled, all responses valid) to 50
(~50% of responses will be invalid). Default is 0
(disabled).
See the Roughtime spec for background and rationale.
Provided methods
fn udp_socket_addr(&self) -> Result<SocketAddr, Error>
Convenience function to create a SocketAddr
from the provided interface
and port