v0

package
v0.172.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MPL-2.0 Imports: 20 Imported by: 0

README

waku/0

This namespace implements waku 0.6 as described in https://github.com/vacp2p/specs/blob/master/specs/waku/waku-0.md and it is now deprecated. Now feature changes will be made only critical bugfixes if required. Once support for waku/0 can be dropped, this code can be safely removed.

Documentation

Index

Constants

View Source
const (
	Version    = uint64(0) // Peer version number
	VersionStr = "0"       // 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
}

Peer is the implementation of the Peer interface and represents a remote Waku client with which the local host Waku instance exchanges data / messages.

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) error

func (*Peer) NotifyAboutPowRequirementChange

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

func (*Peer) NotifyAboutTopicInterestChange

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

func (*Peer) PoWRequirement

func (p *Peer) PoWRequirement() float64

func (*Peer) RequestHistoricMessages

func (p *Peer) RequestHistoricMessages(envelope *common.Envelope) 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) error

func (*Peer) SendMessagesRequest

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

func (*Peer) SendP2PMessages

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

func (*Peer) SendRawP2PDirect

func (p *Peer) SendRawP2PDirect(envelopes []rlp.RawValue) 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"`
	RateLimits           *common.RateLimits `rlp:"key=4"`
	TopicInterest        []common.TopicType `rlp:"key=5"`
}

StatusOptions defines additional information shared between peers during the handshake. There might be more options provided than 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