[proxy]: Proxy Add TCP support for local proxy

Implements the LKB-653
This commit is contained in:
Ivan Efremov
2025-07-28 21:05:42 +03:00
parent a6e0baf31a
commit 2da33972d2
2 changed files with 21 additions and 0 deletions

View File

@@ -47,6 +47,9 @@ struct LocalProxyCliArgs {
/// listen for incoming metrics connections on ip:port
#[clap(long, default_value = "127.0.0.1:7001")]
metrics: String,
/// listen for incoming TCP connections on ip:port
#[clap(short, long, default_value = "127.0.0.1:4432")]
proxy: Option<SocketAddr>,
/// listen for incoming http connections on ip:port
#[clap(long)]
http: String,
@@ -156,6 +159,13 @@ pub async fn run() -> anyhow::Result<()> {
let metrics_listener = TcpListener::bind(args.metrics).await?.into_std()?;
let http_listener = TcpListener::bind(args.http).await?;
let tcp_listener = if let Some(proxy_addr) = args.proxy {
Some(TcpListener::bind(proxy_addr).await?)
} else {
None
};
let shutdown = CancellationToken::new();
// todo: should scale with CU
@@ -207,6 +217,16 @@ pub async fn run() -> anyhow::Result<()> {
endpoint_rate_limiter,
);
// if tcp_listener.is_some() {
// maintenance_tasks.spawn(serverless::tcp_listener::task_main(
// tcp_listener.unwrap(),
// shutdown.clone(),
// auth_backend,
// config,
// endpoint_rate_limiter,
// ));
// }
Metrics::get()
.service
.info

View File

@@ -459,6 +459,7 @@ async fn request_handler(
// Return the response so the spawned future can continue.
Ok(response.map(|b| b.map_err(|x| match x {}).boxed()))
} else if request.uri().path() == "/sql" && *request.method() == Method::POST {
// Path used by SQL-over-HTTP proxy, auth broker and local_proxy
let ctx = RequestContext::new(session_id, conn_info, crate::metrics::Protocol::Http);
let span = ctx.span();