message

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const TopicLength = 4

TopicLength sets the length of the message topic

Variables

View Source
var ErrIncorrectFlagsFieldLength = errors.New("Incorrect flags field length in message")

ErrIncorrectFlagsFieldLength is returned when the incoming flags field length is incorrect

Functions

This section is empty.

Types

type Digest

type Digest [digestLength]byte

Digest holds the digest of a message used for caching

type Flags

type Flags struct {
	Raw       bool // message is flagged as raw or with external encryption
	Symmetric bool // message is symmetrically encrypted
}

Flags represents the possible PSS message flags

func (*Flags) DecodeRLP

func (f *Flags) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements the rlp.Decoder interface

func (*Flags) EncodeRLP

func (f *Flags) EncodeRLP(w io.Writer) error

EncodeRLP implements the rlp.Encoder interface

type Message

type Message struct {
	To      []byte
	Flags   Flags
	Expire  uint32
	Topic   Topic
	Payload []byte
}

Message encapsulates messages transported over pss.

func New

func New(flags Flags) *Message

New creates a new PSS message

func (*Message) Digest

func (msg *Message) Digest() Digest

Digest computes a message digest for use as a cache key

func (*Message) String

func (msg *Message) String() string

String representation of a PSS message

type Topic

type Topic [TopicLength]byte

Topic is the PSS encapsulation of the Whisper topic type

func NewTopic

func NewTopic(b []byte) Topic

NewTopic hashes an arbitrary length byte slice and truncates it to the length of a topic, using only the first bytes of the digest

func (Topic) MarshalJSON

func (t Topic) MarshalJSON() (b []byte, err error)

MarshalJSON implements the json.Marshaler interface

func (*Topic) String

func (t *Topic) String() string

func (*Topic) UnmarshalJSON

func (t *Topic) UnmarshalJSON(input []byte) error

UnmarshalJSON implements the json.Marshaler interface

Jump to

Keyboard shortcuts

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