curvecp

package
v0.0.0-...-8fa2440 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2016 License: MIT Imports: 14 Imported by: 1

Documentation

Overview

Package curvecp implements a CurveCP-esque protocol over stateful reliable ordered bidirectional point-to-point datagram streams.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = fmt.Errorf("connection is closed")

Functions

func DecodeKey

func DecodeKey(pk string) (*[32]byte, error)

func EncodeKey

func EncodeKey(pk *[32]byte) string

Encodes a public key to a base32 string.

Types

type Config

type Config struct {
	IsServer bool

	Curvek [32]byte  // own private key
	CurveK *[32]byte // optional public key (optimization; avoids need for Curve25519 operation)
	CurveS [32]byte  // server's public key (required only if we are a client)

	Rand io.Reader // if nil, crypto/rand is used

	// Used only by Dial. If nil, denet.DefaultDialer is used.
	Dialer denet.Dialer
}

Initiation parameters for CurveCP session.

type Conn

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

CurveCP connection.

func Dial

func Dial(netw, addr string, cfg Config, ctx context.Context) (*Conn, error)

Utility function to dial an address and create a connection on it.

net should almost certainly be "tcp". You must set Curvek and CurveS.

func New

func New(conn bsda.FrameReadWriterCloser, cfg Config, ctx context.Context) (*Conn, error)

Initiate a CurveCP connection over a reliable ordered bidirectional point-to-point datagram stream.

func (*Conn) Close

func (c *Conn) Close() error

Close connection.

func (*Conn) PeerPublicKey

func (c *Conn) PeerPublicKey() [32]byte

Returns the peer's permanent public key.

func (*Conn) PeerTemporaryPublicKey

func (c *Conn) PeerTemporaryPublicKey() [32]byte

Returns the peer's transient public key. Rarely needed.

func (*Conn) ReadFrame

func (c *Conn) ReadFrame() ([]byte, error)

Read a frame.

func (*Conn) WriteFrame

func (c *Conn) WriteFrame(b []byte) error

Write a frame.

Jump to

Keyboard shortcuts

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