@cryptotaxi247 / kubo / commits / a8330f1f6

add methods on net interface to retrieve bandwidth values

Jeromy committed Oct 13, 2014 at 10:44 UTC a8330f1f623b2a46ab73f755e61d105bdefa9d3b
2 files changed +8
net/interface.go
+4
@@ -29,6 +29,10 @@ type Network interface {
29 // GetPeerList returns the list of peers currently connected in this network.
30 GetPeerList() []*peer.Peer
31
32 + // GetBandwidthTotals returns the total number of bytes passed through
33 + // the network since it was instantiated
34 + GetBandwidthTotals() (uint64, uint64)
35 +
36 // SendMessage sends given Message out
37 SendMessage(msg.NetMessage) error
38
net/net.go
+4
@@ -111,3 +111,7 @@ func (n *IpfsNetwork) Close() error {
111 func (n *IpfsNetwork) GetPeerList() []*peer.Peer {
112 return n.swarm.GetPeerList()
113 }
114 +
115 +func (n *IpfsNetwork) GetBandwidthTotals() (in uint64, out uint64) {
116 + return n.muxer.GetBandwidthTotals()
117 +}