mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-25 12:57:17 +00:00
Merge branch 'release/0.6.7' into develop
This commit is contained in:
commit
a45e293267
@ -32,6 +32,7 @@ type Peer interface {
|
|||||||
Version() string
|
Version() string
|
||||||
PingTime() string
|
PingTime() string
|
||||||
Connected() *int32
|
Connected() *int32
|
||||||
|
Caps() *ethutil.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
type EthManager interface {
|
type EthManager interface {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ethpipe
|
package ethpipe
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -151,6 +152,7 @@ type JSPeer struct {
|
|||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
LastResponse string `json:"lastResponse"`
|
LastResponse string `json:"lastResponse"`
|
||||||
Latency string `json:"latency"`
|
Latency string `json:"latency"`
|
||||||
|
Caps string `json:"caps"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewJSPeer(peer ethchain.Peer) *JSPeer {
|
func NewJSPeer(peer ethchain.Peer) *JSPeer {
|
||||||
@ -164,7 +166,13 @@ func NewJSPeer(peer ethchain.Peer) *JSPeer {
|
|||||||
}
|
}
|
||||||
ipAddress := strings.Join(ip, ".")
|
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 {
|
type JSReceipt struct {
|
||||||
|
4
peer.go
4
peer.go
@ -813,6 +813,10 @@ func (self *Peer) IsCap(cap string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *Peer) Caps() *ethutil.Value {
|
||||||
|
return self.protocolCaps
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Peer) String() string {
|
func (p *Peer) String() string {
|
||||||
var strBoundType string
|
var strBoundType string
|
||||||
if p.inbound {
|
if p.inbound {
|
||||||
|
Loading…
Reference in New Issue
Block a user