wsproxy

package
v44.23.4 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MPL-2.0 Imports: 17 Imported by: 0

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