Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gateway/gateway.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ handshake = "5s"

# Timeout for top n hosts selection
cache_top_n = "30s"
# Timeout for DNS TXT record resolution (app address lookup).
dns_resolve = "5s"

# Enable data transfer timeouts below. This might impact performance. Turn off if
# bad performance is observed.
Expand Down
4 changes: 4 additions & 0 deletions gateway/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ pub struct Timeouts {
#[serde(with = "serde_duration")]
pub cache_top_n: Duration,

/// Timeout for DNS TXT record resolution (app address lookup).
#[serde(with = "serde_duration")]
pub dns_resolve: Duration,

pub data_timeout_enabled: bool,
#[serde(with = "serde_duration")]
pub idle: Duration,
Expand Down
4 changes: 3 additions & 1 deletion gateway/src/proxy/tls_passthough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ pub(crate) async fn proxy_with_sni(
) -> Result<()> {
let ns_prefix = &state.config.proxy.app_address_ns_prefix;
let compat = state.config.proxy.app_address_ns_compat;
let addr = resolve_app_address(ns_prefix, sni, compat)
let dns_timeout = state.config.proxy.timeouts.dns_resolve;
let addr = timeout(dns_timeout, resolve_app_address(ns_prefix, sni, compat))
.await
.context("DNS TXT resolve timeout")?
.context("failed to resolve app address")?;
debug!("target address is {}:{}", addr.app_id, addr.port);
proxy_to_app(state, inbound, buffer, &addr.app_id, addr.port).await
Expand Down