-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Identify: emit useful events after identification #2759
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,40 @@ | ||
package event | ||
|
||
import "github.com/libp2p/go-libp2p/core/peer" | ||
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" | ||
) | ||
|
||
// 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 | ||
|
||
// 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 | ||
Comment on lines
+20
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All addrs/protocols, or only the ones the peer told us about? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only the one they told us about on this connection There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (what it says in the comment) |
||
|
||
// SignedPeerRecord is the provided signed peer record of the peer. May be nil. | ||
SignedPeerRecord *record.Envelope | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we include the other fields? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. And we should stop storing them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed. Thanks |
||
|
||
// 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 | ||
} | ||
|
||
// EvtPeerIdentificationFailed is emitted when the initial identification round for a peer failed. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense to have this right now, but I'm concerned about the future if/when we have some sort of connection-independent identify. But I guess we have no plans there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want to double down on this connection dependent identify approach? #2693
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, yes. I'm just calling this out as a decision.