From 3813c703c9efb232a56ab8637082bd03ff0122f0 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Wed, 26 Apr 2023 15:22:02 +0300 Subject: [PATCH] Add an option for destination port. Makes it easier to test locally. --- proxy/src/bin/pg_sni_router.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/proxy/src/bin/pg_sni_router.rs b/proxy/src/bin/pg_sni_router.rs index b4fcbcefbd..7e1f6ea940 100644 --- a/proxy/src/bin/pg_sni_router.rs +++ b/proxy/src/bin/pg_sni_router.rs @@ -63,6 +63,7 @@ async fn main() -> anyhow::Result<()> { let _sentry_guard = init_sentry(Some(GIT_VERSION.into()), &[]); let args = cli().get_matches(); + let destination: String = args.get_one::("dest").unwrap().parse()?; // Configure TLS let tls_config: Arc = match ( @@ -103,8 +104,6 @@ async fn main() -> anyhow::Result<()> { _ => bail!("tls-key and tls-cert must be specified"), }; - let destination: String = args.get_one::("dest").unwrap().parse()?; - // Start listening for incoming client connections let proxy_address: SocketAddr = args.get_one::("listen").unwrap().parse()?; info!("Starting proxy on {proxy_address}"); @@ -225,7 +224,6 @@ async fn handle_client( let port = dest[2].parse::().context("invalid port")?; info!("destination: {:?}:{}", destination, port); - conn_cfg.host(destination.as_str()); conn_cfg.port(port);