feat(rustproxy-passthrough): add PROXY protocol v2 client IP handling for UDP and QUIC listeners

This commit is contained in:
2026-03-19 23:16:42 +00:00
parent e8db7bc96d
commit 4b64de2c67
6 changed files with 485 additions and 71 deletions

View File

@@ -264,6 +264,8 @@ impl RustProxy {
conn_config.socket_timeout_ms,
conn_config.max_connection_lifetime_ms,
);
// Clone proxy_ips before conn_config is moved into the TCP listener
let udp_proxy_ips = conn_config.proxy_ips.clone();
listener.set_connection_config(conn_config);
// Share the socket-handler relay path with the listener
@@ -339,6 +341,7 @@ impl RustProxy {
conn_tracker,
self.cancel_token.clone(),
);
udp_mgr.set_proxy_ips(udp_proxy_ips.clone());
// Construct H3ProxyService for HTTP/3 request handling
let h3_svc = rustproxy_http::h3_service::H3ProxyService::new(
@@ -774,12 +777,15 @@ impl RustProxy {
if self.udp_listener_manager.is_none() {
if let Some(ref listener) = self.listener_manager {
let conn_tracker = listener.conn_tracker().clone();
self.udp_listener_manager = Some(UdpListenerManager::new(
let conn_config = Self::build_connection_config(&self.options);
let mut udp_mgr = UdpListenerManager::new(
Arc::clone(&new_manager),
Arc::clone(&self.metrics),
conn_tracker,
self.cancel_token.clone(),
));
);
udp_mgr.set_proxy_ips(conn_config.proxy_ips);
self.udp_listener_manager = Some(udp_mgr);
}
}