delay

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Unlicense Imports: 12 Imported by: 0

Documentation

Overview

Package delay provides an onion message type that allows a client to specify an arbitrary delay time before processing the rest of an onion message.

Index

Constants

View Source
const (
	Magic = "dely"
	Len   = magic.Len + slice.Uint64Len
)

Variables

This section is empty.

Functions

func Gen

func Gen() codec.Codec

Gen is a factory function for a Delay.

func New

func New(d time.Duration) ont.Onion

New creates a new Delay as an ont.Onion.

Types

type Delay

type Delay struct {
	time.Duration
	ont.Onion
}

Delay is an instruction to hold a message for a specified time period before forwarding.

func (*Delay) Account

func (x *Delay) Account(res *sess.Data, sm *sess.Manager,
	s *sessions.Data, last bool) (skip bool, sd *sessions.Data)

Account todo: record a decrement value based on a time coefficient of RelayRate.

func (*Delay) Decode

func (x *Delay) Decode(s *splice.Splice) (e error)

Decode a splice.Splice's next bytes into a Delay.

func (*Delay) Encode

func (x *Delay) Encode(s *splice.Splice) (e error)

Encode a Delay into a splice.Splice's next bytes.

func (*Delay) Handle

func (x *Delay) Handle(s *splice.Splice, p ont.Onion, ng ont.Ngin) (e error)

Handle provides relay and accounting processing logic for receiving a Delay message.

func (*Delay) Len

func (x *Delay) Len() int

Len returns the length of bytes required to encode this Delay.

func (*Delay) Magic

func (x *Delay) Magic() string

Magic bytes that identify this message.

func (*Delay) Wrap

func (x *Delay) Wrap(inner ont.Onion)

Wrap an Onion inside this Delay.

Jump to

Keyboard shortcuts

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