2019-02-05 13:47:25 +00:00
|
|
|
package p2p
|
|
|
|
|
|
|
|
import (
|
2019-03-17 02:56:05 +00:00
|
|
|
"context"
|
|
|
|
|
2019-02-05 13:47:25 +00:00
|
|
|
"github.com/gogo/protobuf/proto"
|
2019-05-09 21:02:24 +00:00
|
|
|
"github.com/libp2p/go-libp2p-peer"
|
2019-03-19 23:07:49 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/event"
|
2019-02-05 13:47:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Broadcaster represents a subset of the p2p.Server. This interface is useful
|
|
|
|
// for testing or when the calling code only needs access to the broadcast
|
|
|
|
// method.
|
|
|
|
type Broadcaster interface {
|
2019-03-17 02:56:05 +00:00
|
|
|
Broadcast(context.Context, proto.Message)
|
2019-02-05 13:47:25 +00:00
|
|
|
}
|
2019-03-19 23:07:49 +00:00
|
|
|
|
|
|
|
// Subscriber represents a subset of the p2p.Server. This interface is useful
|
|
|
|
// for testing or when the calling code only needs access to the subscribe
|
|
|
|
// method.
|
|
|
|
type Subscriber interface {
|
|
|
|
Subscribe(msg proto.Message, channel chan Message) event.Subscription
|
|
|
|
}
|
2019-05-09 21:02:24 +00:00
|
|
|
|
|
|
|
// ReputationManager represents a subset of the p2p.Server which enables
|
|
|
|
// reputaiton reporting of peers.
|
|
|
|
type ReputationManager interface {
|
|
|
|
Reputation(peer peer.ID, val int)
|
|
|
|
}
|