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 ¶
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) HandshakeHash() [blake2s.Size]byte
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Peer() key.MachinePublic
- func (c *Conn) ProtocolVersion() int
- func (c *Conn) Read(bs []byte) (int, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(bs []byte) (n int, err error)
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 ¶
Server initiates a control server handshake, returning the resulting control connection.
The context deadline, if any, covers the entire handshaking process.
func (*Conn) HandshakeHash ¶
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) Peer ¶
func (c *Conn) Peer() key.MachinePublic
Peer returns the peer's long-term public key.
func (*Conn) ProtocolVersion ¶
ProtocolVersion returns the protocol version that was used to establish this Conn.