chiark / gitweb /
move InstanceConfig to prominently at the top of config.rs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 25 Jul 2021 17:04:44 +0000 (18:04 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 25 Jul 2021 17:04:56 +0000 (18:04 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/config.rs

index 30e2c120f9c73c2b8e4fe61ee19da38e06121e9b..79ff778a291603bf29b82c80d2844464df58a37b 100644 (file)
@@ -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<IpAddr>,
+  pub vnetwork:                     Vec<IpNet>,
+  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<IpNet>,
+}
+
 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<IpAddr>,
-  pub vnetwork:                     Vec<IpNet>,
-  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<IpNet>,
-}
-
 #[derive(Debug,Clone,Hash,Eq,PartialEq)]
 pub enum SectionName {
   Link(LinkName),