Skip to content

Commit e532317

Browse files
committed
Cargo fmt
1 parent 4ccbb7f commit e532317

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

source/river/src/proxy/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl Modifiers {
169169
other => {
170170
tracing::warn!("Unknown request filter: '{other}'");
171171
return Err(Error::new(pingora::ErrorType::Custom("Bad configuration")));
172-
},
172+
}
173173
};
174174
request_filter_mods.push(f);
175175
}
@@ -187,7 +187,7 @@ impl Modifiers {
187187
other => {
188188
tracing::warn!("Unknown upstream request filter: '{other}'");
189189
return Err(Error::new(pingora::ErrorType::Custom("Bad configuration")));
190-
},
190+
}
191191
};
192192
upstream_request_filters.push(f);
193193
}
@@ -205,7 +205,7 @@ impl Modifiers {
205205
other => {
206206
tracing::warn!("Unknown upstream response filter: '{other}'");
207207
return Err(Error::new(pingora::ErrorType::Custom("Bad configuration")));
208-
},
208+
}
209209
};
210210
upstream_response_filters.push(f);
211211
}
@@ -249,7 +249,7 @@ where
249249
// If Err: we return that
250250
e @ Err(_) => return e,
251251
// If Ok(false), we move on to the next filter
252-
Ok(false) => {},
252+
Ok(false) => {}
253253
}
254254
}
255255
Ok(false)

source/river/src/proxy/request_filters.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::collections::BTreeMap;
33
use async_trait::async_trait;
44
use cidr::IpCidr;
55
use pingora::ErrorType;
6-
use pingora_proxy::Session;
76
use pingora_core::{protocols::l4::socket::SocketAddr, Error, Result};
7+
use pingora_proxy::Session;
88

99
use crate::proxy::{extract_val, RiverContext};
1010

@@ -13,11 +13,7 @@ use crate::proxy::{extract_val, RiverContext};
1313
#[async_trait]
1414
pub trait RequestFilterMod: Send + Sync {
1515
/// See [ProxyHttp::request_filter] for more details
16-
async fn request_filter(
17-
&self,
18-
session: &mut Session,
19-
ctx: &mut RiverContext,
20-
) -> Result<bool>;
16+
async fn request_filter(&self, session: &mut Session, ctx: &mut RiverContext) -> Result<bool>;
2117
}
2218

2319
pub struct CidrRangeFilter {
@@ -37,11 +33,11 @@ impl CidrRangeFilter {
3733
match addr.parse::<IpCidr>() {
3834
Ok(a) => {
3935
blocks.push(a);
40-
},
36+
}
4137
Err(_) => {
4238
tracing::error!("Failed to parse '{addr}' as a valid CIDR notation range");
4339
return Err(Error::new(ErrorType::Custom("Invalid configuration")));
44-
},
40+
}
4541
};
4642
}
4743

@@ -51,11 +47,7 @@ impl CidrRangeFilter {
5147

5248
#[async_trait]
5349
impl RequestFilterMod for CidrRangeFilter {
54-
async fn request_filter(
55-
&self,
56-
session: &mut Session,
57-
_ctx: &mut RiverContext,
58-
) -> Result<bool> {
50+
async fn request_filter(&self, session: &mut Session, _ctx: &mut RiverContext) -> Result<bool> {
5951
let Some(addr) = session.downstream_session.client_addr() else {
6052
// Unable to determine source address, assuming it should be blocked
6153
return Err(Error::new_down(ErrorType::Custom("Missing Client Address")));

0 commit comments

Comments
 (0)