noise

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package noise implements the base transport of the Tailscale 2021 control protocol.

The base transport implements Noise IK, instantiated with Curve25519, ChaCha20Poly1305 and BLAKE2s.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

A Conn is a secured Noise connection. It implements the net.Conn interface, with the unusual trait that any write error (including a SetWriteDeadline induced i/o timeout) causes all future writes to fail.

func Client

func Client(ctx context.Context, conn net.Conn, machineKey key.MachinePrivate, controlKey key.MachinePublic) (*Conn, error)

Client initiates a control client handshake, returning the resulting control connection.

The context deadline, if any, covers the entire handshaking process. Any preexisting Conn deadline is removed.

func Server

func Server(ctx context.Context, conn net.Conn, controlKey key.MachinePrivate) (*Conn, error)

Server initiates a control server handshake, returning the resulting control connection.

The context deadline, if any, covers the entire handshaking process.

func (*Conn) Close

func (c *Conn) Close() error

Close implements io.Closer.

func (*Conn) HandshakeHash

func (c *Conn) HandshakeHash() [blake2s.Size]byte

HandshakeHash returns the Noise handshake hash for the connection, which can be used to bind other messages to this connection (i.e. to ensure that the message wasn't replayed from a different connection).

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) Peer

func (c *Conn) Peer() key.MachinePublic

Peer returns the peer's long-term public key.

func (*Conn) ProtocolVersion

func (c *Conn) ProtocolVersion() int

ProtocolVersion returns the protocol version that was used to establish this Conn.

func (*Conn) Read

func (c *Conn) Read(bs []byte) (int, error)

Read implements io.Reader.

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (c *Conn) Write(bs []byte) (n int, err error)

Write implements io.Writer.

Jump to

Keyboard shortcuts

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