cli: adding forwarding for local port for remote tunnels (#188715)

This reuses a lot of the logic we use for the normal VS Code Server
tunnel to do port forwarding. It does use a _different_ tunnel than what
Remote Tunnels would otherwise use for the control server. The reason
for this is that ports exist on a tunnel instance, and if we reused the
same tunnel then a client would expect all CLI hosts to serve all
tunnels, where the port forwarding instance would not provide the VS
Code server. It also reuses the singleton logic so all ports on a
machine are handled by a single CLI instance for the same reason: we
can't have different instances hosting subsets of
ports on a single tunnel.

Currently all ports are under the default privacy: support for
public/private tunnels is either later today or next iteration.
This commit is contained in:
Connor Peet
2023-07-24 15:12:21 -07:00
committed by GitHub
parent 67e47344d2
commit 5a14d85f48
12 changed files with 500 additions and 43 deletions

View File

@@ -114,6 +114,9 @@ async fn main() -> Result<(), std::convert::Infallible> {
Some(args::TunnelSubcommand::Service(service_args)) => {
tunnels::service(context_no_logger(), service_args).await
}
Some(args::TunnelSubcommand::ForwardInternal(forward_args)) => {
tunnels::forward(context_no_logger(), forward_args).await
}
None => tunnels::serve(context_no_logger(), tunnel_args.serve_args).await,
},
},