[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [snowflake/main] Add Propagate EventLogger Setting
commit 7536dd6fb75697bdc85c10e0be6ed0829a338155
Author: Shelikhoo <xiaokangwang@xxxxxxxxxxx>
Date: Mon Dec 13 16:29:10 2021 +0000
Add Propagate EventLogger Setting
---
client/lib/rendezvous.go | 13 +++++++++++--
client/lib/snowflake.go | 2 +-
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/client/lib/rendezvous.go b/client/lib/rendezvous.go
index c3f0d7a..4c2b240 100644
--- a/client/lib/rendezvous.go
+++ b/client/lib/rendezvous.go
@@ -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.
diff --git a/client/lib/snowflake.go b/client/lib/snowflake.go
index fdcb457..4f9e663 100644
--- a/client/lib/snowflake.go
+++ b/client/lib/snowflake.go
@@ -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
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits