From d38d260ba17c28781abdd18b1abc5a6a22fb145d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 23 Jul 2021 23:42:20 +0100 Subject: [PATCH] document and parse limit section headings Signed-off-by: Ian Jackson --- README.config | 2 ++ src/config.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/README.config b/README.config index 5bd6daf..37142b8 100644 --- a/README.config +++ b/README.config @@ -3,8 +3,10 @@ Sections [ ] + [ LIMIT] [] [] often [SERVER] + [LIMIT] [COMMON] [DEFAULT] diff --git a/src/config.rs b/src/config.rs index 39b1f72..63665f9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -62,6 +62,8 @@ pub enum SectionName { Link { server: ServerName, client: ClientName }, Client(ClientName), Server(ServerName), // includes SERVER, which is slightly special + ServerLimit(ServerName), + GlobalLimit, Common, Default, } @@ -100,6 +102,7 @@ impl FromStr for SectionName { match s { "COMMON" => return SN::Common, "DEFAULT" => return SN::Default, + "LIMIT" => return SN::GlobalLimit, _ => { } }; if let Ok(n@ ServerName(_)) = s.parse() { return SN::Server(n) } @@ -111,6 +114,7 @@ impl FromStr for SectionName { s ))?; let server = server.parse().context("server name in link section name")?; + if client == "LIMIT" { return SN::ServerLimit(server) } let client = client.parse().context("client name in link section name")?; SN::Link { server, client } } -- 2.30.2