chiark / gitweb /
document and parse limit section headings
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 23 Jul 2021 22:42:20 +0000 (23:42 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 23 Jul 2021 22:42:20 +0000 (23:42 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
README.config
src/config.rs

index 5bd6daf2e4bb1f5a3acd01eb88ebb2b46ef5b477..37142b8f2b769a68df7d263c025b0757a46c5dae 100644 (file)
@@ -3,8 +3,10 @@
 Sections
 
   [<servername> <client>]
+  [<servername> LIMIT]
   [<client>]
   [<servername>]      often [SERVER]
+  [LIMIT]
   [COMMON]
   [DEFAULT]
 
index 39b1f7255c10c2b775da7be964625f1c65ebfad6..63665f96f15071be3f81fef558da536984388d18 100644 (file)
@@ -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 }
   }