Skip to content

Commit 75f21d0

Browse files
authored
agentHost: support connections over tunnels (#307948)
* wip * clean up unused bits and make auth work correctly * comments and fixes
1 parent de4fc2b commit 75f21d0

40 files changed

Lines changed: 2803 additions & 1039 deletions

cli/src/commands/agent_host.rs

Lines changed: 19 additions & 563 deletions
Large diffs are not rendered by default.

cli/src/commands/tunnels.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ use crate::{
3131
async_pipe::{get_socket_name, listen_socket_rw_stream, AsyncRWAccepter},
3232
auth::Auth,
3333
constants::{
34-
APPLICATION_NAME, CONTROL_PORT, IS_A_TTY, TUNNEL_CLI_LOCK_NAME, TUNNEL_SERVICE_LOCK_NAME,
34+
AGENT_HOST_PORT, APPLICATION_NAME, CONTROL_PORT, IS_A_TTY, TUNNEL_CLI_LOCK_NAME,
35+
TUNNEL_SERVICE_LOCK_NAME,
3536
},
3637
log,
3738
state::LauncherPaths,
@@ -330,7 +331,8 @@ pub async fn user(ctx: CommandContext, user_args: TunnelUserSubCommands) -> Resu
330331
}
331332
TunnelUserSubCommands::Show => {
332333
if let Ok(Some(sc)) = auth.get_current_credential() {
333-
ctx.log.result(format!("logged in with provider {}", sc.provider));
334+
ctx.log
335+
.result(format!("logged in with provider {}", sc.provider));
334336
} else {
335337
ctx.log.result("not logged in");
336338
return Ok(1);
@@ -649,7 +651,7 @@ async fn serve_with_csa(
649651
dt.start_existing_tunnel(t).await
650652
} else {
651653
tokio::select! {
652-
t = dt.start_new_launcher_tunnel(gateway_args.name.as_deref(), gateway_args.random_name, &[CONTROL_PORT]) => t,
654+
t = dt.start_new_launcher_tunnel(gateway_args.name.as_deref(), gateway_args.random_name, &[CONTROL_PORT, AGENT_HOST_PORT]) => t,
653655
_ = shutdown.wait() => return Ok(1),
654656
}
655657
}?;

cli/src/constants.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use lazy_static::lazy_static;
1212
use crate::options::Quality;
1313

1414
pub const CONTROL_PORT: u16 = 31545;
15+
pub const AGENT_HOST_PORT: u16 = 31546;
1516

1617
/// Protocol version sent to clients. This can be used to indicate new or
1718
/// changed capabilities that clients may wish to leverage.
@@ -20,7 +21,8 @@ pub const CONTROL_PORT: u16 = 31545;
2021
/// are compressed bidirectionally.
2122
/// 3 - The server's connection token is set to a SHA256 hash of the tunnel ID
2223
/// 4 - The server's msgpack messages are no longer length-prefixed
23-
pub const PROTOCOL_VERSION: u32 = 4;
24+
/// 5 - The server now exposes an agent host connection
25+
pub const PROTOCOL_VERSION: u32 = 5;
2426

2527
/// Prefix for the tunnel tag that includes the version.
2628
pub const PROTOCOL_VERSION_TAG_PREFIX: &str = "protocolv";

cli/src/tunnels.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub mod shutdown_signal;
1313
pub mod singleton_client;
1414
pub mod singleton_server;
1515

16+
pub mod agent_host;
1617
mod challenge;
1718
mod control_server;
1819
mod nosleep;

0 commit comments

Comments
 (0)