pubsub

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPubsubDisabled = errors.New("pubsub is disabled")

Functions

func Options

func Options() fx.Option

Types

type INet

type INet interface {
	Connect(ctx context.Context, p peer.AddrInfo) error
	FindPeer(ctx context.Context, peerID peer.ID) (peer.AddrInfo, error)
	Peers(ctx context.Context) ([]peer.AddrInfo, error)
	AddrListen(ctx context.Context) (peer.AddrInfo, error)
}

func NewINet

func NewINet(p *PubSub) INet

type IPubsuber

type IPubsuber interface {
	GetTopic(topic string) (*pubsub.Topic, error)
}

func NewIPubsuber

func NewIPubsuber(p *PubSub) IPubsuber

type PubSub

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

func NewPubsub

func NewPubsub(ctx context.Context,
	listenAddress string,
	networkName types.NetworkName,
	bootstrap []string,
	period time.Duration,
	threshold int,
) (*PubSub, error)

func ProvidePubsub

func ProvidePubsub(ctx context.Context, networkName types.NetworkName, net *config.Libp2pNetConfig) (*PubSub, error)

func (*PubSub) AddrListen

func (m *PubSub) AddrListen(ctx context.Context) (peer.AddrInfo, error)

func (*PubSub) Connect

func (m *PubSub) Connect(ctx context.Context, p peer.AddrInfo) error

func (*PubSub) FindPeer

func (m *PubSub) FindPeer(ctx context.Context, peerID peer.ID) (peer.AddrInfo, error)

FindPeer searches the libp2p router for a given peer id

func (*PubSub) GetTopic

func (m *PubSub) GetTopic(topic string) (*pubsub.Topic, error)

func (*PubSub) Peers

func (m *PubSub) Peers(ctx context.Context) ([]peer.AddrInfo, error)

Jump to

Keyboard shortcuts

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