relay

package module
v0.4.36 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 33 Imported by: 5

README

WebTeleport Relay

go.dev reference License

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthenticatedProxyHandler = ConnectVerbose(ProxyAuthenticate(NewProxyHandler()))

Functions

func CheckProxyAuth added in v0.4.26

func CheckProxyAuth(user, pass string) bool

func ConnectVerbose added in v0.4.29

func ConnectVerbose(next http.Handler) http.Handler

func DefaultIndex added in v0.3.4

func DefaultIndex() http.Handler

func IsProxy added in v0.4.30

func IsProxy(r *http.Request) bool

h1/h2/h3 connect requests or forward requests

func NewProxyHandler added in v0.3.1

func NewProxyHandler() http.Handler

func ProxyAuthenticate added in v0.4.26

func ProxyAuthenticate(next http.Handler) http.Handler

func ProxyBasicAuth added in v0.3.1

func ProxyBasicAuth(r *http.Request) (username, password string, ok bool)

func ProxyDispatcher added in v0.4.29

func ProxyDispatcher(r *http.Request) http.Handler

func ReverseProxy added in v0.4.5

func ReverseProxy(rt http.RoundTripper) *httputil.ReverseProxy

func RoundTripper added in v0.4.12

func RoundTripper(tssn tunnel.Session) http.RoundTripper

Types

type Dispatcher added in v0.4.19

type Dispatcher interface {
	Dispatch(r *http.Request) http.Handler
}

dispatch to other http.Handler implementations

type DispatcherFunc added in v0.4.25

type DispatcherFunc func(*http.Request) http.Handler

wrapping Dispatcher into http.Handler

func (DispatcherFunc) ServeHTTP added in v0.4.25

func (d DispatcherFunc) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ExpVarStruct added in v0.3.1

type ExpVarStruct struct {
	WebteleportRelayStreamsSpawned   *expvar.Int
	WebteleportRelayStreamsClosed    *expvar.Int
	WebteleportRelaySessionsAccepted *expvar.Int
	WebteleportRelaySessionsClosed   *expvar.Int
}

func NewExpVarStruct added in v0.3.1

func NewExpVarStruct() *ExpVarStruct

type Record added in v0.3.1

type Record struct {
	Key     string         `json:"key"`
	Session tunnel.Session `json:"-"`
	Header  tags.Tags      `json:"header"`
	Tags    tags.Tags      `json:"tags"`
	Since   time.Time      `json:"since"`
	Visited int            `json:"visited"`
	IP      string         `json:"ip"`
}

func (*Record) Matches added in v0.4.12

func (r *Record) Matches(kvs url.Values) (ok bool)

type Relayer added in v0.3.6

type Relayer interface {
	// dispatch to HTTPUpgrader and Storage
	Dispatcher

	// builtin HTTPUpgrader
	edge.HTTPUpgrader

	// edge.Edge multiplexer
	Storage
}

edge.Edge multiplexer with builtin HTTPUpgrader

type SessionStore added in v0.3.4

type SessionStore struct {
	*muxr.Router
	Lock         *sync.RWMutex
	PingInterval time.Duration
	Verbose      bool
	Webhook      string
	Client       *http.Client
	Record       map[string]*Record
}

func NewSessionStore added in v0.3.4

func NewSessionStore() *SessionStore

func (*SessionStore) Allocate added in v0.3.4

func (s *SessionStore) Allocate(r *edge.Edge, root string) (string, string, error)

func (*SessionStore) Dispatch added in v0.4.19

func (s *SessionStore) Dispatch(r *http.Request) http.Handler

func (*SessionStore) GetRoundTripper added in v0.4.18

func (s *SessionStore) GetRoundTripper(k string) (http.RoundTripper, bool)

func (*SessionStore) GetSession added in v0.4.1

func (s *SessionStore) GetSession(k string) (tunnel.Session, bool)

func (*SessionStore) Negotiate added in v0.3.4

func (s *SessionStore) Negotiate(r *edge.Edge, root string) (string, error)

func (*SessionStore) Ping added in v0.3.4

func (s *SessionStore) Ping(r *edge.Edge)

Ping proactively pings the client to keep the connection alive and to detect if the client has disconnected. If the client has disconnected, the session is removed from the session store.

This function has been found mostly unnecessary since the disconnect is automatically detected by the underlying transport layer and handled by the Scan function. However, it is kept here for completeness.

func (*SessionStore) Records added in v0.3.4

func (s *SessionStore) Records() (all []*Record)

func (*SessionStore) RecordsHandler added in v0.3.4

func (s *SessionStore) RecordsHandler(w http.ResponseWriter, r *http.Request)

func (*SessionStore) RemoveSession added in v0.4.1

func (s *SessionStore) RemoveSession(tssn tunnel.Session)

func (*SessionStore) Scan added in v0.3.4

func (s *SessionStore) Scan(r *edge.Edge)

func (*SessionStore) Subscribe added in v0.4.16

func (s *SessionStore) Subscribe(upgrader edge.Upgrader)

func (*SessionStore) Upsert added in v0.4.1

func (s *SessionStore) Upsert(k string, r *edge.Edge)

func (*SessionStore) Visited added in v0.3.4

func (s *SessionStore) Visited(k string)

func (*SessionStore) WebLog added in v0.4.13

func (s *SessionStore) WebLog(msg string)

type Storage added in v0.3.4

type Storage interface {
	// Dispatch to edge.Edge
	Dispatcher

	// get Session wrapped by http.Transport
	GetRoundTripper(k string) (http.RoundTripper, bool)

	// record Info
	RecordsHandler(w http.ResponseWriter, r *http.Request)

	// subscribe to incoming stream of edge.Edge
	edge.Subscriber

	// apply middleware to dispatcher
	Use(middlewares ...muxr.Middleware)

	// shortcut to dispatcher
	http.Handler
}

edge.Edge multiplexer

type VerboseConn added in v0.4.32

type VerboseConn struct {
	net.Conn
}

func (*VerboseConn) Read added in v0.4.32

func (c *VerboseConn) Read(b []byte) (n int, err error)

func (*VerboseConn) Write added in v0.4.32

func (c *VerboseConn) Write(b []byte) (n int, err error)

type WSServer added in v0.3.4

type WSServer struct {
	Storage
	edge.HTTPUpgrader
}

func NewWSServer added in v0.3.4

func NewWSServer(host string, store Storage) *WSServer

func (*WSServer) Dispatch added in v0.4.19

func (s *WSServer) Dispatch(r *http.Request) http.Handler

func (*WSServer) IndexHandler added in v0.3.4

func (s *WSServer) IndexHandler(w http.ResponseWriter, r *http.Request)

func (*WSServer) IsRoot added in v0.4.16

func (s *WSServer) IsRoot(r *http.Request) bool

func (*WSServer) IsUpgrade added in v0.3.4

func (s *WSServer) IsUpgrade(r *http.Request) (result bool)

func (*WSServer) ServeHTTP added in v0.3.4

func (s *WSServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type WTServer added in v0.3.6

type WTServer struct {
	HOST string
	Storage
	*webtransport.Upgrader
}

func NewWTServer added in v0.3.6

func NewWTServer(host string, store Storage) *WTServer

func (*WTServer) Dispatch added in v0.4.19

func (s *WTServer) Dispatch(r *http.Request) http.Handler

func (*WTServer) IsRoot added in v0.4.16

func (s *WTServer) IsRoot(r *http.Request) bool

func (*WTServer) IsUpgrade added in v0.4.16

func (s *WTServer) IsUpgrade(r *http.Request) bool

func (*WTServer) ServeHTTP added in v0.3.6

func (s *WTServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*WTServer) WithAddr added in v0.3.7

func (s *WTServer) WithAddr(a string) *WTServer

func (*WTServer) WithTLSConfig added in v0.3.7

func (s *WTServer) WithTLSConfig(tlsConfig *tls.Config) *WTServer

Directories

Path Synopsis
cmd module

Jump to

Keyboard shortcuts

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