p2p: add Inbound public method to p2p.Peer

This commit is contained in:
zelig 2017-09-18 13:47:59 +02:00 committed by Anton Evangelatov
parent aaaf75d26e
commit f79f35dc1a

View file

@ -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{