exit

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: 18 Imported by: 0

Documentation

Overview

Package exit is an onion message type that contains a payload intended to be forwarded to the exit service of a relay.

Index

Constants

View Source
const (
	Magic = "exit"
	Len   = magic.Len +
		slice.Uint16Len +
		3*sha256.Len +
		slice.Uint32Len +
		nonce.IVLen*3 +
		nonce.IDLen
)

Variables

This section is empty.

Functions

func Gen

func Gen() codec.Codec

Gen is a factory function for an Exit.

func New

func New(id nonce.ID, port uint16, payload slice.Bytes,
	ep *ExitPoint) ont.Onion

New creates a new Exit onion.

Types

type Exit

type Exit struct {

	// ID is the identifier that will be embedded with the response to this message
	// relayed from the exit service.
	ID nonce.ID

	// Ciphers is a set of 3 symmetric ciphers that are to be used in their
	// given order over the reply message from the service.
	crypto.Ciphers

	// Nonces are the nonces to use with the cipher when creating the
	// encryption for the reply message,
	// they are common with the crypts in the header.
	crypto.Nonces

	// Port identifies the type of service as well as being the port used by the
	// service to be relayed to. This should be the well-known protocol associated
	// with the port number, eg 80 for HTTP, 53 for DNS, etc.
	Port uint16

	// Bytes are the message to be passed to the exit service.
	slice.Bytes

	// Onion contains the rest of the message, in this case the reply RoutingHeader.
	ont.Onion
}

Exit is a

func (*Exit) Account

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

Account searches for the relevant service, applies the balance change to the account that will be in effect when the response has arrived and delivery is confirmed.

func (*Exit) Decode

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

Decode what should be an Exit message from a splice.Splice.

func (*Exit) Encode

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

Encode this Exit into a splice.Splice's next bytes.

func (*Exit) Handle

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

Handle provides the relay switching logic for an engine handling an Exit message.

func (*Exit) Len

func (x *Exit) Len() int

Len returns the length of this Exit message (payload and return header Onion included.

func (*Exit) Magic

func (x *Exit) Magic() string

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

func (*Exit) Unwrap

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

Unwrap returns the onion inside this Exit message.

func (*Exit) Wrap

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

Wrap puts another onion inside this Exit onion.

type ExitPoint

type ExitPoint struct {

	// Routing contains all the information required to generate a RoutingHeader and
	// cipher/nonce set.
	*Routing

	// ReturnPubs are the public keys of the session payload, which are not in the
	// message but previously shared to create a session.
	ReturnPubs crypto.Pubs
}

ExitPoint is the return routing parameters delivered inside an Exit onion.

type Params

type Params struct {
	Port       uint16
	Payload    slice.Bytes
	ID         nonce.ID
	Alice, Bob *sessions.Data
	S          sessions.Circuit
	KS         *crypto.KeySet
}

Params are the parameters to generate an Exit onion.

type Routing

type Routing struct {

	// Sessions that the RoutingHeader is using.
	Sessions [3]*sessions.Data

	// Keys being used to form the other ECDH half for the encryption.
	Keys crypto.Privs

	// The three nonces that match up with each of the three session RoutingHeader
	// Crypt nonces.
	crypto.Nonces
}

Routing is the sessions and keys required to generate a return RoutingHeader.

Jump to

Keyboard shortcuts

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