relay

package module
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 33 Imported by: 5

README

WebTeleport Relay

go.dev reference License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultIndex added in v0.3.4

func DefaultIndex() http.Handler

func NewProxyHandler added in v0.3.1

func NewProxyHandler() http.Handler

func ProxyBasicAuth added in v0.3.1

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

func RealIP added in v0.3.13

func RealIP(r *http.Request) (realIP string)

func Transport added in v0.3.12

func Transport(tssn transport.Session) *http.Transport

Types

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 transport.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"`
}

type Relayer added in v0.3.6

type Relayer interface {
	Upgrader
	Storage
	http.Handler
}

type SessionStore added in v0.3.4

type SessionStore struct {
	Lock         *sync.RWMutex
	PingInterval time.Duration
	Record       map[string]*Record
}

func NewSessionStore added in v0.3.4

func NewSessionStore() *SessionStore

func (*SessionStore) Add added in v0.3.4

func (s *SessionStore) Add(k string, tssn transport.Session, tstm transport.Stream, r *http.Request)

func (*SessionStore) Allocate added in v0.3.4

func (s *SessionStore) Allocate(r *http.Request, root string) (string, string, error)

func (*SessionStore) Get added in v0.3.4

func (s *SessionStore) Get(k string) (transport.Session, bool)

func (*SessionStore) Negotiate added in v0.3.4

func (s *SessionStore) Negotiate(r *http.Request, root string, tssn transport.Session, tstm transport.Stream) (string, error)

func (*SessionStore) Ping added in v0.3.4

func (s *SessionStore) Ping(k string, tstm transport.Stream)

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) Remove added in v0.3.4

func (s *SessionStore) Remove(k string)

func (*SessionStore) Scan added in v0.3.4

func (s *SessionStore) Scan(k string, tstm transport.Stream)

func (*SessionStore) ServeHTTP added in v0.3.6

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

func (*SessionStore) Visited added in v0.3.4

func (s *SessionStore) Visited(k string)

type Storage added in v0.3.4

type Storage interface {
	// Create
	Add(k string, tssn transport.Session, tstm transport.Stream, r *http.Request)
	// Read
	Get(k string) (transport.Session, bool)
	Records() []*Record
	RecordsHandler(w http.ResponseWriter, r *http.Request)
	// Update
	Visited(k string)
	// Remove
	Remove(k string)
	// Rand
	Allocate(r *http.Request, root string) (key string, hostnamePath string, err error)
	Negotiate(r *http.Request, root string, tssn transport.Session, tstm transport.Stream) (key string, err error)
	// Serve
	http.Handler
}

/ transport agnostic CRUD

type Upgrader added in v0.3.4

type Upgrader interface {
	Root() string
	IsRoot(r *http.Request) bool
	IsUpgrade(r *http.Request) bool
	Upgrade(w http.ResponseWriter, r *http.Request) (transport.Session, transport.Stream, error)
}

type WSServer added in v0.3.4

type WSServer struct {
	HOST string
	Storage
	Upgrader
	Proxy       http.Handler
	PostUpgrade http.Handler
}

func NewWSServer added in v0.3.4

func NewWSServer(host string, store Storage) *WSServer

func (*WSServer) ConnectHandler added in v0.3.4

func (sm *WSServer) ConnectHandler(w http.ResponseWriter, r *http.Request)

func (*WSServer) IndexHandler added in v0.3.4

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

func (*WSServer) ServeHTTP added in v0.3.4

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

func (*WSServer) WithPostUpgrade added in v0.3.11

func (s *WSServer) WithPostUpgrade(h http.Handler) *WSServer

type WTServer added in v0.3.6

type WTServer struct {
	HOST string
	Storage
	*WebtransportUpgrader
	PostUpgrade http.Handler
}

func NewWTServer added in v0.3.6

func NewWTServer(host string, store Storage) *WTServer

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) WithPostUpgrade added in v0.3.11

func (s *WTServer) WithPostUpgrade(h http.Handler) *WTServer

func (*WTServer) WithTLSConfig added in v0.3.7

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

type WebsocketUpgrader added in v0.3.4

type WebsocketUpgrader struct {
	// contains filtered or unexported fields
}

func (*WebsocketUpgrader) IsRoot added in v0.3.6

func (s *WebsocketUpgrader) IsRoot(r *http.Request) (result bool)

func (*WebsocketUpgrader) IsUpgrade added in v0.3.6

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

func (*WebsocketUpgrader) Root added in v0.3.6

func (s *WebsocketUpgrader) Root() string

func (*WebsocketUpgrader) Upgrade added in v0.3.4

type WebtransportUpgrader added in v0.3.6

type WebtransportUpgrader struct {
	*wt.Server
	// contains filtered or unexported fields
}

func (*WebtransportUpgrader) IsRoot added in v0.3.6

func (s *WebtransportUpgrader) IsRoot(r *http.Request) (result bool)

func (*WebtransportUpgrader) IsUpgrade added in v0.3.6

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

func (*WebtransportUpgrader) Root added in v0.3.6

func (s *WebtransportUpgrader) Root() string

func (*WebtransportUpgrader) Upgrade added in v0.3.6

Directories

Path Synopsis
cmd module

Jump to

Keyboard shortcuts

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