Skip to content

Commit acb69a9

Browse files
committed
feat: add ws filtering by addresses and topics with configurable match logic
1 parent baebd91 commit acb69a9

File tree

8 files changed

+608
-23
lines changed

8 files changed

+608
-23
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/websocket-proxy/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ tracing-subscriber.workspace = true
1111
clap.workspace = true
1212
futures.workspace = true
1313
thiserror.workspace = true
14+
serde.workspace = true
1415
serde_json.workspace = true
1516
metrics.workspace = true
1617
tokio.workspace = true

crates/websocket-proxy/src/client.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::filter::FilterType;
12
use crate::rate_limit::Ticket;
23
use axum::extract::ws::WebSocket;
34
use axum::Error;
@@ -7,14 +8,16 @@ pub struct ClientConnection {
78
client_addr: IpAddr,
89
_ticket: Ticket,
910
pub(crate) websocket: WebSocket,
11+
pub filter: FilterType,
1012
}
1113

1214
impl ClientConnection {
13-
pub fn new(client_addr: IpAddr, ticket: Ticket, websocket: WebSocket) -> Self {
15+
pub fn new(client_addr: IpAddr, ticket: Ticket, websocket: WebSocket, filter: FilterType) -> Self {
1416
Self {
1517
client_addr,
1618
_ticket: ticket,
1719
websocket,
20+
filter,
1821
}
1922
}
2023

0 commit comments

Comments
 (0)