mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
client multiplexes AND recovers correctly! (close #31)
- stabilize rest of WebRTCPeer - use uid for the datachannel label - store a consistent WebRTC config in the dialer
This commit is contained in:
parent
2bf0e5457e
commit
e93c38f834
8 changed files with 50 additions and 35 deletions
|
@ -115,17 +115,19 @@ func (bc *BrokerChannel) Negotiate(offer *webrtc.SessionDescription) (
|
|||
// Implements the |Tongue| interface to catch snowflakes, using BrokerChannel.
|
||||
type WebRTCDialer struct {
|
||||
*BrokerChannel
|
||||
// webrtcConfig *webrtc.Configuration
|
||||
iceServers IceServerList
|
||||
webrtcConfig *webrtc.Configuration
|
||||
}
|
||||
|
||||
func NewWebRTCDialer(
|
||||
broker *BrokerChannel, iceServers IceServerList) *WebRTCDialer {
|
||||
|
||||
config := webrtc.NewConfiguration(iceServers...)
|
||||
if nil == config {
|
||||
log.Println("Unable to prepare WebRTC configuration.")
|
||||
return nil
|
||||
}
|
||||
return &WebRTCDialer{
|
||||
BrokerChannel: broker,
|
||||
iceServers: iceServers,
|
||||
// webrtcConfig: config,
|
||||
webrtcConfig: config,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,8 +138,7 @@ func (w WebRTCDialer) Catch() (Snowflake, error) {
|
|||
}
|
||||
// TODO: [#3] Fetch ICE server information from Broker.
|
||||
// TODO: [#18] Consider TURN servers here too.
|
||||
config := webrtc.NewConfiguration(w.iceServers...)
|
||||
connection := NewWebRTCConnection(config, w.BrokerChannel)
|
||||
connection := NewWebRTCConnection(w.webrtcConfig, w.BrokerChannel)
|
||||
err := connection.Connect()
|
||||
return connection, err
|
||||
}
|
||||
|
@ -149,7 +150,7 @@ func (w WebRTCDialer) Catch() (Snowflake, error) {
|
|||
type CopyPasteDialer struct {
|
||||
webrtcConfig *webrtc.Configuration
|
||||
signal *os.File
|
||||
current *webRTCConn
|
||||
current *WebRTCPeer
|
||||
}
|
||||
|
||||
func NewCopyPasteDialer(iceServers IceServerList) *CopyPasteDialer {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue