go-libp2p
go-libp2p copied to clipboard
revisit the PeerConnectedness event
We're currently defining 4 different states for the Connectedness: https://pkg.go.dev/github.com/libp2p/[email protected]/network#Connectedness, of which we're only using NotConnected and Connected.
This is confusing to users of the library, we shouldn't define states that we're not actually using.
Furthermore, we should introduce a ConnectedViaTransientConnection state, and emit that instead of Connected when we establish a transient (i.e. a connection via a relay), and emit another Connected event once we transition from a transient to a direct connection.
This came up in https://github.com/libp2p/go-libp2p/pull/1562.
cc @MarcoPolo @Stebalien
Yup, agreed. Although it would be nice to actually implement CannotConnect.
Agreed. From the user's perspective it's better to not define that constant, than to define it and then not to emit it. Let's make it a TODO.