commit 91379a42f3c9c36a09c8cfd0769bffed626ffe46 Author: Shelikhoo <xiaokangw...@outlook.com> Date: Mon Dec 20 12:29:23 2021 +0000
Add Raw Data Output for bytesLogger --- proxy/lib/util.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proxy/lib/util.go b/proxy/lib/util.go index 5055187..a9ac8aa 100644 --- a/proxy/lib/util.go +++ b/proxy/lib/util.go @@ -11,6 +11,7 @@ type bytesLogger interface { AddOutbound(int) AddInbound(int) ThroughputSummary() string + GetStat() (in int, out int) } // bytesNullLogger Default bytesLogger does nothing. @@ -25,6 +26,8 @@ func (b bytesNullLogger) AddInbound(amount int) {} // ThroughputSummary in bytesNullLogger does nothing func (b bytesNullLogger) ThroughputSummary() string { return "" } +func (b bytesNullLogger) GetStat() (in int, out int) { return -1, -1 } + // bytesSyncLogger uses channels to safely log from multiple sources with output // occuring at reasonable intervals. type bytesSyncLogger struct { @@ -92,3 +95,5 @@ func (b *bytesSyncLogger) ThroughputSummary() string { t := time.Now() return fmt.Sprintf("Traffic throughput (up|down): %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 int, out int) { return b.inbound, b.outbound } _______________________________________________ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits