mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Add Propagate EventLogger Setting
This commit is contained in:
parent
8d2f662c8c
commit
7536dd6fb7
2 changed files with 12 additions and 3 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"git.torproject.org/pluggable-transports/snowflake.git/v2/common/event"
|
||||
"git.torproject.org/pluggable-transports/snowflake.git/v2/common/messages"
|
||||
"git.torproject.org/pluggable-transports/snowflake.git/v2/common/nat"
|
||||
"git.torproject.org/pluggable-transports/snowflake.git/v2/common/util"
|
||||
|
@ -141,10 +142,16 @@ type WebRTCDialer struct {
|
|||
*BrokerChannel
|
||||
webrtcConfig *webrtc.Configuration
|
||||
max int
|
||||
|
||||
eventLogger event.SnowflakeEventReceiver
|
||||
}
|
||||
|
||||
// NewWebRTCDialer constructs a new WebRTCDialer.
|
||||
func NewWebRTCDialer(broker *BrokerChannel, iceServers []webrtc.ICEServer, max int) *WebRTCDialer {
|
||||
return NewWebRTCDialer4E(broker, iceServers, max, nil)
|
||||
}
|
||||
|
||||
// NewWebRTCDialer4E constructs a new WebRTCDialer.
|
||||
func NewWebRTCDialer4E(broker *BrokerChannel, iceServers []webrtc.ICEServer, max int, eventLogger event.SnowflakeEventReceiver) *WebRTCDialer {
|
||||
config := webrtc.Configuration{
|
||||
ICEServers: iceServers,
|
||||
}
|
||||
|
@ -153,6 +160,8 @@ func NewWebRTCDialer(broker *BrokerChannel, iceServers []webrtc.ICEServer, max i
|
|||
BrokerChannel: broker,
|
||||
webrtcConfig: &config,
|
||||
max: max,
|
||||
|
||||
eventLogger: eventLogger,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +169,7 @@ func NewWebRTCDialer(broker *BrokerChannel, iceServers []webrtc.ICEServer, max i
|
|||
func (w WebRTCDialer) Catch() (*WebRTCPeer, error) {
|
||||
// TODO: [#25591] Fetch ICE server information from Broker.
|
||||
// TODO: [#25596] Consider TURN servers here too.
|
||||
return NewWebRTCPeer(w.webrtcConfig, w.BrokerChannel)
|
||||
return NewWebRTCPeer3E(w.webrtcConfig, w.BrokerChannel, w.eventLogger)
|
||||
}
|
||||
|
||||
// GetMax returns the maximum number of snowflakes to collect.
|
||||
|
|
|
@ -135,7 +135,7 @@ func NewSnowflakeClient(config ClientConfig) (*Transport, error) {
|
|||
if config.Max > max {
|
||||
max = config.Max
|
||||
}
|
||||
transport := &Transport{dialer: NewWebRTCDialer(broker, iceServers, max)}
|
||||
transport := &Transport{dialer: NewWebRTCDialer4E(broker, iceServers, max, config.EventDispatcher)}
|
||||
|
||||
return transport, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue