go-waku/waku/v2/protocol/relay/options.go

23 lines
670 B
Go

package relay
type publishParameters struct {
pubsubTopic string
}
// PublishOption is the type of options accepted when publishing WakuMessages
type PublishOption func(*publishParameters)
// WithPubSubTopic is used to specify the pubsub topic on which a WakuMessage will be broadcasted
func WithPubSubTopic(pubsubTopic string) PublishOption {
return func(params *publishParameters) {
params.pubsubTopic = pubsubTopic
}
}
// WithPubSubTopic is used to indicate that the message should be broadcasted in the default pubsub topic
func WithDefaultPubsubTopic() PublishOption {
return func(params *publishParameters) {
params.pubsubTopic = DefaultWakuTopic
}
}