wsproxy

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: MPL-2.0 Imports: 18 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package wsproxy is a Layer-7 proxy implementation which uses WebSockets to communicate with clients. Incoming http and websocket requests are multiplexed as separate streams over a WS connection. It uses JWT for auth.

viewer ----> [ proxy ] <--- websocket --- client

proxy serves endpoints exposed by client to viewers.

This is a low-level part of websocktunnel; users should instead use the github.com/taskcluster/client class.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnexpectedSigningMethod is returned when the signing method used by the given JWT is not HMAC.
	ErrUnexpectedSigningMethod = errors.New("unexpected signing method on jwt")

	// ErrTokenNotValid is returned when the jwt is not valid.
	ErrTokenNotValid = errors.New("token not valid")

	// ErrAuthFailed is returned when jwt verification fails.
	ErrAuthFailed = errors.New("auth failed")

	// ErrMissingSecret is returned when the proxy does not load both required secrets.
	ErrMissingSecret = errors.New("both secrets must be loaded")
)

Functions

func New

func New(conf Config) (http.Handler, error)

New creates a new proxy instance and wraps it as an http.Handler.

Types

type Config

type Config struct {
	// Upgrader is a websocket.Upgrader instance which is used to upgrade incoming
	// websocket connections from Clients.
	Upgrader websocket.Upgrader

	// Logger is used to log proxy events. Refer util.Logger.
	Logger *logrus.Logger

	// JWTSecretA and JWTSecretB are used by the proxy to verify JWTs from Clients.
	JWTSecretA []byte
	JWTSecretB []byte

	// the prefix for publicly accessible URLs (used to generate the URLs sent
	// to clients)
	URLPrefix string

	// Audience value for aud claim
	Audience string
}

Config contains the run time parameters for the proxy

Jump to

Keyboard shortcuts

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