diff --git a/gossip/comm/comm_impl.go b/gossip/comm/comm_impl.go index b50fdabc9d8..5eb2e9a25da 100644 --- a/gossip/comm/comm_impl.go +++ b/gossip/comm/comm_impl.go @@ -465,6 +465,7 @@ func (c *commImpl) authenticateRemotePeer(stream stream) (*proto.ConnectionInfo, connInfo := &proto.ConnectionInfo{ ID: receivedMsg.PkiId, Identity: receivedMsg.Cert, + Endpoint: remoteAddress, } // if TLS is enabled and detected, verify remote peer diff --git a/gossip/gossip/channel/channel.go b/gossip/gossip/channel/channel.go index 5ea5d01b679..7b116d63b06 100644 --- a/gossip/gossip/channel/channel.go +++ b/gossip/gossip/channel/channel.go @@ -380,11 +380,11 @@ func (gc *gossipChannel) HandleMessage(msg proto.ReceivedMessage) { } orgID := gc.GetOrgOfPeer(msg.GetConnectionInfo().ID) if len(orgID) == 0 { - gc.logger.Debug("Couldn't find org identity of peer", msg.GetConnectionInfo().ID) + gc.logger.Debug("Couldn't find org identity of peer", msg.GetConnectionInfo()) return } if !gc.IsOrgInChannel(orgID) { - gc.logger.Warning("Point to point message came from", msg.GetConnectionInfo().ID, + gc.logger.Warning("Point to point message came from", msg.GetConnectionInfo(), ", org(", string(orgID), ") but it's not eligible for the channel", string(gc.chainID)) return } diff --git a/gossip/gossip/gossip_impl.go b/gossip/gossip/gossip_impl.go index 6a950f5f939..8b921a3c123 100644 --- a/gossip/gossip/gossip_impl.go +++ b/gossip/gossip/gossip_impl.go @@ -339,7 +339,7 @@ func (g *gossipServiceImpl) handleMessage(m proto.ReceivedMessage) { msg := m.GetGossipMessage() - g.logger.Debug("Entering,", m.GetConnectionInfo().ID, "sent us", msg) + g.logger.Debug("Entering,", m.GetConnectionInfo(), "sent us", msg) defer g.logger.Debug("Exiting") if !g.validateMsg(m) { diff --git a/protos/gossip/extensions.go b/protos/gossip/extensions.go index e8574fa79c0..e83c1103aa9 100644 --- a/protos/gossip/extensions.go +++ b/protos/gossip/extensions.go @@ -336,10 +336,18 @@ type ConnectionInfo struct { ID common.PKIidType Auth *AuthInfo Identity api.PeerIdentityType + Endpoint string } -func (connInfo *ConnectionInfo) IsAuthenticated() bool { - return connInfo.Auth != nil +// String returns a string representation of this ConnectionInfo +func (c *ConnectionInfo) String() string { + return fmt.Sprintf("%s %v", c.Endpoint, c.ID) +} + +// IsAuthenticated returns whether the connection to the remote peer +// was authenticated when the handshake took place +func (c *ConnectionInfo) IsAuthenticated() bool { + return c.Auth != nil } // AuthInfo represents the authentication