spdy

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2015 License: Apache-2.0 Imports: 12 Imported by: 28

README

This package defines a remote transport for libchan services using http2/spdy and tls.

Uses https://github.com/docker/spdystream

Pointers:

* Low-level protocol framer: http://code.google.com/p/go.net/spdy
* (incomplete) high-level server implementation: https://github.com/shykes/spdy-go

Documentation

Overview

Package spdy provides a libchan implementation using spdy 3. This package does not explicitly provide or enforce tls security, but allows being used with secured connections.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWrongDirection occurs when an illegal action is
	// attempted on a channel because of its direction.
	ErrWrongDirection = errors.New("wrong channel direction")
)

Functions

func NoAuthenticator

func NoAuthenticator(conn net.Conn) error

NoAuthenticator is an implementation of authenticator which does no security. This should only be used for testing or with caution when network connections are already guarenteed to be secure.

func Pipe

func Pipe() (libchan.Receiver, libchan.Sender, error)

Pipe creates a top-level channel pipe using an in memory transport.

Types

type Authenticator

type Authenticator func(conn net.Conn) error

Authenticator is a function to provide authentication to a new connection. Authenticator allows tls handshakes to occur or any desired authentication of a network connection before passing off the connection to session management.

type Transport

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

Transport is a transport session on top of a network connection using spdy.

func NewClientTransport

func NewClientTransport(conn net.Conn) (*Transport, error)

NewClientTransport creates a new stream transport from the provided network connection. The network connection is expected to already provide a tls session.

func NewServerTransport

func NewServerTransport(conn net.Conn) (*Transport, error)

NewServerTransport creates a new stream transport from the provided network connection. The network connection is expected to already have completed the tls handshake.

func (*Transport) Close

func (s *Transport) Close() error

Close closes the underlying spdy connection

func (*Transport) NewSendChannel

func (s *Transport) NewSendChannel() (libchan.Sender, error)

NewSendChannel creates and returns a new send channel. The receive end will get picked up on the remote end through the remote calling WaitReceiveChannel.

func (*Transport) RegisterConn

func (s *Transport) RegisterConn(conn net.Conn) error

RegisterConn registers a network connection to be used by inbound messages referring to the connection with the registered connection's local and remote address. Note: a connection does not need to be registered before being sent in a message, but does need to be registered to by the receiver of a message. If registration should be automatic, register a listener instead.

func (*Transport) RegisterListener

func (s *Transport) RegisterListener(listener net.Listener)

RegisterListener accepts all connections from the listener and immediately registers them.

func (*Transport) Unregister

func (s *Transport) Unregister(net.Conn)

Unregister removes the connection from the list of known connections. This should be called when a connection is closed and no longer expected in inbound messages. Failure to unregister connections will increase memory usage since the transport is not notified of closed connections to automatically unregister.

func (*Transport) WaitReceiveChannel

func (s *Transport) WaitReceiveChannel() (libchan.Receiver, error)

WaitReceiveChannel waits for a new channel be created by a remote call to NewSendChannel.

type TransportListener

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

TransportListener is a listener which accepts new connections angi rd spawns spdy transports.

func NewTransportListener

func NewTransportListener(listener net.Listener, auth Authenticator) (*TransportListener, error)

NewTransportListener creates a new listen transport using a network listeners and function to authenticate new connections. TransportListener expects tls session handling to occur by the authenticator or the listener, TransportListener will not perform tls handshakes.

func (*TransportListener) AcceptTransport

func (l *TransportListener) AcceptTransport() (*Transport, error)

AcceptTransport waits for a new network connections and creates a new stream. Connections which fail authentication will not be returned.

func (*TransportListener) Close

func (l *TransportListener) Close() error

Close closes the underlying listener

Jump to

Keyboard shortcuts

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