diff --git a/.circleci/config.yml b/.circleci/config.yml index c5bf33d..1bf4d74 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,8 +2,8 @@ version: 2 jobs: build: docker: - - image: maxmcd/webrtty-node-go:latest - working_directory: /go/src/github.com/maxmcd/webrtty + - image: maxmcd/webtty-node-go:latest + working_directory: /go/src/github.com/maxmcd/webtty steps: - restore_cache: keys: diff --git a/.gitignore b/.gitignore index faab803..d07d3de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .DS_Store -/webrtty +/webtty coverage.out diff --git a/client.go b/client.go index 3fa5331..b0b3c56 100644 --- a/client.go +++ b/client.go @@ -9,7 +9,7 @@ import ( "syscall" "github.com/kr/pty" - "github.com/maxmcd/webrtty/pkg/sd" + "github.com/maxmcd/webtty/pkg/sd" "github.com/mitchellh/colorstring" "github.com/pions/webrtc" "github.com/pions/webrtc/pkg/datachannel" @@ -156,7 +156,6 @@ func (cs *clientSession) run() (err error) { encodedAnswer := sd.Encode(answerSd) if cs.offer.TenKbSiteLoc == "" { - // Get the LocalDescription and take it to base64 so we can paste in browser fmt.Printf("Answer created. Send the following answer to the host:\n\n") fmt.Println(encodedAnswer) } else { diff --git a/docker-compose.yml b/docker-compose.yml index 0bc90a7..0a971ff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,4 +2,4 @@ version: '3.3' services: app: build: . - image: maxmcd/webrtty-node-go + image: maxmcd/webtty-node-go diff --git a/host.go b/host.go index f2795c3..9d7ddf0 100644 --- a/host.go +++ b/host.go @@ -12,7 +12,7 @@ import ( "time" "github.com/kr/pty" - "github.com/maxmcd/webrtty/pkg/sd" + "github.com/maxmcd/webtty/pkg/sd" "github.com/mitchellh/colorstring" "github.com/pions/webrtc" "github.com/pions/webrtc/pkg/datachannel" @@ -92,7 +92,6 @@ func (hs *hostSession) dataChannelOnOpen() func() { } } - func (hs *hostSession) dataChannelOnMessage() func(payload datachannel.Payload) { return func(payload datachannel.Payload) { @@ -152,7 +151,7 @@ func (hs *hostSession) dataChannelOnMessage() func(payload datachannel.Payload) return } hs.errChan <- fmt.Errorf( - `Unmatched string message: "%s"`, + `Unmatched string message: "%s"`, string(p.Data), ) case *datachannel.PayloadBinary: @@ -163,7 +162,7 @@ func (hs *hostSession) dataChannelOnMessage() func(payload datachannel.Payload) } default: hs.errChan <- fmt.Errorf( - "Message with type %s from DataChannel has no payload", + "Message with type %s from DataChannel has no payload", p.PayloadType().String()) } } @@ -210,11 +209,11 @@ func (hs *hostSession) run() (err error) { if err = hs.init(); err != nil { return } - colorstring.Printf("[bold]Setting up a WebRTTY connection.\n\n") + colorstring.Printf("[bold]Setting up a WebTTY connection.\n\n") if hs.oneWay { colorstring.Printf( "Warning: One-way connections rely on a third party to connect. " + - "More info here: https://github.com/maxmcd/webrtty#one-way-connections\n\n") + "More info here: https://github.com/maxmcd/webtty#one-way-connections\n\n") } if err = hs.createOffer(); err != nil { @@ -224,8 +223,8 @@ func (hs *hostSession) run() (err error) { // Output the offer in base64 so we can paste it in browser colorstring.Printf("[bold]Connection ready. Here is your connection data:\n\n") fmt.Printf("%s\n\n", sd.Encode(hs.offer)) - colorstring.Printf(`[bold]Paste it in the terminal after the webrtty command` + - "\n[bold]Or in a browser: [reset]https://maxmcd.github.io/webrtty/\n\n") + colorstring.Printf(`[bold]Paste it in the terminal after the webtty command` + + "\n[bold]Or in a browser: [reset]https://maxmcd.github.io/webtty/\n\n") if hs.oneWay == false { colorstring.Println("[bold]When you have the answer, paste it below and hit enter:") diff --git a/main.go b/main.go index 8d7fcd1..5a9c9c9 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,7 @@ func main() { _ = flag.Bool("cmd", false, "The command to run. Default is \"bash -l\"\n"+ "Because this flag consumes the remainder of the command line,\n"+ "all other args (if present) must appear before this flag.\n"+ - "eg: webrtty -o -v -ni -cmd docker run -it --rm alpine:latest sh") + "eg: webtty -o -v -ni -cmd docker run -it --rm alpine:latest sh") stunServer := flag.String("s", "stun:stun.l.google.com:19302", "The stun server to use") cmd := []string{"bash", "-l"} diff --git a/readme.md b/readme.md index 81dcf6c..5e2ea4a 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,8 @@ -![](https://maxmcd.github.io/webrtty/out.gif) +![](https://maxmcd.github.io/webtty/out.gif) -# WebRTTY +# WebTTY -WebRTTY 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. WebRTTY also works in-browser. You can connect to a WebRTTY session from this static page: https://maxmcd.github.io/webrtty/ +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/ ### Status @@ -10,20 +10,20 @@ There are a handful of bugs to fix, but everything works pretty well at the mome ### Installation ```bash -go get -u github.com/maxmcd/webrtty +go get -u github.com/maxmcd/webtty ``` -WebRTTY uses the wonderful [pions/webrtc](https://github.com/pions/webrtc) for WebRTC communication. It currently requires OpenSSL to build. More here: https://github.com/pions/webrtc#install +WebTTY uses the wonderful [pions/webrtc](https://github.com/pions/webrtc) for WebRTC communication. It currently requires OpenSSL to build. More here: https://github.com/pions/webrtc#install ### Running ```shell -> webrtty -h -Usage of webrtty: +> 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: webrtty -o -v -ni -cmd docker run -it --rm alpine:latest sh + eg: webtty -o -v -ni -cmd docker run -it --rm alpine:latest sh -ni Set host to non-interactive -non-interactive @@ -34,39 +34,39 @@ Usage of webrtty: ```shell # On the host computer -> webrtty -Setting up a WebRTTY connection. +> webtty +Setting up a WebTTY connection. Connection ready. Here is your connection data: 25FrtDEjh7yuGdWMk7R9PhzPmphst7FdsotL11iXa4r9xyTM4koAauQYivKViWYBskf8habEc5vHf3DZge5VivuAT79uSCvzc6aL2M11kcUn9rzb4DX4... -Paste it in the terminal after the webrtty command -Or in a browser: https://maxmcd.github.io/webrtty/ +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 -webrtty 25FrtDEjh7yuGdWMk7R9PhzPmphst7FdsotL11iXa4r9xyTM4koAauQYivKViWYBskf8habEc5vHf3DZge5VivuAT79uSCvzc6aL2M11kcUn9rzb4DX4... +webtty 25FrtDEjh7yuGdWMk7R9PhzPmphst7FdsotL11iXa4r9xyTM4koAauQYivKViWYBskf8habEc5vHf3DZge5VivuAT79uSCvzc6aL2M11kcUn9rzb4DX4... ``` ### Terminal Size -By default WebRTTY 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: +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 -webrtty -ni -cmd tmux attach-session -t shared +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, WebRTTY 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. +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 WebRTTY connection string on error and allow anyone to attach to the session. +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. diff --git a/session.go b/session.go index fe642c3..299f6a0 100644 --- a/session.go +++ b/session.go @@ -4,7 +4,7 @@ import ( "log" "os" - "github.com/maxmcd/webrtty/pkg/sd" + "github.com/maxmcd/webtty/pkg/sd" "github.com/pions/webrtc" "github.com/pions/webrtc/pkg/datachannel" "github.com/pions/webrtc/pkg/ice" diff --git a/web-client/package.json b/web-client/package.json index 6b86786..13d2f5a 100644 --- a/web-client/package.json +++ b/web-client/package.json @@ -1,11 +1,12 @@ { - "name": "webrtty", + "name": "webtty", "version": "0.0.1", "description": "", "main": "app.js", "scripts": { "build": "npm run go-build && parcel build src/index.html --public-url .", - "go-build": "mkdir -p ./dist/ && touch ./dist/foo && rm ./dist/* && GOOS=js GOARCH=wasm go build -o ./dist/main.wasm ./src", + "go-build": + "mkdir -p ./dist/ && touch ./dist/foo && rm ./dist/* && GOOS=js GOARCH=wasm go build -o ./dist/main.wasm ./src", "serve": "parcel serve src/index.html", "test": "echo notests", "deploy": "npm run build && gh-pages -d dist" diff --git a/web-client/src/app.ts b/web-client/src/app.ts index b023cf7..34eba62 100644 --- a/web-client/src/app.ts +++ b/web-client/src/app.ts @@ -62,7 +62,7 @@ term.fit(); window.onresize = () => { term.fit(); }; -term.write("Welcome to the WebRTTY web client.\n\r"); +term.write("Welcome to the WebTTY web client.\n\r"); let pc = new RTCPeerConnection({ iceServers: [ @@ -136,7 +136,7 @@ if (urlData != "") { } if (firstInput == false) { - term.write("Run webrtty and paste the offer message below:\n\r"); + term.write("Run webtty and paste the offer message below:\n\r"); } term.on("data", data => { diff --git a/web-client/src/main.go b/web-client/src/main.go index fc3e897..d19902d 100644 --- a/web-client/src/main.go +++ b/web-client/src/main.go @@ -3,7 +3,7 @@ package main import ( "syscall/js" - "github.com/maxmcd/webrtty/pkg/sd" + "github.com/maxmcd/webtty/pkg/sd" ) func main() {