stl

package
v0.0.0-...-1b2fa07 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfig

type ClientConfig struct {
	Topic              []byte
	ClientCertificate  *signcryption.Certificate
	ServerCertificate  *signcryption.Certificate
	RelayerCeriificate *signcryption.Certificate
}

ClientConfig contains configuration needed for a client connection.

type Conn

type Conn struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Conn represents a connection (either a server or a client) on a signcrypted transport layer.

func NewConn

func NewConn(c net.Conn, config *ClientConfig) *Conn

NewConn prepares a connection for use by a client.

func NewServerConn

func NewServerConn(c net.Conn, config *ServerConfig) *Conn

NewServerConn prepares a connection for use by a server.

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection.

func (*Conn) Handshake

func (c *Conn) Handshake() error

Handshake performs the handshake procedure that's needed before using the connection.

func (*Conn) LocalAddr

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

LocalAddr returns the local address of the connection.

func (*Conn) Read

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

func (*Conn) RemoteAddr

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

RemoteAddr returns the address of the remote end of the connection.

func (*Conn) SetDeadline

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

SetDeadline sets the read/write deadline on the connection.

func (*Conn) SetReadDeadline

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

SetReadDeadline sets the read deadline on the connection.

func (*Conn) SetWriteDeadline

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

SetWriteDeadline sets the write deadline on the connection.

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type Relayer

type Relayer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Relayer stands in between a client/server connection. A client connection connects directly to a relayer and is then matched with the appropriate server connection. A Relayer can provide NAT traversal, firewalling, and other services at this layer.

func NewRelayer

func NewRelayer(client net.Conn, config *RelayerConfig) *Relayer

NewRelayer instantiates a new Relayer.

func (*Relayer) Close

func (r *Relayer) Close()

func (*Relayer) Start

func (r *Relayer) Start() error

type RelayerConfig

type RelayerConfig struct {
	Verifier    SessionVerifier
	ConnFetcher ServerConnFetcher
	RelayerCert *signcryption.Certificate
	Signcrypter aai.AAI
	Processor   SegmentProcessor
}

RelayerConfig represents configuration for a Relayer.

type SegmentProcessor

type SegmentProcessor interface {
	ProcessSegment(sender, reciever *signcryption.Certificate,
		segment []byte, totalBytes uint64)
}

SegmentProcessor processes a segment. This should be used for doing out of band things that depend on tracking the information in each segment.

type ServerConfig

type ServerConfig struct {
	ServerCertificate *signcryption.Certificate
	SessionVerifier   SessionVerifier
}

ServerConfig contains configuration needed for a server connection.

type ServerConnFetcher

type ServerConnFetcher interface {
	GetConn(topic []byte, serverCert *signcryption.Certificate) (net.Conn, error)
}

ServerConnFetcher can fetch a server connection based on the client topic and the server certificate.

type SessionVerifier

type SessionVerifier interface {
	VerifySession(topic []byte, clientCert, serverCert,
		relayerCert *signcryption.Certificate) (bool, error)
}

SessionVerifier ensures that the STL session should exist for the given parties.

Jump to

Keyboard shortcuts

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