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

@@ -4,6 +4,7 @@
//! and forwards them to backends using the same routing and pool infrastructure
//! as the HTTP/1+2 proxy.
use std::net::SocketAddr;
use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
@@ -61,13 +62,17 @@ impl H3ProxyService {
}
/// Handle an accepted QUIC connection as HTTP/3.
///
/// If `real_client_addr` is provided (from PROXY protocol), it overrides
/// `connection.remote_address()` for client IP attribution.
pub async fn handle_connection(
&self,
connection: quinn::Connection,
_fallback_route: &RouteConfig,
port: u16,
real_client_addr: Option<SocketAddr>,
) -> anyhow::Result<()> {
let remote_addr = connection.remote_address();
let remote_addr = real_client_addr.unwrap_or_else(|| connection.remote_address());
debug!("HTTP/3 connection from {} on port {}", remote_addr, port);
let mut h3_conn: h3::server::Connection<h3_quinn::Connection, Bytes> =