From f79f35dc1a2e5e0770a1c1a40ec77be7df675bd5 Mon Sep 17 00:00:00 2001 From: zelig Date: Mon, 18 Sep 2017 13:47:59 +0200 Subject: [PATCH] p2p: add Inbound public method to p2p.Peer --- p2p/peer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/p2p/peer.go b/p2p/peer.go index 1d2b726e8b..bad1c8c8b2 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -160,6 +160,11 @@ func (p *Peer) String() string { 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 { protomap := matchProtocols(protocols, conn.caps, conn) p := &Peer{