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
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),