From: Ian Jackson Date: Sat, 7 Aug 2021 16:56:08 +0000 (+0100) Subject: config: Rename PerClient from Ordinary X-Git-Tag: hippotat/1.0.0~277 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=d1d0ef498e38ceeb6fd78567d7d7d2b5a808b9bb;p=hippotat.git config: Rename PerClient from Ordinary NFC. This was really quite confusing because the settings which default to Ordinary are in fact supposed to be client-agnostic on the server end. Right now this is broken. Signed-off-by: Ian Jackson --- diff --git a/macros/macros.rs b/macros/macros.rs index f190bdb..ac1a497 100644 --- a/macros/macros.rs +++ b/macros/macros.rs @@ -14,7 +14,7 @@ use itertools::Itertools; /// Atrributes: /// /// * `limited`, `server`, `client`: cooked sets of settings; -/// default `SKL` is `Ordinary` except for `limited` +/// default `SKL` is `PerClient` except for `limited` /// * `special(method, SKL)` /// /// Generated code @@ -53,7 +53,7 @@ pub fn resolve(input: proc_macro::TokenStream) -> proc_macro::TokenStream { //dbg!(field); let fname = &field.ident.as_ref().unwrap(); let fname_span = fname.span(); - let mut skl = quote_spanned!{fname_span=> SectionKindList::Ordinary }; + let mut skl = quote_spanned!{fname_span=> SectionKindList::PerClient }; let mut method = quote_spanned!{fname_span=> ordinary }; for attr in &field.attrs { let atspan = attr.path.segments.last().unwrap().ident.span(); diff --git a/src/config.rs b/src/config.rs index f08fe71..77f3401 100644 --- a/src/config.rs +++ b/src/config.rs @@ -12,7 +12,7 @@ pub struct InstanceConfig { // Exceptional settings #[special(special_link, SKL::ServerName)] pub link: LinkName, pub secret: Secret, - #[special(special_ipif, SKL::Ordinary)] pub ipif: String, + #[special(special_ipif, SKL::PerClient)] pub ipif: String, // Capped settings: #[limited] pub max_batch_down: u32, @@ -516,7 +516,7 @@ impl Parseable for Vec { #[derive(Debug,Copy,Clone)] enum SectionKindList { - Ordinary, + PerClient, Limited, Limits, ClientAgnostic, @@ -533,7 +533,7 @@ impl SectionName { impl SectionKindList { fn contains(self, s: &SectionName) -> bool { match self { - SKL::Ordinary => matches!(s, SN::Link(_) + SKL::PerClient => matches!(s, SN::Link(_) | SN::Client(_) | SN::Server(_) | SN::Common), @@ -544,8 +544,8 @@ impl SectionKindList { SKL::ClientAgnostic => matches!(s, SN::Common | SN::Server(_)), - SKL::Limited => SKL::Ordinary.contains(s) - | SKL::Limits .contains(s), + SKL::Limited => SKL::PerClient.contains(s) + | SKL::Limits .contains(s), SKL::ServerName => matches!(s, SN::Common) | matches!(s, SN::Server(ServerName(name)) @@ -613,7 +613,7 @@ impl<'c> ResolveContext<'c> { pub fn ordinary(&self, key: &'static str) -> T where T: Parseable { - match self.first_of(key, SKL::Ordinary)? { + match self.first_of(key, SKL::PerClient)? { Some(y) => y, None => Parseable::default_for_key(key)?, } @@ -852,7 +852,7 @@ pub fn read(opts: &Opts, end: LinkEnd) -> Vec { ], }; - if rctx.first_of_raw("secret", SKL::Ordinary).is_none() { continue } + if rctx.first_of_raw("secret", SKL::PerClient).is_none() { continue } let mut ic = InstanceConfig::resolve_instance(&rctx) .with_context(|| format!("resolve config for {}", &link))?;