Skip to content

Commit

Permalink
add methods on net interface to retrieve bandwidth values
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Oct 13, 2014
1 parent e868af7 commit 0d996bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions net/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

0 comments on commit 0d996bd

Please sign in to comment.