lightpush

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const LightPushID_v20beta1 = libp2pProtocol.ID("/vac/waku/lightpush/2.0.0-beta1")

LightPushID_v20beta1 is the current Waku Lightpush protocol identifier

Variables

View Source
var (
	ErrNoPeersAvailable = errors.New("no suitable remote peers")
	ErrInvalidId        = errors.New("invalid request id")
)

Functions

This section is empty.

Types

type LightPushOption

type LightPushOption func(*LightPushParameters)

func DefaultOptions

func DefaultOptions(host host.Host) []LightPushOption

DefaultOptions are the default options to be used when using the lightpush protocol

func WithAutomaticPeerSelection

func WithAutomaticPeerSelection() LightPushOption

WithAutomaticPeerSelection is an option used to randomly select a peer from the peer store to push a waku message to

func WithAutomaticRequestId

func WithAutomaticRequestId() LightPushOption

WithAutomaticRequestId is an option to automatically generate a request ID when publishing a message

func WithFastestPeerSelection

func WithFastestPeerSelection(ctx context.Context) LightPushOption

WithFastestPeerSelection is an option used to select a peer from the peer store with the lowest ping

func WithPeer

func WithPeer(p peer.ID) LightPushOption

WithPeer is an option used to specify the peerID to push a waku message to

func WithRequestId

func WithRequestId(requestId []byte) LightPushOption

WithRequestId is an option to set a specific request ID to be used when publishing a message

type LightPushParameters

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

type WakuLightPush

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

func NewWakuLightPush

func NewWakuLightPush(ctx context.Context, h host.Host, relay *relay.WakuRelay, log *zap.Logger) *WakuLightPush

NewWakuRelay returns a new instance of Waku Lightpush struct

func (*WakuLightPush) IsClientOnly

func (wakuLp *WakuLightPush) IsClientOnly() bool

IsClientOnly determines if this node supports relaying messages for other lightpush clients

func (*WakuLightPush) IsStarted

func (wakuLP *WakuLightPush) IsStarted() bool

IsStarted returns if the lightpush protocol has been mounted or not

func (*WakuLightPush) Publish

func (wakuLP *WakuLightPush) Publish(ctx context.Context, message *pb.WakuMessage, opts ...LightPushOption) ([]byte, error)

Publish is used to broadcast a WakuMessage to the default waku pubsub topic via lightpush protocol

func (*WakuLightPush) PublishToTopic

func (wakuLP *WakuLightPush) PublishToTopic(ctx context.Context, message *pb.WakuMessage, topic string, opts ...LightPushOption) ([]byte, error)

PublishToTopic is used to broadcast a WakuMessage to a pubsub topic via lightpush protocol

func (*WakuLightPush) Start

func (wakuLP *WakuLightPush) Start() error

Start inits the lighpush protocol

func (*WakuLightPush) Stop

func (wakuLP *WakuLightPush) Stop()

Stop unmounts the lightpush protocol

Jump to

Keyboard shortcuts

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