mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
78bf39aff7
* checkpoint * checkpoint * varint prefix for ssz * move the encoding API around a little bit to support reader writer * add a simple test for the happy path subscribe * move wait timeout to testutil * Add inverted topic mapping * Add varint prefixing to ssz network encoder * fix spacing * fix comments * fix comments * make anon methods more clear * clean up log fields * move topic mapping, reformat TODOs, get ready for brutal team review * lint * lint * lint * Update beacon-chain/p2p/gossip_topic_mappings.go Co-Authored-By: Nishant Das <nishdas93@gmail.com> * PR feedback * PR feedback * PR feedback * PR feedback * PR feedback * basic test with a hardcoded fork choice * updated beacon config to use genesis fork version * checkpoint on hello handler * create a testing db method that can be used with the new database interface * lint * lint * PR feedback * checkpoint * passing tests * comments, errors * comments, errors * remove swarm * Update WORKSPACE * Update WORKSPACE * merge * lint * lint * touch * touch * imports
51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package p2p
|
|
|
|
import (
|
|
"github.com/gogo/protobuf/proto"
|
|
"github.com/libp2p/go-libp2p-core/network"
|
|
"github.com/libp2p/go-libp2p-core/peer"
|
|
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder"
|
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
|
)
|
|
|
|
// P2P represents the full p2p interface composed of all of the sub-interfaces.
|
|
type P2P interface {
|
|
Broadcaster
|
|
SetStreamHandler
|
|
EncodingProvider
|
|
PubSubProvider
|
|
PeerManager
|
|
HandshakeManager
|
|
}
|
|
|
|
// Broadcaster broadcasts messages to peers over the p2p pubsub protocol.
|
|
type Broadcaster interface {
|
|
Broadcast(proto.Message)
|
|
}
|
|
|
|
// SetStreamHandler configures p2p to handle streams of a certain topic ID.
|
|
type SetStreamHandler interface {
|
|
SetStreamHandler(topic string, handler network.StreamHandler)
|
|
}
|
|
|
|
// EncodingProvider provides p2p network encoding.
|
|
type EncodingProvider interface {
|
|
Encoding() encoder.NetworkEncoding
|
|
}
|
|
|
|
// PubSubProvider provides the p2p pubsub protocol.
|
|
type PubSubProvider interface {
|
|
PubSub() *pubsub.PubSub
|
|
}
|
|
|
|
// PeerManager abstracts some peer management methods from libp2p.
|
|
type PeerManager interface {
|
|
Disconnect(peer.ID) error
|
|
}
|
|
|
|
// HandshakeManager abstracts certain methods regarding handshake records.
|
|
type HandshakeManager interface {
|
|
AddHandshake(peer.ID, *pb.Hello)
|
|
}
|