relay

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// BufSize is the size in bytes of the send/receive buffers of a relay.
	BufSize int
	// MaxTime is the maximum time for a single connection.
	MaxTime time.Duration
	// HandleST is a generic function which is called on incoming sharetokens.
	HandleST func(*sharetoken.T) error
	// ErrorOrigin is an optional string to use when signaling the origin of
	// errors downstream.
	ErrorOrigin string
	// AllowLoopback sets whether to allow dialing loopback addresses. While
	// useful for testing, it presents a security risk in production.
	AllowLoopback bool
}

type T

type T struct {
	*transport.T
	Options
}

func New

func New(tt *transport.T, o Options) *T

func (*T) ListenAndServeHTTP

func (t *T) ListenAndServeHTTP(addr string) error

ListenAndServeHTTP listens on the specified address and passes the connections to ServeHTTP.

func (*T) ServeHTTP

func (t *T) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is the handler function for H2. It being named ServeHTTP allows T to expose the http.Handler interface. It handles the initial init payload and brokers the subsequent tunnel connections or an exit connection if needed.

Jump to

Keyboard shortcuts

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