Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnHandler ¶
type ConnHandler interface {
Handle() *libp2pnetwork.NotifyBundle
}
ConnHandler handles new connections (inbound / outbound) using libp2pnetwork.NotifyBundle
func NewConnHandler ¶
func NewConnHandler(ctx context.Context, logger *zap.Logger, handshaker Handshaker, connIdx peers.ConnectionIndex) ConnHandler
NewConnHandler creates a new connection handler
type HandshakeFilter ¶
HandshakeFilter can be used to filter nodes once we handshaked with them
type Handshaker ¶
type Handshaker interface { Handshake(logger *zap.Logger, conn libp2pnetwork.Conn) error Handler(logger *zap.Logger) libp2pnetwork.StreamHandler }
Handshaker is the interface for handshaking with peers. it uses node info protocol to exchange information with other nodes and decide whether we want to connect.
NOTE: due to compatibility with v0, we accept nodes with user agent as a fallback when the new protocol is not supported.
func NewHandshaker ¶
func NewHandshaker(ctx context.Context, cfg *HandshakerCfg, db *db.BoltDB, geoData *geodata.GeoIP2DB) Handshaker
NewHandshaker creates a new instance of handshaker
type HandshakerCfg ¶
type HandshakerCfg struct { Logger *zap.Logger Network libp2pnetwork.Network Streams streams.StreamController NodeInfoIdx peers.NodeInfoIndex States peers.NodeStates ConnIdx peers.ConnectionIndex IDService identify.IDService }
HandshakerCfg is the configuration for creating an handshaker instance
Click to show internal directories.
Click to hide internal directories.