From 0d996bd7c2421ec670975a561b9aeeb0893ccf7c Mon Sep 17 00:00:00 2001 From: Jeromy Date: Mon, 13 Oct 2014 10:44:57 -0700 Subject: [PATCH] add methods on net interface to retrieve bandwidth values --- net/interface.go | 4 ++++ net/net.go | 4 ++++ 2 files changed, 8 insertions(+) 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() +}