conn_stats.go | 5 +++++ diff --git a/conn_stats.go b/conn_stats.go index a691fb342f24bbe30fac479840097c8901e5dd5c..06ec23f2cb6eed31c149f65629180bb673bad82e 100644 --- a/conn_stats.go +++ b/conn_stats.go @@ -5,6 +5,7 @@ "fmt" "io" "reflect" "sync/atomic" + "encoding/json" pp "github.com/anacrolix/torrent/peer_protocol" ) @@ -63,6 +64,10 @@ } func (me *Count) String() string { return fmt.Sprintf("%v", me.Int64()) +} + +func (me *Count) MarshalJSON() ([]byte, error) { + return json.Marshal(me.n) } func (cs *ConnStats) wroteMsg(msg *pp.Message) {