Merge pull request #120 from libp2p/feat/801

Introduce EvtPeerConnectednessChanged event
This commit is contained in:
Aarsh Shah 2020-03-06 16:14:55 +05:30 committed by GitHub
commit c2bf839f74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

16
event/network.go Normal file
View File

@ -0,0 +1,16 @@
package event
import (
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
)
// EvtPeerConnectednessChanged should be emitted every time we form a connection with a peer or drop our last
// connection with the peer. Essentially, it is emitted in two cases:
// a) We form a/any connection with a peer.
// b) We go from having a connection/s with a peer to having no connection with the peer.
// It contains the Id of the remote peer and the new connectedness state.
type EvtPeerConnectednessChanged struct {
Peer peer.ID
Connectedness network.Connectedness
}