mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-22 21:59:59 +00:00
[proxy]: Proxy Add TCP support for local proxy
Implements the LKB-653
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user