handshake

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMinimumExpiryAge = time.Minute

Functions

This section is empty.

Types

type Handshake

Handshake functions accept a connection, an encoder, and decoder. The encoder and decoder are used to establish an authenticated and encrypted connection. A new encoder and decoder are returned, which wrap the accpted encoder and decoder with any additional functionality required to perform authentication and encryption. The identity of the remote peer is also returned.

func ECIES

func ECIES(privKey *id.PrivKey) Handshake

func Filter

func Filter(f func(id.Signatory) error, h Handshake) Handshake

Filter accepts a filtering function and a Handshake function, and returns wrapping Handshake function that runs the wrapped Handshake before applying the filtering function to the remote peer ID. If the wrapped Handshake returns an error, the filtering function will be skipped, and the error will be returned. Otherwise, the filtering function will be called and its error returned.

func Insecure

func Insecure(self id.Signatory) Handshake

Insecure returns a Handshake that does no authentication or encryption. During the handshake, the local peer writes its own identity to the connection, and then reads the identity of the remote peer. No verification of identities is done. Insecure should only be used in private networks.

func Once

func Once(self id.Signatory, pool *OncePool, h Handshake) Handshake

type OncePool

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

func NewOncePool

func NewOncePool(opts OncePoolOptions) OncePool

type OncePoolOptions

type OncePoolOptions struct {
	MinimumExpiryAge time.Duration
}

func DefaultOncePoolOptions

func DefaultOncePoolOptions() OncePoolOptions

func (OncePoolOptions) WithMinimumExpiryAge

func (opts OncePoolOptions) WithMinimumExpiryAge(minExpiryAge time.Duration) OncePoolOptions

Jump to

Keyboard shortcuts

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