Skip to content

Commit 3d69296

Browse files
committed
use 'longest_match' with stream
Since the stream can contain IP ranges, do not use `exact_match` but rather `longest_match`.
1 parent 40cd002 commit 3d69296

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "traefik_crowdsec_bouncer"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

src/bouncer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub async fn authenticate(
7373
let req_ip = Ipv4Addr::from_str(&req_ip_str);
7474
match req_ip {
7575
Ok(ip) => {
76-
if ipv4_table.exact_match(ip, 32).is_some() {
76+
if ipv4_table.longest_match(ip).is_some() {
7777
forbidden_response(Some(req_ip_str))
7878
} else {
7979
allowed_response(Some(req_ip_str))

src/crowdsec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use ip_network_table_deps_treebitmap::IpLookupTable;
1111
use serde::{Deserialize, Serialize};
1212

1313
use crate::config::Config;
14-
use crate::errors::{CrowdSecApiError};
14+
use crate::errors::CrowdSecApiError;
1515
use crate::types::{CacheAttributes, HealthStatus};
1616
use crate::utils::get_ip_and_subnet;
1717

0 commit comments

Comments
 (0)