payload

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: Apache-2.0, BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ObjectName defines the name of the syncbeacon object.
	ObjectName = "syncbeacon"
)

Variables

View Source
var Type = payload.NewType(200, ObjectName, func(data []byte) (payload payload.Payload, err error) {
	var consumedBytes int
	payload, consumedBytes, err = FromBytes(data)
	if err != nil {
		return nil, err
	}
	if consumedBytes != len(data) {
		return nil, errors.New("not all payload bytes were consumed")
	}
	return
})

Type is the type of the syncbeacon payload.

Functions

func IsSyncBeaconPayload

func IsSyncBeaconPayload(p *Payload) bool

IsSyncBeaconPayload checks if the message is sync beacon payload.

Types

type Payload

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

Payload represents the syncbeacon payload

func FromBytes

func FromBytes(bytes []byte) (result *Payload, consumedBytes int, err error)

FromBytes parses the marshaled version of a Payload into an object. It either returns a new Payload or fills an optionally provided Payload with the parsed information.

func NewSyncBeaconPayload

func NewSyncBeaconPayload(sentTime int64) *Payload

NewSyncBeaconPayload creates a new syncbeacon payload

func (*Payload) Bytes

func (p *Payload) Bytes() []byte

Bytes marshals the syncbeacon payload into a sequence of bytes.

func (*Payload) SentTime

func (p *Payload) SentTime() int64

SentTime returns the time that payload was sent.

func (*Payload) String

func (p *Payload) String() string

String returns a human readable version of syncbeacon payload (for debug purposes).

func (*Payload) Type

func (p *Payload) Type() payload.Type

Type returns the type of the Payload.

Jump to

Keyboard shortcuts

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