ceremonyclient/go-libp2p/core/event/identify.go

47 lines
1.5 KiB
Go
Raw Normal View History

2023-08-21 03:50:38 +00:00
package event
2024-06-08 11:32:45 +00:00
import (
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/libp2p/go-libp2p/core/record"
"github.com/multiformats/go-multiaddr"
)
2023-08-21 03:50:38 +00:00
// EvtPeerIdentificationCompleted is emitted when the initial identification round for a peer is completed.
type EvtPeerIdentificationCompleted struct {
// Peer is the ID of the peer whose identification succeeded.
Peer peer.ID
2024-06-08 11:32:45 +00:00
// Conn is the connection we identified.
Conn network.Conn
// ListenAddrs is the list of addresses the peer is listening on.
ListenAddrs []multiaddr.Multiaddr
// Protocols is the list of protocols the peer advertised on this connection.
Protocols []protocol.ID
// SignedPeerRecord is the provided signed peer record of the peer. May be nil.
SignedPeerRecord *record.Envelope
// AgentVersion is like a UserAgent string in browsers, or client version in
// bittorrent includes the client name and client.
AgentVersion string
// ProtocolVersion is the protocolVersion field in the identify message
ProtocolVersion string
// ObservedAddr is the our side's connection address as observed by the
// peer. This is not verified, the peer could return anything here.
ObservedAddr multiaddr.Multiaddr
2023-08-21 03:50:38 +00:00
}
// EvtPeerIdentificationFailed is emitted when the initial identification round for a peer failed.
type EvtPeerIdentificationFailed struct {
// Peer is the ID of the peer whose identification failed.
Peer peer.ID
// Reason is the reason why identification failed.
Reason error
}