ws

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ShortHandshakeTimeout = 2 * time.Second
)

Functions

func EstablishNodeConn

func EstablishNodeConn(nodeID string, wsConnection chan *websocket.Conn, messages chan Message, connErr chan *ConnectionError)

EstablishNodeConn dials node, pipes messages to message channel and returns connection to wsConnection channel

func SendRequestToNode

func SendRequestToNode(
	connToLoadbalancer *websocket.Conn,
	connToNode *websocket.Conn,
	node models.Node,
	repos repositories.Repos,
	act actions.Actions,
)

SendRequestToNode reads incoming messages to load balancer and pipes them to node

func SendResponseToClient

func SendResponseToClient(
	connToLoadbalancer *websocket.Conn,
	connToNode *websocket.Conn,
	messages chan Message,
	node models.Node,
	repos repositories.Repos,
)

SendResponseToClient iterates through messages sent from node connection and sends them to client

Types

type ConnectionError

type ConnectionError struct {
	Err  error
	Type ConnectionErrorType
}

func (*ConnectionError) Error

func (r *ConnectionError) Error() string

func (*ConnectionError) IsNodeError

func (r *ConnectionError) IsNodeError() bool

type ConnectionErrorType

type ConnectionErrorType int
const (
	NodeError ConnectionErrorType = iota
	PortPoolError
	UserCancellationError
)

type Message

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

Jump to

Keyboard shortcuts

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