diff --git a/.circleci/config.yml b/.circleci/config.yml index 1bf4d74..4677092 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,8 +15,12 @@ jobs: name: run go tests command: | set -e - go get -v . - go get golang.org/x/lint/golint + go get -u github.com/mitchellh/colorstring + go get -u github.com/pions/webrtc + go get -u github.com/kr/pty + go get -u golang.org/x/crypto/ssh/terminal + go get -u github.com/btcsuite/btcutil/base58 + go get -u golang.org/x/lint/golint golint go test go test ./pkg/sd diff --git a/client.go b/client.go index b0b3c56..d2b0b1f 100644 --- a/client.go +++ b/client.go @@ -110,10 +110,8 @@ func (cs *clientSession) run() (err error) { return } - cs.dc.Lock() - cs.dc.OnOpen = cs.dataChannelOnOpen() - cs.dc.Onmessage = cs.dataChannelOnMessage() - cs.dc.Unlock() + cs.dc.OnOpen(cs.dataChannelOnOpen()) + cs.dc.OnMessage(cs.dataChannelOnMessage()) if cs.offer, err = sd.Decode(cs.offerString); err != nil { log.Println(err) diff --git a/host.go b/host.go index 9d7ddf0..0c2df6f 100644 --- a/host.go +++ b/host.go @@ -171,10 +171,8 @@ func (hs *hostSession) dataChannelOnMessage() func(payload datachannel.Payload) func (hs *hostSession) onDataChannel() func(dc *webrtc.RTCDataChannel) { return func(dc *webrtc.RTCDataChannel) { hs.dc = dc - dc.Lock() - defer dc.Unlock() - dc.OnOpen = hs.dataChannelOnOpen() - dc.Onmessage = hs.dataChannelOnMessage() + dc.OnOpen(hs.dataChannelOnOpen()) + dc.OnMessage(hs.dataChannelOnMessage()) } } @@ -186,7 +184,7 @@ func (hs *hostSession) mustReadStdin() (string, error) { } func (hs *hostSession) createOffer() (err error) { - hs.pc.OnDataChannel = hs.onDataChannel() + hs.pc.OnDataChannel(hs.onDataChannel()) // Create an offer to send to the browser offer, err := hs.pc.CreateOffer(nil) diff --git a/readme.md b/readme.md index f4c6ce8..f56e232 100644 --- a/readme.md +++ b/readme.md @@ -17,6 +17,8 @@ go get -u github.com/maxmcd/webtty ``` 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](https://github.com/pions/webrtc#install) +There were recent breaking api changes in the pions/webrtc library. Make sure to run `go get -u github.com/pions/webrtc` if you're running into any installation errors. + ### Running ```shell @@ -80,4 +82,3 @@ I think this somewhat violates the spirit of this tool because it relies on a th 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. - diff --git a/session.go b/session.go index 299f6a0..b77df4c 100644 --- a/session.go +++ b/session.go @@ -80,8 +80,8 @@ func (s *session) createPeerConnection() (err error) { // if s.pc.OnDataChannel == nil { // return errors.New("Couldn't create a peerConnection") // } - s.pc.OnICEConnectionStateChange = func(connectionState ice.ConnectionState) { + s.pc.OnICEConnectionStateChange(func(connectionState ice.ConnectionState) { log.Printf("ICE Connection State has changed: %s\n", connectionState.String()) - } + }) return }