2023-09-03 23:47:09 +00:00
|
|
|
package p2p
|
|
|
|
|
|
|
|
import (
|
2023-10-05 07:05:02 +00:00
|
|
|
"google.golang.org/grpc"
|
2023-09-03 23:47:09 +00:00
|
|
|
"source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub/pb"
|
|
|
|
)
|
|
|
|
|
|
|
|
type PubSub interface {
|
|
|
|
PublishToBitmask(bitmask []byte, data []byte) error
|
|
|
|
Publish(data []byte) error
|
|
|
|
Subscribe(bitmask []byte, handler func(message *pb.Message) error, raw bool)
|
|
|
|
Unsubscribe(bitmask []byte, raw bool)
|
|
|
|
GetPeerID() []byte
|
2023-09-25 02:43:35 +00:00
|
|
|
GetBitmaskPeers() map[string][]string
|
2023-09-10 23:29:17 +00:00
|
|
|
GetPeerstoreCount() int
|
|
|
|
GetNetworkPeersCount() int
|
2023-09-03 23:47:09 +00:00
|
|
|
GetRandomPeer(bitmask []byte) ([]byte, error)
|
2023-09-29 07:55:09 +00:00
|
|
|
GetMultiaddrOfPeer(peerId []byte) string
|
2023-10-05 07:05:02 +00:00
|
|
|
StartDirectChannelListener(
|
|
|
|
key []byte,
|
|
|
|
server *grpc.Server,
|
|
|
|
) error
|
|
|
|
GetDirectChannel(peerId []byte) (*grpc.ClientConn, error)
|
2023-09-03 23:47:09 +00:00
|
|
|
}
|