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
This commit is contained in:
Cecylia Bocovich 2023-10-28 13:11:51 -04:00
parent 10fb9afaa7
commit 939062c7dd
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90
2 changed files with 0 additions and 18 deletions

View file

@ -438,7 +438,6 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer(sdp *webrtc.SessionDescrip
conn.lock.Lock() conn.lock.Lock()
defer conn.lock.Unlock() defer conn.lock.Unlock()
log.Printf("Data Channel %s-%d close\n", dc.Label(), dc.ID()) log.Printf("Data Channel %s-%d close\n", dc.Label(), dc.ID())
log.Println(conn.bytesLogger.ThroughputSummary())
in, out := conn.bytesLogger.GetStat() in, out := conn.bytesLogger.GetStat()
conn.eventLogger.OnNewSnowflakeEvent(event.EventOnProxyConnectionOver{ conn.eventLogger.OnNewSnowflakeEvent(event.EventOnProxyConnectionOver{
InboundTraffic: in, InboundTraffic: in,

View file

@ -1,7 +1,6 @@
package snowflake_proxy package snowflake_proxy
import ( import (
"fmt"
"time" "time"
) )
@ -10,7 +9,6 @@ import (
type bytesLogger interface { type bytesLogger interface {
AddOutbound(int64) AddOutbound(int64)
AddInbound(int64) AddInbound(int64)
ThroughputSummary() string
GetStat() (in int64, out int64) GetStat() (in int64, out int64)
} }
@ -23,9 +21,6 @@ func (b bytesNullLogger) AddOutbound(amount int64) {}
// AddInbound in bytesNullLogger does nothing // AddInbound in bytesNullLogger does nothing
func (b bytesNullLogger) AddInbound(amount int64) {} 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 } func (b bytesNullLogger) GetStat() (in int64, out int64) { return -1, -1 }
// bytesSyncLogger uses channels to safely log from multiple sources with output // bytesSyncLogger uses channels to safely log from multiple sources with output
@ -71,18 +66,6 @@ func (b *bytesSyncLogger) AddInbound(amount int64) {
b.inboundChan <- amount 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 (b *bytesSyncLogger) GetStat() (in int64, out int64) { return b.inbound, b.outbound }
func formatTraffic(amount int64) (value int64, unit string) { return amount / 1000, "KB" } func formatTraffic(amount int64) (value int64, unit string) { return amount / 1000, "KB" }