diff options
author | Cecylia Bocovich <cohosh@torproject.org> | 2023-10-30 12:37:56 -0400 |
---|---|---|
committer | Cecylia Bocovich <cohosh@torproject.org> | 2023-10-30 12:42:45 -0400 |
commit | 5c5eb2c339f15283094576cba0f8b1083b451c82 (patch) | |
tree | f1078631b816e04cb97cab1d886f3676fd51baf7 /common | |
parent | 018bbd6d657a891429c8777583ae6bec3981d99a (diff) | |
download | snowflake-5c5eb2c339f15283094576cba0f8b1083b451c82.tar.gz snowflake-5c5eb2c339f15283094576cba0f8b1083b451c82.zip |
Modify EventOnProxyStats to include summary data
Diffstat (limited to 'common')
-rw-r--r-- | common/event/interface.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/common/event/interface.go b/common/event/interface.go index d54e9d3..c01b462 100644 --- a/common/event/interface.go +++ b/common/event/interface.go @@ -2,6 +2,7 @@ package event import ( "fmt" + "time" "github.com/pion/webrtc/v3" "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/safelog" @@ -78,11 +79,16 @@ func (e EventOnProxyConnectionOver) String() string { type EventOnProxyStats struct { SnowflakeEvent - StatString string + ConnectionCount int + InboundBytes, OutboundBytes int64 + InboundUnit, OutboundUnit string + SummaryInterval time.Duration } func (e EventOnProxyStats) String() string { - return e.StatString + statString := fmt.Sprintf("In the last %v, there were %v completed connections. Traffic Relayed ↓ %v %v, ↑ %v %v.", + e.SummaryInterval.String(), e.ConnectionCount, e.InboundBytes, e.InboundUnit, e.OutboundBytes, e.OutboundUnit) + return statString } type EventOnCurrentNATTypeDetermined struct { |