commit e4305a4d2b01f248f70546f745f64b3373f84a2e Author: Shelikhoo xiaokangwang@outlook.com Date: Mon Dec 20 13:36:22 2021 +0000
Add EventOnProxyConnectionOver Reporting --- proxy/lib/snowflake.go | 6 ++++++ proxy/lib/webrtcconn.go | 2 ++ 2 files changed, 8 insertions(+)
diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go index a9ac399..cef5644 100644 --- a/proxy/lib/snowflake.go +++ b/proxy/lib/snowflake.go @@ -40,6 +40,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/task" "git.torproject.org/pluggable-transports/snowflake.git/v2/common/util" @@ -350,6 +351,11 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer(sdp *webrtc.SessionDescrip defer conn.lock.Unlock() log.Println("OnClose channel") log.Println(conn.bytesLogger.ThroughputSummary()) + in, out := conn.bytesLogger.GetStat() + conn.eventLogger.OnNewSnowflakeEvent(event.EventOnProxyConnectionOver{ + InboundTraffic: in, + OutboundTraffic: out, + }) conn.dc = nil dc.Close() pw.Close() diff --git a/proxy/lib/webrtcconn.go b/proxy/lib/webrtcconn.go index 6e16bec..919a679 100644 --- a/proxy/lib/webrtcconn.go +++ b/proxy/lib/webrtcconn.go @@ -9,6 +9,7 @@ import ( "sync" "time"
+ "git.torproject.org/pluggable-transports/snowflake.git/v2/common/event" "github.com/pion/ice/v2" "github.com/pion/sdp/v3" "github.com/pion/webrtc/v3" @@ -30,6 +31,7 @@ type webRTCConn struct { once sync.Once // Synchronization for PeerConnection destruction
bytesLogger bytesLogger + eventLogger event.SnowflakeEventReceiver }
func (c *webRTCConn) Read(b []byte) (int, error) {
tor-commits@lists.torproject.org