Commit graph

23 commits

Author SHA1 Message Date
David Fifield
81d14ad33a Make WebRTCPeer.preparePeerConnection block.
Formerly, preparePeerConnection set up a callback that sent into a
channel, and exchangeSDP waited until it could receive from the channel.
We can move the channel entirely into preparePeerConnection (having it
not return until the callback has been called) and that way remove some
shared state.
2020-04-27 18:48:00 -06:00
David Fifield
5787d5b8b0 Simplify WebRTCPeer.exchangeSDP.
No need to run sendOfferToBroker in a goroutine.
2020-04-27 18:48:00 -06:00
David Fifield
8caa737700 Remove SnowflakeDataChannel interface.
Use *webrtc.DataChannel directly.
2020-04-27 18:48:00 -06:00
David Fifield
32207d6f06 Eliminate separate WebRTCPeer.Connect method.
Do it as a side effect of NewWebRTCPeer.

Remove WebRTCPeer tests as they currently require invasively modifying
internal fields at different stages of construction.
2020-04-27 18:47:59 -06:00
David Fifield
76732155e7 Remove Snowflake interface, use *WebRTCPeer directly.
The other interfaces in client/lib/interfaces.go exist for the purpose
of running tests, but not Snowflake. Existing code would not have worked
with other types anyway, because it does unchecked .(*WebRTCPeer)
conversions.
2020-04-27 17:51:21 -06:00
David Fifield
d9b076c32e Don't do a separate check for a short write.
A short write will result in a non-nil error. It's an io.PipeWriter
anyway, which blocks until all the data has been read or the read end is
closed, in which case it returns io.ErrClosedPipe if not some other
error.
2020-04-27 17:49:38 -06:00
David Fifield
51bb49fa6f Move pc.CreateOffer/pc.SetLocalDescription out of a goroutine.
This allows us to remove the internal errorChannel.
2020-04-27 17:47:14 -06:00
David Fifield
17c0d0ff82 Remove unused Resetter interface.
WaitForReset is not used since 70126177fb.
2020-04-24 13:31:04 -06:00
David Fifield
6c2e3adc41 Disable trickle ICE.
https://bugs.torproject.org/33984

OnICEGatheringStateChange is no longer called when candidate gathering
is complete. SetLocalDescription kicks off the gathering process.

https://bugs.torproject.org/28942#comment:28
https://bugs.torproject.org/33157#comment:2
2020-04-24 10:38:27 -06:00
David Fifield
d376d7036b Make WebRTCPeer and Peers not inherit the methods of BytesLogger.
You would have been able to do, for example,
snowflake.(*WebRTCPeer).AddInbound(...).
2020-04-23 21:38:44 -06:00
David Fifield
65ecb798ca Update a comment (no signal pipe anymore). 2020-04-23 20:36:55 -06:00
David Fifield
8eef3b6348 Remove uniuri dependency.
https://bugs.torproject.org/33800
2020-04-03 17:52:44 -06:00
Cecylia Bocovich
920f6791f3 Add a go.mod and go.sum for snowflake 2020-03-05 09:21:17 -05:00
David Fifield
a2292ce35b Make timeout constants into time.Duration values.
This slightly changes some log messages.
2020-01-31 00:08:50 -07:00
Shane Howearth
8bbdb3b51a Bring code into line with Golangci-lint linters
- Error strings are no longer capitalized nor end with punctuation
- Alias import
- Remove extraneous initilisation code (No need to provide zero value
	for variables, because the compiler does that anyway)
2019-10-08 10:25:44 -04:00
Shane Howearth
b26c7a7a73 Handle generated errors in client 2019-10-08 10:25:44 -04:00
Cecylia Bocovich
82e5753bcc Reverted logging changes that require Go 1.13 2019-10-08 09:58:12 -04:00
Cecylia Bocovich
2b04357550 Connect pion library logger with snowflake log
We need to set up the pion/webrtc logger to write output to the
snowflake log, otherwise the warnings we are getting from the pion
library are being lost.

Note: this requires go version 1.13 and later in order to use the
`log.Writer()` function.
2019-10-08 09:27:52 -04:00
Cecylia Bocovich
b5c50b69d0 Ported snowflake client to work with pion/webrtc
Modified the snowflake client to use pion/webrtc as the webrtc library.
This involved a few small changes to match function signatures as well
as several larger ones:
- OnNegotiationNeeded is no longer supported, so CreateOffer and
SetLocalDescription have been moved to a go routine called after the
other peer connection callbacks are set
- We need our own deserialize/serialize functions
- We need to use a SettingEngine in order to access the
OnICEGatheringStateChange callback
2019-10-08 09:27:52 -04:00
Arlo Breault
5380aaca8c Use OnIceGatheringStateChange instead of OnIceComplete in client
Amounts to the same thing as currently implemented in go-webrtc
2019-05-21 14:34:40 -04:00
Arlo Breault
622005c79e Remove copy/paste signalling 2019-05-08 11:21:56 -04:00
Cecylia Bocovich
3eb9064438 Removed unecessary output from logs
Removed raw bytes of ICE answers from broker logs and the SDP stanzas
from the client logs
2019-03-25 15:15:22 -04:00
Arlo Breault
cce7ee64a7 Start refactoring out a client and library 2018-11-20 22:38:02 -05:00
Renamed from client/webrtc.go (Browse further)