Documentation ¶
Index ¶
- Constants
- Variables
- func MsgHash(pubSubTopic string, msg *pb.WakuMessage) []byte
- func NewBroadcaster(bufLen int) *broadcaster
- func PrivKeyToTopic(privKey *ecdsa.PrivateKey) string
- func SignMessage(privKey *ecdsa.PrivateKey, msg *pb.WakuMessage) error
- type Broadcaster
- type Subscription
- type WakuRelay
- func (w *WakuRelay) AddSignedTopicValidator(topic string, address common.Address) error
- func (w *WakuRelay) EnoughPeersToPublish() bool
- func (w *WakuRelay) EnoughPeersToPublishToTopic(topic string) bool
- func (w *WakuRelay) IsSubscribed(topic string) bool
- func (w *WakuRelay) PubSub() *pubsub.PubSub
- func (w *WakuRelay) Publish(ctx context.Context, message *pb.WakuMessage) ([]byte, error)
- func (w *WakuRelay) PublishToTopic(ctx context.Context, message *pb.WakuMessage, topic string) ([]byte, error)
- func (w *WakuRelay) SetHost(h host.Host)
- func (w *WakuRelay) SetPubSub(pubSub *pubsub.PubSub)
- func (w *WakuRelay) Start(ctx context.Context) error
- func (w *WakuRelay) Stop()
- func (w *WakuRelay) Subscribe(ctx context.Context) (*Subscription, error)
- func (w *WakuRelay) SubscribeToTopic(ctx context.Context, topic string) (*Subscription, error)
- func (w *WakuRelay) Topics() []string
- func (w *WakuRelay) Unsubscribe(ctx context.Context, topic string) error
Constants ¶
View Source
const MessageWindowDuration = time.Minute * 5
View Source
const WakuRelayID_v200 = protocol.ID("/vac/waku/relay/2.0.0")
Variables ¶
View Source
var DefaultWakuTopic string = waku_proto.DefaultPubsubTopic().String()
Functions ¶
func MsgHash ¶ added in v0.6.0
func MsgHash(pubSubTopic string, msg *pb.WakuMessage) []byte
Application level message hash
func NewBroadcaster ¶ added in v0.6.0
func NewBroadcaster(bufLen int) *broadcaster
func PrivKeyToTopic ¶ added in v0.6.0
func PrivKeyToTopic(privKey *ecdsa.PrivateKey) string
func SignMessage ¶ added in v0.6.0
func SignMessage(privKey *ecdsa.PrivateKey, msg *pb.WakuMessage) error
Types ¶
type Broadcaster ¶ added in v0.6.0
type Broadcaster interface { Start(ctx context.Context) error Stop() Register(topic string, chLen ...int) Subscription RegisterForAll(chLen ...int) Subscription Submit(*protocol.Envelope) }
type Subscription ¶
func ArraySubscription ¶ added in v0.6.0
func ArraySubscription(msgs []*protocol.Envelope) Subscription
func NoopSubscription ¶ added in v0.6.0
func NoopSubscription() Subscription
type WakuRelay ¶
type WakuRelay struct {
// contains filtered or unexported fields
}
func NewWakuRelay ¶
func NewWakuRelay(bcaster Broadcaster, minPeersToPublish int, timesource timesource.Timesource, log *zap.Logger, opts ...pubsub.Option) *WakuRelay
NewWakuRelay returns a new instance of a WakuRelay struct
func (*WakuRelay) AddSignedTopicValidator ¶ added in v0.6.0
func (*WakuRelay) EnoughPeersToPublish ¶
EnoughPeersToPublish returns whether there are enough peers connected in the default waku pubsub topic
func (*WakuRelay) EnoughPeersToPublishToTopic ¶
EnoughPeersToPublish returns whether there are enough peers connected in a pubsub topic
func (*WakuRelay) IsSubscribed ¶ added in v0.6.0
func (*WakuRelay) Publish ¶
Publish is used to broadcast a WakuMessage to the default waku pubsub topic
func (*WakuRelay) PublishToTopic ¶
func (w *WakuRelay) PublishToTopic(ctx context.Context, message *pb.WakuMessage, topic string) ([]byte, error)
PublishToTopic is used to broadcast a WakuMessage to a pubsub topic
func (*WakuRelay) Stop ¶
func (w *WakuRelay) Stop()
Stop unmounts the relay protocol and stops all subscriptions
func (*WakuRelay) Subscribe ¶
func (w *WakuRelay) Subscribe(ctx context.Context) (*Subscription, error)
SubscribeToTopic returns a Subscription to receive messages from the default waku pubsub topic
func (*WakuRelay) SubscribeToTopic ¶
SubscribeToTopic returns a Subscription to receive messages from a pubsub topic
Click to show internal directories.
Click to hide internal directories.