v1

package
v0.179.5 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MPL-2.0 Imports: 21 Imported by: 0

README

waku/1

This namespace implements waku 1.0 as described in https://github.com/vacp2p/specs/blob/master/specs/waku/waku-1.md

Documentation

Index

Constants

View Source
const (
	Version    = uint64(1) // Peer version number
	VersionStr = "1"       // The same, as a string
	Name       = "waku"    // Nickname of the protocol

	NumberOfMessageCodes = 128
)

Waku protocol parameters

Variables

This section is empty.

Functions

func NewPeer

func NewPeer(host common.WakuHost, p2pPeer *p2p.Peer, rw p2p.MsgReadWriter, logger *zap.Logger, stats *common.StatsTracker) common.Peer

Types

type MultiVersionResponse

type MultiVersionResponse struct {
	Version  uint
	Response rlp.RawValue
}

MultiVersionResponse allows to decode response into chosen version.

func (MultiVersionResponse) DecodeResponse1

func (m MultiVersionResponse) DecodeResponse1() (resp common.MessagesResponse, err error)

DecodeResponse1 decodes response into first version of the messages response.

type Peer

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

func (*Peer) BloomFilter

func (p *Peer) BloomFilter() []byte

func (*Peer) ConfirmationsEnabled

func (p *Peer) ConfirmationsEnabled() bool

func (*Peer) EnodeID

func (p *Peer) EnodeID() enode.ID

func (*Peer) ID

func (p *Peer) ID() []byte

ID returns a peer's id

func (*Peer) IP

func (p *Peer) IP() net.IP

func (*Peer) Mark

func (p *Peer) Mark(envelope *common.Envelope)

Mark marks an envelope known to the peer so that it won't be sent back.

func (*Peer) Marked

func (p *Peer) Marked(envelope *common.Envelope) bool

Marked checks if an envelope is already known to the remote peer.

func (*Peer) NotifyAboutBloomFilterChange

func (p *Peer) NotifyAboutBloomFilterChange(bloom []byte) (err error)

func (*Peer) NotifyAboutPowRequirementChange

func (p *Peer) NotifyAboutPowRequirementChange(pow float64) (err error)

func (*Peer) NotifyAboutTopicInterestChange

func (p *Peer) NotifyAboutTopicInterestChange(topics []common.TopicType) (err error)

func (*Peer) PoWRequirement

func (p *Peer) PoWRequirement() float64

func (*Peer) RequestHistoricMessages

func (p *Peer) RequestHistoricMessages(envelope *common.Envelope) (err error)

func (*Peer) Run

func (p *Peer) Run() error

func (*Peer) SendBundle added in v0.83.8

func (p *Peer) SendBundle(bundle []*common.Envelope) (rst gethcommon.Hash, err error)

func (*Peer) SendHistoricMessageResponse

func (p *Peer) SendHistoricMessageResponse(payload []byte) (err error)

func (*Peer) SendMessagesRequest

func (p *Peer) SendMessagesRequest(request common.MessagesRequest) (err error)

func (*Peer) SendP2PMessages

func (p *Peer) SendP2PMessages(envelopes []*common.Envelope) (err error)

func (*Peer) SendRawP2PDirect

func (p *Peer) SendRawP2PDirect(envelopes []rlp.RawValue) (err error)

func (*Peer) SetPeerTrusted

func (p *Peer) SetPeerTrusted(trusted bool)

func (*Peer) SetRWWriter

func (p *Peer) SetRWWriter(rw p2p.MsgReadWriter)

func (*Peer) Start

func (p *Peer) Start() error

func (*Peer) Stop

func (p *Peer) Stop()

type StatusOptions

type StatusOptions struct {
	PoWRequirement       *uint64            `rlp:"key=0"` // RLP does not support float64 natively
	BloomFilter          []byte             `rlp:"key=1"`
	LightNodeEnabled     *bool              `rlp:"key=2"`
	ConfirmationsEnabled *bool              `rlp:"key=3"`
	PacketRateLimits     *common.RateLimits `rlp:"key=4"`
	TopicInterest        []common.TopicType `rlp:"key=5"`
	BytesRateLimits      *common.RateLimits `rlp:"key=6"`
}

StatusOptions defines additional information shared between peers during the handshake. There might be more options provided then fields in StatusOptions and they should be ignored during deserialization to stay forward compatible. In the case of RLP, options should be serialized to an array of tuples where the first item is a field name and the second is a RLP-serialized value.

func StatusOptionsFromHost

func StatusOptionsFromHost(host common.WakuHost) StatusOptions

func (*StatusOptions) DecodeRLP

func (o *StatusOptions) DecodeRLP(s *rlp.Stream) error

func (StatusOptions) EncodeRLP

func (o StatusOptions) EncodeRLP(w io.Writer) error

func (StatusOptions) PoWRequirementF

func (o StatusOptions) PoWRequirementF() *float64

func (*StatusOptions) SetPoWRequirementFromF

func (o *StatusOptions) SetPoWRequirementFromF(val float64)

func (StatusOptions) Validate

func (o StatusOptions) Validate() error

func (StatusOptions) WithDefaults

func (o StatusOptions) WithDefaults() StatusOptions

WithDefaults adds the default values for a given peer. This are not the host default values, but the default values that ought to be used when receiving from an update from a peer.

type Version1MessageResponse

type Version1MessageResponse struct {
	Version  uint
	Response common.MessagesResponse
}

Version1MessageResponse first version of the message response.

func NewMessagesResponse

func NewMessagesResponse(batch gethcommon.Hash, errors []common.EnvelopeError) Version1MessageResponse

NewMessagesResponse returns instance of the version messages response.

Jump to

Keyboard shortcuts

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