Commit Graph

20 Commits

Author SHA1 Message Date
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
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
b547b58db6 cli: use win32 app mutex to detect running tunnels and tunnel sevices (#179622)
* cli: fix distro mixin

* cli: use win32 app mutex to detect running tunnels and tunnel sevices

Fixes #179265

* cli: fix distro mixin more

* fix

* fix build
2023-04-10 20:25:14 +01:00
Connor Peet
3d7f6dec00 cli: fix tunnel message command (#178079)
Fixes #177394
2023-03-22 14:44:49 -07:00
Connor Peet
eab8ba65bf cli: add tunnel status command (#177381)
Fixes #177372
2023-03-16 12:26:56 -07:00
Connor Peet
abab52dd94 cli: add tunnel kill/restart subcommands (#177286) 2023-03-15 15:09:12 -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
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
82b239204c cli: print oauth errors better, respect slow_down (#169164)
For diagnosing https://github.com/microsoft/vscode/issues/169066
2022-12-14 14:06:24 -05:00
Connor Peet
fb53973c5f cli: pull documentation url from product.json (#166993)
Fixes https://github.com/microsoft/vscode-cli/issues/560
2022-11-22 11:21:41 -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
e996746b14 add observability for windows 2022-11-15 20:38:18 -08:00
Connor Peet
1bf3323015 cli: add service integration for macos, observability
Adds support for running the tunnel as a service on macOS via launchservices.

It also hooks up observability (`code tunnel service log`) on macOS and Linux.
On macOS--and later Windows, hence the manual implementation of `tail`--it
saves output to a log file and watches it. On Linux, it simply delegates to
journalctl.

The "tailing" is implemented via simple polling of the file size. I didn't want
to pull in a giant set of dependencies for inotify/kqueue/etc just for this use
case; performance when polling a single log file is not a huge concern.
2022-11-15 15:39:58 -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
84439a87f6 wip 2022-10-14 15:46:49 -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
54ca489a5b cli: get update endpoint from build 2022-09-22 12:55:28 -07:00
Connor Peet
3762635fe1 move cli to top level 2022-09-20 08:42:44 -07:00