Commit Graph

43 Commits

Author SHA1 Message Date
Connor Peet
c4efcbdfb4 cli: remove stray debug log (#233714) 2024-11-12 10:42:28 -08:00
Hamir Mahal
a744313eb7 style: simplify string formatting for readability (#231763)
* style: simplify string formatting for readability

* fix: formatting in `.rs` files in `src/`
2024-10-22 16:30:46 +00:00
Connor Peet
03d781a755 cli: fix closing incorrectly if updated failed (#215595) 2024-06-15 00:54:51 +02:00
Connor Peet
0f2b535662 cli: automatically remove servers that fail to start (#211500)
Fixes https://github.com/microsoft/vscode-remote-release/issues/9823
2024-04-27 06:54:06 -07:00
Connor Peet
8558da1335 cli: allow public port forwarding via tunnels (#209489) 2024-04-04 00:28:00 +02:00
Connor Peet
6269ab41b4 cli: add --install-extension command for use with tunnel server (#207741)
* cli: add --install-extension command for use with tunnel server

* fix clippy
2024-03-14 19:05:20 +01:00
Connor Peet
7771124ebd cli: add tcpConnect exec server command, add proposed methods to .d.ts (#197692) 2023-11-07 16:23:48 -08:00
Connor Peet
ad29091f39 fix: don't wait for stdin pump to end before propagating process exit (#196306) 2023-10-23 10:59:05 -07:00
Connor Peet
4aa04c7db2 cli: add extra fs operations for container
Ref https://github.com/microsoft/vscode-remote-tunnels/issues/695
2023-10-18 20:28:02 -07:00
Connor Peet
96d5db84d1 cli: fix closing before stdio is drained
Fixes https://github.com/microsoft/vscode-remote-tunnels/issues/693
2023-10-18 20:28:02 -07:00
Connor Peet
e250c8066d cli: fix command prompt showing up on windows (#194946)
cli: fix wsl prompt up on windows machine

Fixes #190425 again
2023-10-06 17:09:47 +01:00
Connor Peet
f92db2f96e cli: fix renamed self-update name, cleanup old binaries
Fixes #192948
2023-09-21 14:37:33 -07:00
Connor Peet
fbdc92cac0 cli: fix delegated http requests not working (#192620)
From a refactor last literation. I don't think this is candidate worthy
as it's an uncommon path with remote-tunnels, and we can just toggle
this off for remote-ssh for this iteration.
2023-09-08 13:26:36 -07:00
Connor Peet
0ee7a576b6 tunnels: fix command prompt windows show up on windows machine (#192016)
Fixes #190425
2023-09-01 22:17:58 +02:00
Connor Peet
b5038f81d1 cli: allow exec server to listen on a port and require token authentication (#188434)
* cli: allow exec server to listen on a port and require token authentication

For remote ssh on Windows where pipe forwarding doesn't work

* fix linux build
2023-07-21 18:32:20 +02:00
Connor Peet
3e0786633b cli: allow exec server to listen on socket (#188123)
* cli: allow exec server to listen on socket

For remote ssh

* fix lint
2023-07-18 09:19:44 -07:00
Connor Peet
62c33b3ca2 cli: fix connection default being applied (#183827) 2023-05-30 20:44:42 +02:00
Connor Peet
8242d20803 fixes for wsl hosting (#183491) 2023-05-26 08:47:56 +02:00
Connor Peet
679bb967c3 cli: add stdio control server
* signing: implement signing service on the web

* wip

* cli: implement stdio service

This is used to implement the exec server for WSL. Guarded behind a signed handshake.

* update distro

* rm debug

* address pr comments
2023-05-19 17:19:52 +02:00
Connor Peet
cedf1eaa25 cli: add new control server messages for wsl (#180438)
* cli: add new control server messages for wsl

* support cwd in spawn
2023-04-20 15:19:05 -07:00
Connor Peet
f743297aa1 cli: add acquire_cli (#179837)
* cli: add acquire_cli

As given in my draft document, pipes a CLI of the given platform to the
specified process, for example:

```js
const cmd = await rpc.call('acquire_cli', {
	command: 'node',
	args: [
		'-e',
		'process.stdin.pipe(fs.createWriteStream("c:/users/conno/downloads/hello-cli"))',
	],
	platform: Platform.LinuxX64,
	quality: 'insider',
});
```

It genericizes caching so that the CLI is also cached on the host, just
like servers.

* fix bug
2023-04-13 19:18:48 +01:00
Connor Peet
2d8ff25c85 cli: add streams to rpc, generic 'spawn' command (#179732)
* cli: apply improvements from integrated wsl branch

* cli: add streams to rpc, generic 'spawn' command

For the "exec server" concept, fyi @aeschli.

* update clippy and apply fixes

* fix unused imports :(
2023-04-12 16:51:29 +01:00
Connor Peet
dfbea0f578 cli: when attaching, always print the connection link (#178445)
Fixes #178090
2023-03-27 12:52:50 -07:00
Connor Peet
abab52dd94 cli: add tunnel kill/restart subcommands (#177286) 2023-03-15 15:09:12 -07:00
Connor Peet
0e7d14d32d cli: allow client process to control singleton process (#177141)
Other connected clients will now print:

```
Connected to an existing tunnel process running on this machine. You can press:

- Ctrl+C to detach
- "x" to stop the tunnel and exit
- "r" to restart the tunnel
```

These are then sent to the server to have that take effect. This is
mostly some refactors in the singleton_server to make the lifecycle work.
2023-03-14 17:55:28 -07:00
Connor Peet
1b5fd140fb Run tunnels as singleton process (for a --cli-data-dir) (#177002)
* wip on singleton

* wip

* windows support

* wip

* wip

* fix clippy
2023-03-14 08:09:47 -07:00
Connor Peet
c010101bc4 wip 2023-01-19 20:03:47 -08:00
Connor Peet
8965c48d30 wip 2023-01-18 16:15:43 -08:00
Connor Peet
2c2ead679b cli: initial wsl control server
Adds an stdin/out json rpc server for wsl.

Exposes a singular install_local command to install+boot the vscode server on a port from a local archive.

Also refines the common rpc layer some more. I'm decently happy with it now.
2023-01-18 08:23:04 -08:00
Connor Peet
4d882322ca cli: start to extract a generic rpc interface (#171299)
I want to use the rpc interface for communication via stdin/out in wsl,
but currently RPC is tightly coupled to the control server. The control
server also speaks msgpack instead of JSON, since it deals with binary
messages. WSL won't, and we'll want to use JSON to interact with VS
Code, so some separation is needed.

This pulls out a base set of RPC types for use in both scenarios.
Currently these are only 'helper' structs that don't actually do any
i/o, but once I figure out the model I would like to have a cleaner way
to do i/o in a unified way as well.

For the control server, previously we basically handled all methods in
one big `switch` block with nasty macros, whereas now there's
nicer `register_a/sync` functions.

Some additional small refactors were needed to preserve the strict
ordering of server messages, since they need to be order else we get
decompression errors. This is the `start_bridge_write_loop`. As a small
benefit, this means we can avoid the relatively expensive async Tokio
mutex that we were using, and instead use the standard library mutex.
2023-01-16 21:43:41 -08:00
Connor Peet
b5ad508dfb cli: cleanup some process querying code (#170306)
Avoid pulling system info we don't have to.

Minor cleanups while working on https://github.com/microsoft/vscode/pull/170305
2022-12-30 12:55:57 -08:00
Connor Peet
796ee2bf3c chore: pull more strings from the product.json (#166769)
Fixes the bulk of https://github.com/microsoft/vscode-cli/issues/560
2022-11-18 18:52:52 -08:00
Connor Peet
384ba2454f cli: don't allow/check for updates when integrated (#166759)
Fixes https://github.com/microsoft/vscode-cli/issues/564
2022-11-18 16:29:55 -08:00
Connor Peet
e996746b14 add observability for windows 2022-11-15 20:38:18 -08:00
Connor Peet
ebfa4b0c3c cli: enable server message compression
This is the CLI side of enabling compression of servermsg's sent
over the socket. It is feature-detected by the CLI sending
protocolVersion=2. If present, the consumer can request compression by
passing `compress:true` when setting up the server.

In this mode, servermsg's are an inflate/deflate stream. Not a ton of
code here, but was lots of fun tweaking to get it right :)

Fixes https://github.com/microsoft/vscode/issues/163688
2022-11-11 11:51:09 -08:00
Connor Peet
d31573550f cli: implement local download fallback
Implements an automatic local download fallback, similar to SSH
(cc @roblourens). If the initial download results in an error, either
in making the request or a 5xx, it'll try to fall back to making the
request locally and streaming it over the tunnel.

This abstracts the request client behing a "SimpleHttp" trait which
either uses to the native reqwest or uses the 'delegated' mode over the
socket.
2022-11-09 15:27:47 -08:00
Connor Peet
161418296b cli: allow handling control server requests in parallel
Previously the control server could only handle a single request at a
time. To enable local download mode, this needs to change as the client
will be sending data to the CLI as it downloads the vscode server zip.

This does that. There's a little mess since things that async handlers
need to use are cloned out of the previously unified "context" (we
could try and clone the whole context each time, but this is more work
than needed.) We still keep the fast things as "blocking" since that
avoids the need for clones and separate tasks.
2022-11-08 12:06:49 -08:00
Martin Aeschlimann
5a4be3b8a8 tunnel: Generate vanity URL (#164710) 2022-10-26 09:13:29 -04:00
Martin Aeschlimann
c6188602f4 tunnel cli: add --parent-process-id option (#163935)
* tunnel cli: add --parent-process-id option

* Update cli/src/commands/args.rs

Co-authored-by: Connor Peet <connor@peet.io>

* Change parent process check interval to 2s

Co-authored-by: Connor Peet <connor@peet.io>
2022-10-18 11:52:10 -07:00
Connor Peet
07453efc00 cli: implement better self-updating
- Start separating a "standalone" CLI. This is a little awkward with clap-
  derive, but I got it working. Detection of whether the CLI _is_
  standalone is still todo.
- Remove the old ad-hoc update code for code-server, and use the update
  service instead.
- Fix some of the "permission denied" errors people got while updating
  before. We need to rename the old running binary, not just overwrite it.
2022-09-23 17:47:39 -07:00
Connor Peet
b784bcdd32 cli: use hard tabs to align with vscode style 2022-09-23 14:17:01 -07:00
Connor Peet
9bcc88eafe cli: get builds in order 2022-09-23 13:28:26 -07:00
Connor Peet
3762635fe1 move cli to top level 2022-09-20 08:42:44 -07:00