networkdelay

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0, BSD-2-Clause Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// PayloadName defines the name of the networkdelay payload.
	PayloadName = "networkdelay"
)
View Source
const (
	// PluginName contains the human readable name of the plugin.
	PluginName = "NetworkDelay"
)

Variables

View Source
var Parameters = &ParametersDefinition{}

Parameters contains the configuration used by the networkdelay plugin.

View Source
var Type = payload.NewType(payloadType, PayloadName, 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 represents the identifier which addresses the network delay Payload type.

Functions

func App

func App() *node.Plugin

App gets the plugin instance.

Types

type ID

type ID [32]byte

ID represents a 32 byte ID of a network delay payload.

func (ID) String

func (id ID) String() string

String returns a human-friendly representation of the ID.

type ParametersDefinition

type ParametersDefinition struct {
	// OriginPublicKey defines the default issuer node public key in base58 encoding.
	OriginPublicKey string `default:"9DB3j9cWYSuEEtkvanrzqkzCQMdH1FGv3TawJdVbDxkd" usage:"default issuer node public key"`
}

ParametersDefinition contains the definition of the parameters used by the networkdelay plugin.

type Payload

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

Payload represents the network delay payload type.

func FromBytes

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

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

func NewPayload

func NewPayload(id ID, sentTime int64) *Payload

NewPayload creates a new network delay payload.

func Parse

func Parse(marshalUtil *marshalutil.MarshalUtil) (result *Payload, err error)

Parse unmarshals a Payload using the given marshalUtil (for easier marshaling/unmarshaling).

func (*Payload) Bytes

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

Bytes returns a marshaled version of this Payload.

func (*Payload) String

func (p *Payload) String() string

String returns a human-friendly representation of the Payload.

func (*Payload) Type

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

Type returns the type of the Payload.

type Response

type Response struct {
	ID    string `json:"id,omitempty"`
	Error string `json:"error,omitempty"`
}

Response contains the ID of the message sent.

Jump to

Keyboard shortcuts

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