intro

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

Documentation

Overview

Package intro defines a message type that provides information about an introduction point for a hidden service.

Index

Constants

View Source
const (
	Magic = "inad"
	Len   = ad.Len + crypto.PubKeyLen + slice.Uint16Len + slice.Uint32Len
)

Variables

This section is empty.

Functions

func Gen

func Gen() codec.Codec

Gen is a factory function for an Ad.

func Splice added in v0.1.20

func Splice(
	s *splice.Splice,
	id nonce.ID,
	key *crypto.Pub,
	introducer *crypto.Pub,
	relayRate uint32,
	port uint16,
	expires time.Time,
)

Splice creates the message part up to the signature for an Ad.

Types

type Ad struct {

	// Embed ad.Ad for the common fields
	ad.Ad

	// Introducer is the key of the node that can forward a Route message to help
	// establish a connection to a hidden service.
	Introducer *crypto.Pub
	// Port is the well known port of protocol available.
	Port uint16

	// Rate for accessing the hidden service (covers the hidden service routing
	// header relaying).
	RelayRate uint32
}

Ad is an Intro message that signals that a hidden service can be accessed from a given relay identifiable by its public key.

func New

func New(
	id nonce.ID,
	key *crypto.Prv,
	introducer *crypto.Pub,
	relayRate uint32,
	port uint16,
	expires time.Time,
) (introAd *Ad)

New creates a new Ad and signs it.

func (*Ad) Decode

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

Decode an Ad out of the next bytes of a splice.Splice.

func (*Ad) Encode

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

Encode an Ad into the next bytes of a splice.Splice.

func (*Ad) Len

func (x *Ad) Len() int

Len returns the length of the binary encoded Ad.

func (*Ad) Magic

func (x *Ad) Magic() string

Magic is the identifier indicating an Ad is encoded in the following bytes.

func (*Ad) Sign added in v0.1.20

func (x *Ad) Sign(prv *crypto.Prv) (e error)

func (*Ad) Splice

func (x *Ad) Splice(s *splice.Splice)

Splice serializes an Ad into a splice.Splice.

func (*Ad) SpliceNoSig

func (x *Ad) SpliceNoSig(s *splice.Splice)

SpliceNoSig serializes the Ad but stops at the signature.

func (*Ad) Unwrap

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

Unwrap returns nil because there is no onion inside.

func (*Ad) Validate

func (x *Ad) Validate() bool

Validate checks the signature matches the public key of the Ad.

Jump to

Keyboard shortcuts

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