transport

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: May 15, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package transport provides a websocket, rawsocket, and local transport implementation. The local transport is for in-process connection of a client to a router. Each transport implements the wamp.Peer interface, that connect Send and Recv methods to a particular transport.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptRawSocket

func AcceptRawSocket(conn net.Conn, logger stdlog.StdLog, recvLimit int) (wamp.Peer, error)

AcceptRawSocket handles the client handshake and returns a rawSocketPeer.

If recvLimit is > 0, then the client will not receive messages with size larger than the nearest power of 2 greater than or equal to recvLimit. If recvLimit is <= 0, then the default of 16M is used.

func ConnectRawSocketPeer

func ConnectRawSocketPeer(network, address string, serialization serialize.Serialization, logger stdlog.StdLog, recvLimit int) (wamp.Peer, error)

ConnectRawSocketPeer creates a new rawSocketPeer with the specified config, and connects it to the WAMP router at the specified address. The network and address parameters are documented here: https://golang.org/pkg/net/#Dial

If recvLimit is > 0, then the client will not receive messages with size larger than the nearest power of 2 greater than or equal to recvLimit. If recvLimit is <= 0, then the default of 16M is used.

func ConnectTlsRawSocketPeer

func ConnectTlsRawSocketPeer(network, address string, serialization serialize.Serialization, tlsConfig *tls.Config, logger stdlog.StdLog, recvLimit int) (wamp.Peer, error)

ConnectTlsRawSocketPeer creates a new rawSocketPeer with the specified config, and connects it, using TLS, to the WAMP router at the specified address. The network, address, and tlscfg parameters are documented here: https://golang.org/pkg/crypto/tls/#Dial

If recvLimit is > 0, then the client will not receive messages with size larger than the nearest power of 2 greater than or equal to recvLimit. If recvLimit is <= 0, then the default of 16M is used.

func ConnectWebsocketPeer

func ConnectWebsocketPeer(url string, serialization serialize.Serialization, tlsConfig *tls.Config, dial DialFunc, logger stdlog.StdLog, wsCfg *WebsocketConfig) (wamp.Peer, error)

ConnectWebsocketPeer creates a new websocket client with the specified config, connects the client to the websocket server at the specified URL, and returns the connected websocket peer.

func IsLocal

func IsLocal(p wamp.Peer) bool

IsLocal returns true is the wamp.Peer is a localPeer. These do not need authentication since they are part of the same process.

func LinkedPeers

func LinkedPeers() (wamp.Peer, wamp.Peer)

LinkedPeers creates two connected peers. Messages sent to one peer appear in the Recv of the other. This is used for connecting client sessions to the router.

func NewWebsocketPeer

func NewWebsocketPeer(conn *websocket.Conn, serializer serialize.Serializer, payloadType int, logger stdlog.StdLog) wamp.Peer

NewWebsocketPeer creates a websocket peer from an existing websocket connection. This is used by clients connecting to the WAMP router, and by servers to handle connections from clients.

Types

type DialFunc

type DialFunc func(network, addr string) (net.Conn, error)

type WebsocketConfig

type WebsocketConfig struct {
	// Request per message write compression, if allowed by server.
	EnableCompression     bool `json:"enable_compression"`
	EnableContextTakeover bool `json:"enable_context_takeover"`

	// If provided when configuring websocket client, cookies from server are
	// put in here.  This allows cookies to be stored and then sent back to the
	// server in subsequent websocket connections.  Cookies may be used to
	// identify returning clients, and can be used to authenticate clients.
	Jar http.CookieJar

	// Deprecated server config options.
	// See: https://godoc.org/github.com/gammazero/nexus/router#WebsocketServer
	EnableTrackingCookie bool `json:"enable_tracking_cookie"`
	EnableRequestCapture bool `json:"enable_request_capture"`
}

WebsocketConfig is used to provide configuration client websocket settings.

Directories

Path Synopsis
Package serialize provides a Serializer interface with implementations that encode and decode message data in various ways.
Package serialize provides a Serializer interface with implementations that encode and decode message data in various ways.

Jump to

Keyboard shortcuts

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