Skip to content

Commit

Permalink
fix parsing whitelist-ip (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeng-y-l authored Feb 17, 2025
1 parent 8593b64 commit 0c47f66
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/config/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ pub fn parse_config(input: &str) -> IResult<&str, OneConfig> {
map(parse_item("bind-cert-key-file"), OneConfig::BindCertKeyFile),
map(parse_item("bind-cert-key-pass"), OneConfig::BindCertKeyPass),
map(parse_item("blacklist-ip"), OneConfig::BlacklistIp),
map(parse_item("whitelist-ip"), OneConfig::WhitelistIp),
map(parse_item("cache-file"), OneConfig::CacheFile),
map(parse_item("cache-persist"), OneConfig::CachePersist),
map(parse_item("cache-size"), OneConfig::CacheSize),
Expand Down Expand Up @@ -307,6 +308,17 @@ mod tests {
);
}

#[test]
fn test_parse_whitelist_ip() {
assert_eq!(
parse_config("whitelist-ip 243.185.187.39").unwrap(),
(
"",
OneConfig::WhitelistIp("243.185.187.39/32".parse().unwrap())
)
);
}

#[test]
fn test_parse_log_size() {
assert_eq!(
Expand Down

0 comments on commit 0c47f66

Please sign in to comment.