aboutsummaryrefslogtreecommitdiffstats
path: root/ethpipe
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-09-26 19:45:26 +0800
committerobscuren <geffobscura@gmail.com>2014-09-26 19:45:26 +0800
commitb8354124bebcd3988afd2f41c320f834a69b949e (patch)
treed25f8e2e382ff86f2157ade522a46baba8adea30 /ethpipe
parent68119d0929adebdbd39dd40982264f86164bd6e6 (diff)
downloadgo-tangerine-b8354124bebcd3988afd2f41c320f834a69b949e.tar.gz
go-tangerine-b8354124bebcd3988afd2f41c320f834a69b949e.tar.zst
go-tangerine-b8354124bebcd3988afd2f41c320f834a69b949e.zip
Added protocol caps accessors
Diffstat (limited to 'ethpipe')
-rw-r--r--ethpipe/js_types.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/ethpipe/js_types.go b/ethpipe/js_types.go
index 7266a5be4..cf5686a4b 100644
--- a/ethpipe/js_types.go
+++ b/ethpipe/js_types.go
@@ -1,6 +1,7 @@
package ethpipe
import (
+ "fmt"
"strconv"
"strings"
@@ -151,6 +152,7 @@ type JSPeer struct {
Version string `json:"version"`
LastResponse string `json:"lastResponse"`
Latency string `json:"latency"`
+ Caps string `json:"caps"`
}
func NewJSPeer(peer ethchain.Peer) *JSPeer {
@@ -164,7 +166,13 @@ func NewJSPeer(peer ethchain.Peer) *JSPeer {
}
ipAddress := strings.Join(ip, ".")
- return &JSPeer{ref: &peer, Inbound: peer.Inbound(), LastSend: peer.LastSend().Unix(), LastPong: peer.LastPong(), Version: peer.Version(), Ip: ipAddress, Port: int(peer.Port()), Latency: peer.PingTime()}
+ var caps []string
+ capsIt := peer.Caps().NewIterator()
+ for capsIt.Next() {
+ caps = append(caps, capsIt.Value().Str())
+ }
+
+ return &JSPeer{ref: &peer, Inbound: peer.Inbound(), LastSend: peer.LastSend().Unix(), LastPong: peer.LastPong(), Version: peer.Version(), Ip: ipAddress, Port: int(peer.Port()), Latency: peer.PingTime(), Caps: fmt.Sprintf("%v", caps)}
}
type JSReceipt struct {