diff --git a/net/interface.go b/net/interface.go index dee1460fc818..379d01968052 100644 --- a/net/interface.go +++ b/net/interface.go @@ -29,6 +29,10 @@ type Network interface { // GetPeerList returns the list of peers currently connected in this network. GetPeerList() []*peer.Peer + // GetBandwidthTotals returns the total number of bytes passed through + // the network since it was instantiated + GetBandwidthTotals() (uint64, uint64) + // SendMessage sends given Message out SendMessage(msg.NetMessage) error diff --git a/net/net.go b/net/net.go index b5864fe68a60..9ec7d2982d40 100644 --- a/net/net.go +++ b/net/net.go @@ -111,3 +111,7 @@ func (n *IpfsNetwork) Close() error { func (n *IpfsNetwork) GetPeerList() []*peer.Peer { return n.swarm.GetPeerList() } + +func (n *IpfsNetwork) GetBandwidthTotals() (in uint64, out uint64) { + return n.muxer.GetBandwidthTotals() +}