model

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerMessage

type PeerMessage struct {
	// ID **must** only contain alphanumeric characters separated by period.
	ID string // A unique Message ID (primarily used for acknowledgments)

	// Context **must** only contain alphanumeric characters separated by period.
	Context string // A unique context identifier i.e. im.cwtch.chat

	// Data can contain anything
	Data []byte // A data packet.
}

PeerMessage is an encapsulation that can be used by higher level applications

func ParsePeerMessage added in v0.14.17

func ParsePeerMessage(message []byte) (*PeerMessage, error)

ParsePeerMessage returns either a deserialized PeerMessage or an error if it is malformed

func (*PeerMessage) Serialize added in v0.14.17

func (m *PeerMessage) Serialize() []byte

Serialize constructs an efficient serialized representation Format: [ID String] | [Context String] | Binary Data

Jump to

Keyboard shortcuts

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