forward

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 forward is an onion message layer that specifies a single redirection for the remainder of the onion.

This is in contrast to the reverse message, which contains a 3 layer header, needed for when there will be a reply, or just for a compact and indistinguishable 1, 2 or 3 hop relaying that does not leak its position in the route.

Index

Constants

View Source
const (
	Magic = "forw"
	Len   = magic.Len + 1 + splice.AddrLen
)

Variables

This section is empty.

Functions

func Gen

func Gen() codec.Codec

Gen is a factory function for a Forward.

func New

func New(addr *netip.AddrPort) ont.Onion

New creates a new Forward onion.

Types

type Forward

type Forward struct {
	AddrPort *netip.AddrPort
	ont.Onion
}

Forward is a simple forward of the remainder of the onion to a given address and port. Note that we don't use the key, just the address. Relays can have multiple addresses but for a given message, one of them is chosen.

If a reply is required, the reverse.Reverse is used with a RoutingHeader.

todo: currently clients expect that the different addresses are tunnels to the

same relay. They are considered to be the same physical connection with an
extension and are weighted equally. Perhaps they should have bandwidth
capacity indications?

func (*Forward) Account

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

Account for the Forward message is straightforward, message size/Mb/RelayRate.

func (*Forward) Decode

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

Decode a Forward from a provided splice.Splice.

func (*Forward) Encode

func (x *Forward) Encode(s *splice.Splice) error

Encode a Forward into the next bytes of a splice.Splice.

func (*Forward) Handle

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

Handle is the relay logic for an engine handling a Forward message.

func (*Forward) Len

func (x *Forward) Len() int

Len returns the length of this Forward message.

func (*Forward) Magic

func (x *Forward) Magic() string

Magic is the identifying 4 byte string indicating an Forward message follows.

func (*Forward) Unwrap

func (x *Forward) Unwrap() interface{}

Unwrap returns the onion inside this Forward.

func (*Forward) Wrap

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

Wrap puts another onion inside this Forward onion.

Jump to

Keyboard shortcuts

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