Skip to content

Commit 3d1aab1

Browse files
committed
feat(gateway): add yamux listener support and uds2yamux helper
1 parent 29fe476 commit 3d1aab1

16 files changed

Lines changed: 1204 additions & 24 deletions

File tree

Cargo.lock

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ members = [
5252
"verifier",
5353
"no_std_check",
5454
"size-parser",
55+
"uds2yamux",
5556
]
5657
resolver = "2"
5758

@@ -159,7 +160,10 @@ rocket = { git = "https://github.com/rwf2/Rocket", branch = "master", features =
159160
] }
160161
rocket-apitoken = { git = "https://github.com/kvinwang/rocket-apitoken", branch = "dev" }
161162
tokio = { version = "1.46.1" }
163+
tokio-util = { version = "0.7", features = ["compat"] }
162164
tokio-vsock = "0.7.0"
165+
yamux = { git = "https://github.com/kvinwang/rust-yamux", branch = "feat/ping-timeout" }
166+
quinn = { path = "/home/kvin/src/quinn-plain/quinn", default-features = false, features = ["runtime-tokio", "null-crypto"] }
163167
sysinfo = "0.35.2"
164168
default-net = "0.22.0"
165169
url = "2.5"

gateway/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fs-err.workspace = true
2020
clap = { workspace = true, features = ["derive", "string"] }
2121
shared_child.workspace = true
2222
tokio = { workspace = true, features = ["full"] }
23+
tokio-util = { workspace = true, features = ["compat"] }
2324
rustls.workspace = true
2425
tokio-rustls = { workspace = true, features = ["ring"] }
2526
rinja.workspace = true
@@ -37,6 +38,7 @@ bytes.workspace = true
3738
safe-write.workspace = true
3839
smallvec.workspace = true
3940
futures.workspace = true
41+
yamux.workspace = true
4042
cmd_lib.workspace = true
4143
load_config.workspace = true
4244
dstack-kms-rpc.workspace = true

gateway/dstack-app/builder/entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ idle = "10m"
149149
write = "5s"
150150
shutdown = "5s"
151151
total = "5h"
152+
yamux_ping = "${YAMUX_PING_TIMEOUT:-15s}"
152153
153154
[core.recycle]
154155
enabled = true

gateway/gateway.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ connect_top_n = 3
6868
localhost_enabled = false
6969
app_address_ns_prefix = "_dstack-app-address"
7070
app_address_ns_compat = true
71+
# yamux_listen_port = 4433
7172
workers = 32
7273
external_port = 443
7374

@@ -93,6 +94,8 @@ write = "5s"
9394
shutdown = "5s"
9495
# Timeout for total connection duration.
9596
total = "5h"
97+
# Yamux ping timeout (0s disables).
98+
yamux_ping = "15s"
9699

97100
[core.recycle]
98101
enabled = true

gateway/src/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ pub struct ProxyConfig {
8585
pub workers: usize,
8686
pub app_address_ns_prefix: String,
8787
pub app_address_ns_compat: bool,
88+
pub yamux_listen_port: Option<u16>,
8889
}
8990

9091
#[derive(Debug, Clone, Deserialize)]
@@ -110,6 +111,10 @@ pub struct Timeouts {
110111
pub write: Duration,
111112
#[serde(with = "serde_duration")]
112113
pub shutdown: Duration,
114+
115+
/// Ping timeout for yamux connections. Set to 0s to disable.
116+
#[serde(with = "serde_duration")]
117+
pub yamux_ping: Duration,
113118
}
114119

115120
#[derive(Debug, Clone, Deserialize, Serialize)]

0 commit comments

Comments
 (0)