shs

package module
v0.0.0-...-c5702aa Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2016 License: MIT Imports: 14 Imported by: 0

README

go-libp2p-shs

standard-readme compliant

Implements Dominic Tarr's secret handshake as well as the encrypted box stream.

The state of this package is work in progress. The package's interface might change, but the goal is to implement most of the interfaces of github.com/multiformats/go-multiaddr-net as well as github.com/libp2p/go-libp2p-transport.

Documenation

See https://godoc.org/github.com/keks/go-libp2p-shs.

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

Want to hack on IPFS?

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTCPOnly = errors.New("shs only supports tcp") // TODO get rid of this
View Source
var ErrWrongBindKey = errors.New("public key in bind address doesn't match own key")

Functions

This section is empty.

Types

type Addr

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

Addr implements net.Addr

func (Addr) Network

func (a Addr) Network() string

Network returns the network we are on. Most likely "tcp/shs".

func (Addr) PubKey

func (a Addr) PubKey() []byte

PubKey returns the public key of the node at this address

func (Addr) String

func (a Addr) String() string

String is the string representation of this address.

type Conn

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

Conn is an encrypted connection to a remote shs host.

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) LocalMultiaddr

func (c Conn) LocalMultiaddr() ma.Multiaddr

LocalMultiaddr returns the local Multiaddr

func (Conn) RemoteAddr

func (c Conn) RemoteAddr() net.Addr

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

func (Conn) RemoteMultiaddr

func (c Conn) RemoteMultiaddr() ma.Multiaddr

LocalMultiaddr returns the remote end's Multiaddr

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

func (Conn) Transport

func (c Conn) Transport() transport.Transport

type Dialer

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

Dialer allows dialing other shs hosts

func (Dialer) Dial

func (d Dialer) Dial(raddr ma.Multiaddr) (transport.Conn, error)

func (Dialer) DialContext

func (d Dialer) DialContext(ctx context.Context, raddr ma.Multiaddr) (transport.Conn, error)

DialContext tries to connect to the shs host with the Multiaddress raddr.

func (Dialer) Matches

func (d Dialer) Matches(a ma.Multiaddr) bool

Matches returns whether Multiaddress a can be reached using this Dialer.

type Listener

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

Listener implements the go-libp2p-transport.Listener interface

func (*Listener) Accept

func (l *Listener) Accept() (transport.Conn, error)

Accept waits for an incoming connection and returns it. Else it returns an error.

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

Addr returns the net.Addr the Listener bound to.

func (*Listener) Close

func (l *Listener) Close() error

Close closes the listener.

func (*Listener) Multiaddr

func (l *Listener) Multiaddr() ma.Multiaddr

Multiaddr returns the Multiaddr the Listener bound to.

func (*Listener) NetListener

func (l *Listener) NetListener() net.Listener

NetListener returns a net.Listener that is equivalent to this manet.Listener.

type Transport

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

Transport implements the go-libp2p-transport.Transport interface

func NewTransport

func NewTransport(k shs.EdKeyPair, appKey []byte) *Transport

NewTransport creates and initializes a struct of type *Transport

func (*Transport) Dialer

func (t *Transport) Dialer(laddr ma.Multiaddr, opts ...transport.DialOpt) (transport.Dialer, error)

Dialer retuns a Dialer.

func (*Transport) Listen

func (t *Transport) Listen(laddr ma.Multiaddr) (transport.Listener, error)

Listen returns a *Listener for the specified laddr.

func (*Transport) Matches

func (t *Transport) Matches(a ma.Multiaddr) bool

Matches returns whether this Transport is capable of handling that Multiaddress

Jump to

Keyboard shortcuts

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