aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/peer.go
diff options
context:
space:
mode:
Diffstat (limited to 'p2p/peer.go')
-rw-r--r--p2p/peer.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/p2p/peer.go b/p2p/peer.go
index 1d2b726e8..bad1c8c8b 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{