Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxmcd/webtty
Share a terminal session over WebRTC
https://github.com/maxmcd/webtty
golang pion-webrtc tty webrtc webrtc-experiments
Last synced: 20 days ago
JSON representation
Share a terminal session over WebRTC
- Host: GitHub
- URL: https://github.com/maxmcd/webtty
- Owner: maxmcd
- License: mit
- Created: 2018-11-05T00:06:08.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-07-23T19:27:55.000Z (3 months ago)
- Last Synced: 2024-10-01T17:42:37.191Z (about 1 month ago)
- Topics: golang, pion-webrtc, tty, webrtc, webrtc-experiments
- Language: Go
- Homepage: https://maxmcd.github.io/webtty/
- Size: 1.77 MB
- Stars: 2,701
- Watchers: 50
- Forks: 143
- Open Issues: 15
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome - maxmcd/webtty - Share a terminal session over WebRTC (Go)
- awesome-pion - maxmcd/webtty - Share a terminal session over WebRTC (DataChannel)
- awesome-repositories - maxmcd/webtty - Share a terminal session over WebRTC (Go)
- awesome-starts - maxmcd/webtty - Share a terminal session over WebRTC (Go)
- awesome-list - webtty
- awesome-hacking-lists - maxmcd/webtty - Share a terminal session over WebRTC (Go)
README
![](https://raw.githubusercontent.com/maxmcd/webtty/70f7911f4e69dffe3eb3cfd6ad9dd8060dc10dd5/out.gif)
## WebTTY
WebTTY allows you to share a terminal session from your machine using WebRTC. You can pair with a friend without setting up a proxy server, debug servers behind NATs, and more. WebTTY also works in-browser. You can connect to a WebTTY session from this static page: [https://maxmcd.github.io/webtty/](https://maxmcd.github.io/webtty/)
### Status
There are a handful of bugs to fix, but everything works pretty well at the moment. Please open an issue if you find a bug.
### Installation
Download a binary from the releases page: https://github.com/maxmcd/webtty/releases
Or, install directly with Go. WebTTY requires Go version 1.9 or higher.
For Go versions below 1.7:
```bash
go get -u github.com/maxmcd/webtty
```For Go versions 1.7 and up:
```bash
go install github.com/maxmcd/webtty@latest
```There were recent breaking api changes in the pion/webrtc library. Make sure to run `go get -u github.com/pion/webrtc` if you're running into any installation errors.
### Running
```shell
> webtty -h
Usage of webtty:
-cmd
The command to run. Default is "bash -l"
Because this flag consumes the remainder of the command line,
all other args (if present) must appear before this flag.
eg: webtty -o -v -ni -cmd docker run -it --rm alpine:latest sh
-ni
Set host to non-interactive
-non-interactive
Set host to non-interactive
-o One-way connection with no response needed.
-s string
The stun server to use (default "stun:stun.l.google.com:19302")
-v Verbose logging
```#### On the host computer
```shell
> webtty
Setting up a WebTTY connection.Connection ready. Here is your connection data:
25FrtDEjh7yuGdWMk7R9PhzPmphst7FdsotL11iXa4r9xyTM4koAauQYivKViWYBskf8habEc5vHf3DZge5VivuAT79uSCvzc6aL2M11kcUn9rzb4DX4...
Paste it in the terminal after the webtty command
Or in a browser: https://maxmcd.github.io/webtty/When you have the answer, paste it below and hit enter.
```#### On the client computer
```shell
> webtty 25FrtDEjh7yuGdWMk7R9PhzPmphst7FdsotL11iXa4r9xyTM4koAauQYivKViWYBskf8habEc5vHf3DZge5VivuAT79uSCvzc6aL2M11kcUn9rzb4DX4...```
### Terminal Size
By default WebTTY forces the size of the client terminal. This means the host size can frequently render incorrectly. One way you can fix this is by using tmux:
```bash
tmux new-session -s shared
# in another terminal
webtty -ni -cmd tmux attach-session -t shared
```
Tmux will now resize the session to the smallest terminal viewport.### One-way Connections
One-way connections can be enabled with the `-o` flag. A typical webrtc connection requires an SDP exchange between both parties. By default, WebTTY will create an SDP offer and wait for you to enter the SDP answer. With the `-o` flag the initial offer is sent along with a public url that the receiver is expected to post their response to. This uses my service [10kb.site](https://www.10kb.site). The host then polls the url continually until it gets an answer.
I think this somewhat violates the spirit of this tool because it relies on a third party service. However, one-way connections allow you to do very cool things. Eg: I can have a build server output a WebTTY connection string on error and allow anyone to attach to the session.
SDP descriptions are encrypted when uploaded and encryption keys are shared with the connection data to decrypt. So presumably the service being compromised is not problematic.
Very open to any ideas on how to enable trusted one-way connections. Please open an issue or reach out if you have thoughts. For now, the `-o` flag will print a warning and link to this explanation.