secretstream

package module
v0.0.0-...-4d4f4d6 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2016 License: GPL-3.0 Imports: 8 Imported by: 0

README

secretstream

A port of secret-handshake to Go.

Provides an encrypted bidirectional stream using two boxstreams. Uses secret-handshake to negotiate the keys and nonces.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOnlyTCP = errors.New("secretstream: only TCP is supported")

ErrOnlyTCP is returned if a progrems tries to open a UDP socket through secretstream

Functions

func ServerOnce

func ServerOnce(conn net.Conn, secretKey secrethandshake.EdKeyPair, appKey []byte) (net.Conn, error)

ServerOnce wraps the passed net.Conn into a boxstream if the handshake is successful

Types

type Addr

type Addr struct {
	net.Addr
	// contains filtered or unexported fields
}

Addr wrapps a net.Addr and adds the public key

func (Addr) Network

func (a Addr) Network() string

Network returns the network type of the net.Addr and appends /secret to it TODO(cryptix): the appended string might interfer with callers expecting "tcp"?

func (Addr) PubKey

func (a Addr) PubKey() []byte

PubKey returns the corrosponding public key for this connection

type Client

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

Client can dial secret-handshake server endpoints

func NewClient

func NewClient(kp secrethandshake.EdKeyPair, appKey []byte) (*Client, error)

NewClient creates a new Client with the passed keyPair and appKey

func (*Client) NewDialer

func (c *Client) NewDialer(pubKey [ed25519.PublicKeySize]byte) (Dialer, error)

NewDialer returns a net.Dial-esque dialer that does a secrethandshake key exchange and wraps the underlying connection into a boxstream

type Conn

type Conn struct {
	io.Reader
	io.Writer
	// contains filtered or unexported fields
}

Conn is a boxstream wrapped net.Conn

func (Conn) Close

func (c Conn) Close() error

Close closes the underlying net.Conn

func (Conn) LocalAddr

func (c Conn) LocalAddr() net.Addr

LocalAddr returns the local net.Addr with the local public key

func (Conn) RemoteAddr

func (c Conn) RemoteAddr() net.Addr

RemoteAddr returns the remote net.Addr with the remote public key

func (Conn) SetDeadline

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

SetDeadline passes the call to the underlying net.Conn

func (Conn) SetReadDeadline

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

SetReadDeadline passes the call to the underlying net.Conn

func (Conn) SetWriteDeadline

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

SetWriteDeadline passes the call to the underlying net.Conn

type Dialer

type Dialer func(net, addr string) (net.Conn, error)

Dialer is the same signature as net.Dial, there is no expoted interface for this

type Listener

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

Listener can accept secret handshakes

func (Listener) Accept

func (l Listener) Accept() (net.Conn, error)

Accept accepts a connection on the underlying net.Listener and expects to receive a handshake

func (Listener) Addr

func (l Listener) Addr() net.Addr

Addr returns the

func (Listener) Close

func (l Listener) Close() error

Close closes the underlying net.Listener

type Server

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

Server can create net.Listeners

func NewServer

func NewServer(keyPair secrethandshake.EdKeyPair, appKey []byte) (*Server, error)

NewServer returns a Server which uses the passed keyPair and appKey

func (Server) Listen

func (s Server) Listen(n, a string) (net.Listener, error)

Listen opens a net.Listener which accepts only secrethandshake connections

Directories

Path Synopsis
This file is part of secretstream.
This file is part of secretstream.
This file is part of secretstream.
This file is part of secretstream.

Jump to

Keyboard shortcuts

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