channel

package
v8.7.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReauthenticationInterval = 5 * time.Minute
	BrowserPingInterval      = 30 * time.Second
)
View Source
var ErrAuthChanged = errors.New("connection closed: authentication changed or endpoint unavailable")

Functions

func Handler

func Handler(myAPI *api.API) http.Handler

func ProxyChannel

func ProxyChannel(w http.ResponseWriter, r *http.Request, settings *api.ChannelSettings, proxy *Proxy)

Types

type AuthChecker

type AuthChecker struct {
	Checker  AuthCheckerFunc
	Template *api.ChannelSettings
	StopCh   chan error
	Done     chan struct{}
	Count    int64
}

Regularly checks that authorization is still valid for a channel, outputting to the stopper when it isn't

func NewAuthChecker

func NewAuthChecker(f AuthCheckerFunc, template *api.ChannelSettings, stopCh chan error) *AuthChecker

func (*AuthChecker) Close

func (c *AuthChecker) Close() error

func (*AuthChecker) Loop

func (c *AuthChecker) Loop(interval time.Duration)

type AuthCheckerFunc

type AuthCheckerFunc func() *api.ChannelSettings

type Connection

type Connection interface {
	UnderlyingConn() net.Conn
	ReadMessage() (int, []byte, error)
	WriteMessage(int, []byte) error
	WriteControl(int, []byte, time.Time) error
}

An abstraction of gorilla's *websocket.Conn

func Wrap

func Wrap(conn Connection, subprotocol string) Connection

type Proxy

type Proxy struct {
	StopCh chan error
}

func NewProxy

func NewProxy(stoppers int) *Proxy

stoppers is the number of goroutines that may attempt to call Stop()

func (*Proxy) Serve

func (p *Proxy) Serve(upstream, downstream Connection, upstreamAddr, downstreamAddr string) error

Jump to

Keyboard shortcuts

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