protocol

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: 11 Imported by: 0

README

Waku v2 protocol

This folder contains implementations of Waku v2 protocols.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFormat = errors.New("invalid format")

Functions

func FulltextMatch

func FulltextMatch(expectedProtocol string) func(string) bool

FulltextMatch is the default matching function used for checking if a peer supports a protocol or not

func GenerateRequestId

func GenerateRequestId() []byte

GenerateRequestId generates a random 32 byte slice that can be used for creating requests inf the filter, store and lightpush protocols

func PrefixTextMatch

func PrefixTextMatch(prefix string) func(string) bool

PrefixTextMatch is a matching function used for checking if a peer's supported protocols begin with a particular prefix

Types

type ContentTopic

type ContentTopic struct {
	ApplicationName    string
	ApplicationVersion uint
	ContentTopicName   string
	Encoding           string
}

func NewContentTopic

func NewContentTopic(applicationName string, applicationVersion uint, contentTopicName string, encoding string) ContentTopic

func StringToContentTopic

func StringToContentTopic(s string) (ContentTopic, error)

func (ContentTopic) Equal

func (ct ContentTopic) Equal(ct2 ContentTopic) bool

func (ContentTopic) String

func (ct ContentTopic) String() string

type Envelope

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

Envelope contains information about the pubsub topic of a WakuMessage and a hash used to identify a message based on the bytes of a WakuMessage protobuffer

func NewEnvelope

func NewEnvelope(msg *pb.WakuMessage, receiverTime int64, pubSubTopic string) *Envelope

NewEnvelope creates a new Envelope that contains a WakuMessage It's used as a way to know to which Pubsub topic belongs a WakuMessage as well as generating a hash based on the bytes that compose the message

func (*Envelope) Hash

func (e *Envelope) Hash() []byte

Hash returns a 32 byte hash calculated from the WakuMessage bytes

func (*Envelope) Index added in v0.1.0

func (env *Envelope) Index() *pb.Index

func (*Envelope) Message

func (e *Envelope) Message() *pb.WakuMessage

Message returns the WakuMessage associated to an Envelope

func (*Envelope) PubsubTopic

func (e *Envelope) PubsubTopic() string

PubsubTopic returns the topic on which a WakuMessage was received

func (*Envelope) Size

func (e *Envelope) Size() int

Size returns the byte size of the WakuMessage

type PubsubTopic

type PubsubTopic struct {
	Name     string
	Encoding string
}

func DefaultPubsubTopic

func DefaultPubsubTopic() PubsubTopic

func NewPubsubTopic

func NewPubsubTopic(name string, encoding string) PubsubTopic

func StringToPubsubTopic

func StringToPubsubTopic(s string) (PubsubTopic, error)

func (PubsubTopic) Equal

func (t PubsubTopic) Equal(t2 PubsubTopic) bool

func (PubsubTopic) String

func (t PubsubTopic) String() string

Directories

Path Synopsis
rln

Jump to

Keyboard shortcuts

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