p2psender

package
v0.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config) error

Option is a function that sets a value in a config.

func WithExtraData added in v0.3.0

func WithExtraData(data []byte) Option

WithExtraData sets the extra data to include in the announce message.

func WithTopic

func WithTopic(topic *pubsub.Topic) Option

WithTopic provides an existing pubsub topic.

type Sender

type Sender struct {
	// contains filtered or unexported fields
}

Sender sends announce messages over pubsub.

func New

func New(p2pHost host.Host, topicName string, options ...Option) (*Sender, error)

New creates a new Sender that sends announce messages over pubsub.

func (*Sender) Close

func (s *Sender) Close() error

Close stops the pubsub topic if the sender owns to topic.

func (*Sender) Send

func (s *Sender) Send(ctx context.Context, msg message.Message) error

Send sends the Message to the pubsub topic.

func (*Sender) TopicName

func (s *Sender) TopicName() string

TopicName returns the name of the topic that messages are sent to.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL