mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
p2p: add connection flags to PeerInfo
This commit is contained in:
parent
02be17884b
commit
d8208feba6
1 changed files with 6 additions and 0 deletions
|
|
@ -419,6 +419,9 @@ type PeerInfo struct {
|
||||||
Network struct {
|
Network struct {
|
||||||
LocalAddress string `json:"localAddress"` // Local endpoint of the TCP data connection
|
LocalAddress string `json:"localAddress"` // Local endpoint of the TCP data connection
|
||||||
RemoteAddress string `json:"remoteAddress"` // Remote endpoint of the TCP data connection
|
RemoteAddress string `json:"remoteAddress"` // Remote endpoint of the TCP data connection
|
||||||
|
Inbound bool `json:"inbound"`
|
||||||
|
Trusted bool `json:"trusted"`
|
||||||
|
Static bool `json:"static"`
|
||||||
} `json:"network"`
|
} `json:"network"`
|
||||||
Protocols map[string]interface{} `json:"protocols"` // Sub-protocol specific metadata fields
|
Protocols map[string]interface{} `json:"protocols"` // Sub-protocol specific metadata fields
|
||||||
}
|
}
|
||||||
|
|
@ -439,6 +442,9 @@ func (p *Peer) Info() *PeerInfo {
|
||||||
}
|
}
|
||||||
info.Network.LocalAddress = p.LocalAddr().String()
|
info.Network.LocalAddress = p.LocalAddr().String()
|
||||||
info.Network.RemoteAddress = p.RemoteAddr().String()
|
info.Network.RemoteAddress = p.RemoteAddr().String()
|
||||||
|
info.Network.Inbound = p.rw.is(inboundConn)
|
||||||
|
info.Network.Trusted = p.rw.is(trustedConn)
|
||||||
|
info.Network.Static = p.rw.is(staticDialedConn)
|
||||||
|
|
||||||
// Gather all the running protocol infos
|
// Gather all the running protocol infos
|
||||||
for _, proto := range p.running {
|
for _, proto := range p.running {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue