mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
p2p: add Inbound public method to p2p.Peer
This commit is contained in:
parent
aaaf75d26e
commit
f79f35dc1a
1 changed files with 5 additions and 0 deletions
|
|
@ -160,6 +160,11 @@ func (p *Peer) String() string {
|
||||||
return fmt.Sprintf("Peer %x %v", p.rw.id[:8], p.RemoteAddr())
|
return fmt.Sprintf("Peer %x %v", p.rw.id[:8], p.RemoteAddr())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inbound returns true if the peer is an inbound connection
|
||||||
|
func (p *Peer) Inbound() bool {
|
||||||
|
return p.rw.flags&inboundConn != 0
|
||||||
|
}
|
||||||
|
|
||||||
func newPeer(conn *conn, protocols []Protocol) *Peer {
|
func newPeer(conn *conn, protocols []Protocol) *Peer {
|
||||||
protomap := matchProtocols(protocols, conn.caps, conn)
|
protomap := matchProtocols(protocols, conn.caps, conn)
|
||||||
p := &Peer{
|
p := &Peer{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue