diff options
author | Cecylia Bocovich <cohosh@torproject.org> | 2023-10-28 13:11:51 -0400 |
---|---|---|
committer | Cecylia Bocovich <cohosh@torproject.org> | 2023-10-30 12:42:45 -0400 |
commit | 939062c7dd31d80292015fff4b4c13234c85f6ba (patch) | |
tree | f7a516e153b4fe2858dc501aa7c6d2c5c822b8cb | |
parent | 10fb9afaa7c269831258b2201a7c01fe424da638 (diff) | |
download | snowflake-939062c7dd31d80292015fff4b4c13234c85f6ba.tar.gz snowflake-939062c7dd31d80292015fff4b4c13234c85f6ba.zip |
Remove ThroughputSummary from bytesLogger
This was leftover from when we used to log the total throughput of
connections when they close. It should be removed for privacy reasons as
mentioned in
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40079
-rw-r--r-- | proxy/lib/snowflake.go | 1 | ||||
-rw-r--r-- | proxy/lib/util.go | 17 |
2 files changed, 0 insertions, 18 deletions
diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go index 243b49d..53a502d 100644 --- a/proxy/lib/snowflake.go +++ b/proxy/lib/snowflake.go @@ -438,7 +438,6 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer(sdp *webrtc.SessionDescrip conn.lock.Lock() defer conn.lock.Unlock() log.Printf("Data Channel %s-%d close\n", dc.Label(), dc.ID()) - log.Println(conn.bytesLogger.ThroughputSummary()) in, out := conn.bytesLogger.GetStat() conn.eventLogger.OnNewSnowflakeEvent(event.EventOnProxyConnectionOver{ InboundTraffic: in, diff --git a/proxy/lib/util.go b/proxy/lib/util.go index dd8681e..bb678d8 100644 --- a/proxy/lib/util.go +++ b/proxy/lib/util.go @@ -1,7 +1,6 @@ package snowflake_proxy import ( - "fmt" "time" ) @@ -10,7 +9,6 @@ import ( type bytesLogger interface { AddOutbound(int64) AddInbound(int64) - ThroughputSummary() string GetStat() (in int64, out int64) } @@ -23,9 +21,6 @@ func (b bytesNullLogger) AddOutbound(amount int64) {} // AddInbound in bytesNullLogger does nothing func (b bytesNullLogger) AddInbound(amount int64) {} -// ThroughputSummary in bytesNullLogger does nothing -func (b bytesNullLogger) ThroughputSummary() string { return "" } - func (b bytesNullLogger) GetStat() (in int64, out int64) { return -1, -1 } // bytesSyncLogger uses channels to safely log from multiple sources with output @@ -71,18 +66,6 @@ func (b *bytesSyncLogger) AddInbound(amount int64) { b.inboundChan <- amount } -// ThroughputSummary view a formatted summary of the throughput totals -func (b *bytesSyncLogger) ThroughputSummary() string { - inbound := b.inbound - outbound := b.outbound - - inbound, inUnit := formatTraffic(inbound) - outbound, outUnit := formatTraffic(outbound) - - t := time.Now() - return fmt.Sprintf("Traffic throughput (down|up): %d %s|%d %s -- (%d OnMessages, %d Sends, over %d seconds)", inbound, inUnit, outbound, outUnit, b.outEvents, b.inEvents, int(t.Sub(b.start).Seconds())) -} - func (b *bytesSyncLogger) GetStat() (in int64, out int64) { return b.inbound, b.outbound } func formatTraffic(amount int64) (value int64, unit string) { return amount / 1000, "KB" } |