Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
faab9842
Commit
faab9842
authored
Nov 18, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: expose GetConnections
parent
21d2838d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
net/interface.go
net/interface.go
+4
-0
net/net.go
net/net.go
+6
-0
No files found.
net/interface.go
View file @
faab9842
...
@@ -2,6 +2,7 @@ package net
...
@@ -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 {
...
@@ -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
)
...
...
net/net.go
View file @
faab9842
...
@@ -2,6 +2,7 @@
...
@@ -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 {
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment