aboutsummaryrefslogtreecommitdiffstats
path: root/ethpub/pub.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethpub/pub.go')
-rw-r--r--ethpub/pub.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/ethpub/pub.go b/ethpub/pub.go
index a9a962f14..6d4c230ad 100644
--- a/ethpub/pub.go
+++ b/ethpub/pub.go
@@ -6,6 +6,7 @@ import (
"github.com/ethereum/eth-go/ethutil"
"math/big"
"strings"
+ "sync/atomic"
)
type PEthereum struct {
@@ -51,6 +52,18 @@ func (lib *PEthereum) GetPeerCount() int {
return lib.manager.PeerCount()
}
+func (lib *PEthereum) GetPeers() []PPeer {
+ var peers []PPeer
+ for peer := lib.manager.Peers().Front(); peer != nil; peer = peer.Next() {
+ p := peer.Value.(ethchain.Peer)
+ if atomic.LoadInt32(p.Connected()) != 0 {
+ peers = append(peers, *NewPPeer(p))
+ }
+ }
+
+ return peers
+}
+
func (lib *PEthereum) GetIsMining() bool {
return lib.manager.IsMining()
}