mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 10:49:24 +08:00
net: expose GetConnections
This commit is contained in:
@ -2,6 +2,7 @@ package net
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
||||||
|
conn "github.com/jbenet/go-ipfs/net/conn"
|
||||||
msg "github.com/jbenet/go-ipfs/net/message"
|
msg "github.com/jbenet/go-ipfs/net/message"
|
||||||
mux "github.com/jbenet/go-ipfs/net/mux"
|
mux "github.com/jbenet/go-ipfs/net/mux"
|
||||||
srv "github.com/jbenet/go-ipfs/net/service"
|
srv "github.com/jbenet/go-ipfs/net/service"
|
||||||
@ -34,6 +35,9 @@ 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
|
||||||
|
|
||||||
|
// GetConnections returns the list of connections currently open in this network.
|
||||||
|
GetConnections() []conn.Conn
|
||||||
|
|
||||||
// GetBandwidthTotals returns the total number of bytes passed through
|
// GetBandwidthTotals returns the total number of bytes passed through
|
||||||
// the network since it was instantiated
|
// the network since it was instantiated
|
||||||
GetBandwidthTotals() (uint64, uint64)
|
GetBandwidthTotals() (uint64, uint64)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
conn "github.com/jbenet/go-ipfs/net/conn"
|
||||||
msg "github.com/jbenet/go-ipfs/net/message"
|
msg "github.com/jbenet/go-ipfs/net/message"
|
||||||
mux "github.com/jbenet/go-ipfs/net/mux"
|
mux "github.com/jbenet/go-ipfs/net/mux"
|
||||||
swarm "github.com/jbenet/go-ipfs/net/swarm"
|
swarm "github.com/jbenet/go-ipfs/net/swarm"
|
||||||
@ -99,6 +100,11 @@ func (n *IpfsNetwork) GetPeerList() []peer.Peer {
|
|||||||
return n.swarm.GetPeerList()
|
return n.swarm.GetPeerList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetConnections returns the networks list of open connections
|
||||||
|
func (n *IpfsNetwork) GetConnections() []conn.Conn {
|
||||||
|
return n.swarm.Connections()
|
||||||
|
}
|
||||||
|
|
||||||
// GetBandwidthTotals returns the total amount of bandwidth transferred
|
// GetBandwidthTotals returns the total amount of bandwidth transferred
|
||||||
func (n *IpfsNetwork) GetBandwidthTotals() (in uint64, out uint64) {
|
func (n *IpfsNetwork) GetBandwidthTotals() (in uint64, out uint64) {
|
||||||
return n.muxer.GetBandwidthTotals()
|
return n.muxer.GetBandwidthTotals()
|
||||||
|
Reference in New Issue
Block a user