From: Ian Jackson Date: Sun, 25 Jul 2021 17:04:44 +0000 (+0100) Subject: move InstanceConfig to prominently at the top of config.rs X-Git-Tag: hippotat/1.0.0~451 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=7651942b7c3446aaf32ff367b2113aee61e4c77a;p=hippotat.git move InstanceConfig to prominently at the top of config.rs Signed-off-by: Ian Jackson --- diff --git a/src/config.rs b/src/config.rs index 30e2c12..79ff778 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,6 +6,42 @@ use crate::prelude::*; use configparser::ini::Ini; +#[derive(hippotat_macros::ResolveConfig)] +#[derive(Debug,Clone)] +pub struct InstanceConfig { + // Exceptional settings + #[special(special_server, SKL::ServerName)] pub server: ServerName, + pub secret: Secret, + #[special(special_ipif, SKL::Ordinary)] pub ipif: String, + + // Capped settings: + #[limited] pub max_batch_down: u32, + #[limited] pub max_queue_time: Duration, + #[limited] pub http_timeout: Duration, + #[limited] pub target_requests_outstanding: u32, + + // Ordinary settings: + pub addrs: Vec, + pub vnetwork: Vec, + pub vaddr: IpAddr, + pub vrelay: IpAddr, + pub port: u16, + pub mtu: u32, + pub ifname_server: String, + pub ifname_client: String, + + // Ordinary settings, used by server only: + #[server] pub max_clock_skew: Duration, + + // Ordinary settings, used by client only: + #[client] pub http_timeout_grace: Duration, + #[client] pub max_requests_outstanding: u32, + #[client] pub max_batch_up: u32, + #[client] pub http_retry: Duration, + #[client] pub url: Uri, + #[client] pub vroutes: Vec, +} + static DEFAULT_CONFIG: &str = r#" [COMMON] max_batch_down = 65536 @@ -75,42 +111,6 @@ impl Debug for Secret { fn fmt(&self, f: &mut fmt::Formatter) { write!(f, "Secret(***)")? } } -#[derive(hippotat_macros::ResolveConfig)] -#[derive(Debug,Clone)] -pub struct InstanceConfig { - // Exceptional settings - #[special(special_server, SKL::ServerName)] pub server: ServerName, - pub secret: Secret, - #[special(special_ipif, SKL::Ordinary)] pub ipif: String, - - // Capped settings: - #[limited] pub max_batch_down: u32, - #[limited] pub max_queue_time: Duration, - #[limited] pub http_timeout: Duration, - #[limited] pub target_requests_outstanding: u32, - - // Ordinary settings: - pub addrs: Vec, - pub vnetwork: Vec, - pub vaddr: IpAddr, - pub vrelay: IpAddr, - pub port: u16, - pub mtu: u32, - pub ifname_server: String, - pub ifname_client: String, - - // Ordinary settings, used by server only: - #[server] pub max_clock_skew: Duration, - - // Ordinary settings, used by client only: - #[client] pub http_timeout_grace: Duration, - #[client] pub max_requests_outstanding: u32, - #[client] pub max_batch_up: u32, - #[client] pub http_retry: Duration, - #[client] pub url: Uri, - #[client] pub vroutes: Vec, -} - #[derive(Debug,Clone,Hash,Eq,PartialEq)] pub enum SectionName { Link(LinkName),