提交 a8330f1f 作者: Jeromy 提交者: Juan Batiz-Benet

add methods on net interface to retrieve bandwidth values

上级 afe85ce1
...@@ -29,6 +29,10 @@ type Network interface { ...@@ -29,6 +29,10 @@ type Network interface {
// GetPeerList returns the list of peers currently connected in this network. // GetPeerList returns the list of peers currently connected in this network.
GetPeerList() []*peer.Peer 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 sends given Message out
SendMessage(msg.NetMessage) error SendMessage(msg.NetMessage) error
......
...@@ -111,3 +111,7 @@ func (n *IpfsNetwork) Close() error { ...@@ -111,3 +111,7 @@ func (n *IpfsNetwork) Close() error {
func (n *IpfsNetwork) GetPeerList() []*peer.Peer { func (n *IpfsNetwork) GetPeerList() []*peer.Peer {
return n.swarm.GetPeerList() return n.swarm.GetPeerList()
} }
func (n *IpfsNetwork) GetBandwidthTotals() (in uint64, out uint64) {
return n.muxer.GetBandwidthTotals()
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论