From 7f6becf67416471312cd517528fb68e18ca8c9b6 Mon Sep 17 00:00:00 2001 From: Roshan Jobanputra Date: Thu, 25 Apr 2024 11:22:58 -0400 Subject: [PATCH 1/2] Provide port when calling tokio::net::lookup_host --- src/postgres-util/src/tunnel.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/postgres-util/src/tunnel.rs b/src/postgres-util/src/tunnel.rs index 42f1aa81ab51d..d5fca35d7268e 100644 --- a/src/postgres-util/src/tunnel.rs +++ b/src/postgres-util/src/tunnel.rs @@ -303,7 +303,9 @@ impl Config { // the singular host in place. let privatelink_host = mz_cloud_resources::vpc_endpoint_name(*connection_id); - let privatelink_addrs = tokio::net::lookup_host(privatelink_host).await?; + // `net::lookup_host` requires a port to be specified, but the port has no effect + // on the lookup so use a dummy one + let privatelink_addrs = tokio::net::lookup_host((privatelink_host, 11111)).await?; // Override the actual IPs to connect to for the TCP connection, leaving the original host in-place // for TLS verification From d63e55200bc7c5a1e15f111907876c93a40db54b Mon Sep 17 00:00:00 2001 From: Roshan Jobanputra Date: Thu, 25 Apr 2024 11:58:38 -0400 Subject: [PATCH 2/2] Avoid misattribution due to thiserror conversion of std::io::Error in postgres util --- src/postgres-util/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/postgres-util/src/lib.rs b/src/postgres-util/src/lib.rs index 3835342fdd210..450e91b12ea8f 100644 --- a/src/postgres-util/src/lib.rs +++ b/src/postgres-util/src/lib.rs @@ -46,7 +46,10 @@ pub enum PostgresError { Ssh(#[source] anyhow::Error), /// Error doing io to setup an ssh connection. #[error("error communicating with ssh tunnel: {0}")] - SshIo(#[from] std::io::Error), + SshIo(std::io::Error), + /// Error doing io to setup a connection. + #[error("IO error in connection: {0}")] + Io(#[from] std::io::Error), /// A postgres error. #[error(transparent)] Postgres(#[from] tokio_postgres::Error),