Skip to content

Commit 0785d64

Browse files
committed
Rename _tapp-address to _dstack-app-address
1 parent 0c5aad4 commit 0785d64

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ Now, I want to use my custom domain `tapp-nginx.kvin.wang` to access the Tapp. I
251251

252252
Where
253253

254-
`_tapp-address.tapp-nginx.kvin.wang` means configuring the tapp destination address of domain `tapp-nginx.kvin.wang`.
254+
`_dstack-app-address.tapp-nginx.kvin.wang` means configuring the tapp destination address of domain `tapp-nginx.kvin.wang`.
255255

256256
The TXT record value `3327603e03f5bd1f830812ca4a789277fc31f577:8043` means that requests sent to `tapp-nginx.kvin.wang` will be processed by Tapp `3327603e03f5bd1f830812ca4a789277fc31f577` on port `8043`
257257

gateway/gateway.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ buffer_size = 8192
5252
# number of hosts to try to connect to
5353
connect_top_n = 3
5454
localhost_enabled = false
55+
app_address_ns_prefix = "_dstack-app-address"
5556

5657
[core.proxy.timeouts]
5758
# Timeout for establishing a connection to the target app.

gateway/src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ pub struct ProxyConfig {
5959
pub buffer_size: usize,
6060
pub connect_top_n: usize,
6161
pub localhost_enabled: bool,
62+
pub app_address_ns_prefix: String,
6263
}
6364

6465
#[derive(Debug, Clone, Deserialize)]

gateway/src/proxy/tls_passthough.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ impl TappAddress {
2929
}
3030

3131
/// resolve tapp address by sni
32-
async fn resolve_tapp_address(sni: &str) -> Result<TappAddress> {
33-
let txt_domain = format!("_tapp-address.{sni}");
32+
async fn resolve_tapp_address(prefix: &str, sni: &str) -> Result<TappAddress> {
33+
let txt_domain = format!("{prefix}.{sni}");
3434
let resolver = hickory_resolver::AsyncResolver::tokio_from_system_conf()
3535
.context("failed to create dns resolver")?;
3636
let lookup = resolver
@@ -51,7 +51,7 @@ pub(crate) async fn proxy_with_sni(
5151
buffer: Vec<u8>,
5252
sni: &str,
5353
) -> Result<()> {
54-
let tapp_addr = resolve_tapp_address(sni)
54+
let tapp_addr = resolve_tapp_address(&state.config.proxy.app_address_ns_prefix, sni)
5555
.await
5656
.context("failed to resolve tapp address")?;
5757
debug!("target address is {}:{}", tapp_addr.app_id, tapp_addr.port);
@@ -120,10 +120,12 @@ mod tests {
120120

121121
#[tokio::test]
122122
async fn test_resolve_tapp_address() {
123-
let tapp_addr =
124-
resolve_tapp_address("3327603e03f5bd1f830812ca4a789277fc31f577.app.kvin.wang")
125-
.await
126-
.unwrap();
123+
let tapp_addr = resolve_tapp_address(
124+
"_dstack-app-address",
125+
"3327603e03f5bd1f830812ca4a789277fc31f577.app.kvin.wang",
126+
)
127+
.await
128+
.unwrap();
127129
assert_eq!(tapp_addr.app_id, "3327603e03f5bd1f830812ca4a789277fc31f577");
128130
assert_eq!(tapp_addr.port, 8090);
129131
}

0 commit comments

Comments
 (0)