mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2025-04-17 15:40:37 +08:00
changes as per review
This commit is contained in:
parent
8ca20a2d61
commit
3e988ff158
21
event/network.go
Normal file
21
event/network.go
Normal file
@ -0,0 +1,21 @@
|
||||
package event
|
||||
|
||||
import "github.com/libp2p/go-libp2p-core/network"
|
||||
|
||||
// EvtPeerConnectionStateChange should be emitted when we connect to a peer or disconnect
|
||||
// from a peer. It contains the network interface for the connection,
|
||||
// the connection handle & the new state of the connection.
|
||||
type EvtPeerConnectionStateChange struct {
|
||||
Network network.Network
|
||||
Connection network.Conn
|
||||
NewState network.Connectedness
|
||||
}
|
||||
|
||||
// EvtStreamStateChange should be emitted when we open a new stream with a peer or close an existing stream.
|
||||
// It contains the network interface for the connection, the stream handle &
|
||||
// the new state of the stream.
|
||||
type EvtStreamStateChange struct {
|
||||
Network network.Network
|
||||
Stream network.Stream
|
||||
NewState network.Connectedness
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package network
|
||||
|
||||
// EvtPeerConnectionStateChange should be emitted when we connect/disconnect from a peer
|
||||
type EvtPeerConnectionStateChange struct {
|
||||
Network Network
|
||||
Connection Conn
|
||||
NewState Connectedness
|
||||
}
|
||||
|
||||
// EvtStreamStateChange is emitted when we open/close a stream with a peer
|
||||
type EvtStreamStateChange struct {
|
||||
Network Network
|
||||
Stream Stream
|
||||
NewState Connectedness
|
||||
}
|
@ -10,7 +10,6 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/jbenet/goprocess"
|
||||
"github.com/libp2p/go-libp2p-core/event"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"github.com/libp2p/go-libp2p-core/peerstore"
|
||||
|
||||
@ -101,11 +100,6 @@ type Network interface {
|
||||
|
||||
// Process returns the network's Process
|
||||
Process() goprocess.Process
|
||||
|
||||
// EventBus returns the network's Event Bus
|
||||
// we can subscribe to this bus to listen for connection/disconnection of peers,
|
||||
// opening/closing of streams etc etc
|
||||
EventBus() event.Bus
|
||||
}
|
||||
|
||||
// Dialer represents a service that can dial out to peers
|
||||
|
Loading…
Reference in New Issue
Block a user