[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/main] Add proxy event logger state propagate



commit f12cfe6a9f682c479314440ac9d53389cb38a54f
Author: Shelikhoo <xiaokangwang@xxxxxxxxxxx>
Date:   Mon Dec 20 13:45:53 2021 +0000

    Add proxy event logger state propagate
---
 proxy/lib/snowflake.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go
index cef5644..8747f66 100644
--- a/proxy/lib/snowflake.go
+++ b/proxy/lib/snowflake.go
@@ -115,6 +115,7 @@ type SnowflakeProxy struct {
 	NATProbeURL string
 	// NATTypeMeasurementInterval is time before NAT type is retested
 	NATTypeMeasurementInterval time.Duration
+	EventDispatcher            event.SnowflakeEventDispatcher
 	shutdown                   chan struct{}
 }
 
@@ -340,7 +341,7 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer(sdp *webrtc.SessionDescrip
 		close(dataChan)
 
 		pr, pw := io.Pipe()
-		conn := &webRTCConn{pc: pc, dc: dc, pr: pr}
+		conn := &webRTCConn{pc: pc, dc: dc, pr: pr, eventLogger: sf.EventDispatcher}
 		conn.bytesLogger = newBytesSyncLogger()
 
 		dc.OnOpen(func() {
@@ -524,6 +525,9 @@ func (sf *SnowflakeProxy) Start() error {
 	if sf.NATProbeURL == "" {
 		sf.NATProbeURL = DefaultNATProbeURL
 	}
+	if sf.EventDispatcher == nil {
+		sf.EventDispatcher = event.NewSnowflakeEventDispatcher()
+	}
 
 	broker, err = newSignalingServer(sf.BrokerURL, sf.KeepLocalAddresses)
 	if err != nil {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits