noise

package
v0.20.5 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: MIT, Apache-2.0, MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ID = "/noise"

ID is the protocol ID for noise

View Source
const LengthPrefixLength = 2

LengthPrefixLength is the length of the length prefix itself, which precedes all transport messages in order to delimit them. In bytes.

MaxPlaintextLength is the maximum payload size. It is MaxTransportMsgLength minus the MAC size. Payloads over this size will be automatically chunked.

View Source
const MaxTransportMsgLength = 0xffff

MaxTransportMsgLength is the Noise-imposed maximum transport message length, inclusive of the MAC size (16 bytes, Poly1305 for noise-libp2p).

Variables

This section is empty.

Functions

This section is empty.

Types

type Transport

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

Transport implements the interface sec.SecureTransport https://godoc.org/github.com/libp2p/go-libp2p-core/sec#SecureConn

func New

func New(privkey crypto.PrivKey) (*Transport, error)

New creates a new Noise transport using the given private key as its libp2p identity key.

func (*Transport) SecureInbound

func (t *Transport) SecureInbound(ctx context.Context, insecure net.Conn, p peer.ID) (sec.SecureConn, error)

SecureInbound runs the Noise handshake as the responder. If p is empty, connections from any peer are accepted.

func (*Transport) SecureOutbound

func (t *Transport) SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (sec.SecureConn, error)

SecureOutbound runs the Noise handshake as the initiator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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