Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultIndex() http.Handler
- func IsInternal(r *http.Request) bool
- func RoundTripper(tssn tunnel.Session) http.RoundTripper
- type ExpVarStruct
- type Ingress
- type IngressHandler
- func (i *IngressHandler) AliasHandler(w http.ResponseWriter, r *http.Request)
- func (i *IngressHandler) Dispatch(r *http.Request) http.Handler
- func (i *IngressHandler) GetRoundTripper(h string) (http.RoundTripper, bool)
- func (i *IngressHandler) RecordsHandler(w http.ResponseWriter, r *http.Request)
- func (i *IngressHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (i *IngressHandler) Subscribe(upgrader edge.Upgrader)
- func (i *IngressHandler) Use(middlewares ...muxr.Middleware)
- type MetricsTransport
- type Record
- type Relayer
- type Storage
- type Store
- func (s *Store) Alias(k string, v string)
- func (s *Store) Aliases() (all map[string]string)
- func (s *Store) Allocate(r *edge.Edge) (string, error)
- func (s *Store) GetRecord(h string) (*Record, bool)
- func (s *Store) LookupRecord(k string) (rec *Record, ok bool)
- func (s *Store) Ping(r *edge.Edge)
- func (s *Store) Records() (all []*Record)
- func (s *Store) RemoveSession(tssn tunnel.Session)
- func (s *Store) Scan(r *edge.Edge)
- func (s *Store) Subscribe(upgrader edge.Upgrader)
- func (s *Store) Unalias(k string)
- func (s *Store) Upsert(k string, r *edge.Edge)
- func (s *Store) WebLog(msg string)
- type TransportStats
- type VerboseConn
- type WSServer
- func (s *WSServer) Dispatch(r *http.Request) http.Handler
- func (s *WSServer) IsRootExternal(r *http.Request) bool
- func (s *WSServer) IsRootInternal(r *http.Request) bool
- func (s *WSServer) IsUpgrade(r *http.Request) (result bool)
- func (s *WSServer) RootHandler(w http.ResponseWriter, r *http.Request)
- func (s *WSServer) RootInternalHandler(w http.ResponseWriter, r *http.Request)
- func (s *WSServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type WTServer
- func (s *WTServer) Dispatch(r *http.Request) http.Handler
- func (s *WTServer) IsRootExternal(r *http.Request) bool
- func (s *WTServer) IsRootInternal(r *http.Request) bool
- func (s *WTServer) IsUpgrade(r *http.Request) bool
- func (s *WTServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *WTServer) WithAddr(a string) *WTServer
- func (s *WTServer) WithTLSConfig(tlsConfig *tls.Config) *WTServer
Constants ¶
View Source
const ROOT_INTERNAL = "root.internal"
Variables ¶
View Source
var DefaultIngress = NewIngressHandler(DefaultStorage)
View Source
var DefaultStorage = NewStore()
Functions ¶
func DefaultIndex ¶ added in v0.3.4
func IsInternal ¶ added in v0.4.37
func RoundTripper ¶ added in v0.4.12
func RoundTripper(tssn tunnel.Session) http.RoundTripper
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 Ingress ¶ added in v0.4.47
type Ingress interface {
// shortcut to dispatcher
http.Handler
// apply middleware to dispatcher
Use(middlewares ...muxr.Middleware)
// get Session wrapped by http.Transport
GetRoundTripper(h string) (http.RoundTripper, bool)
// alias Info
AliasHandler(w http.ResponseWriter, r *http.Request)
// record Info
RecordsHandler(w http.ResponseWriter, r *http.Request)
// subscribe to incoming stream of edge.Edge
edge.Subscriber
}
storage exposed as HTTP server
func NewIngress ¶ added in v0.4.47
func NewIngress() Ingress
type IngressHandler ¶ added in v0.4.47
func NewIngressHandler ¶ added in v0.4.47
func NewIngressHandler(storage Storage) *IngressHandler
func (*IngressHandler) AliasHandler ¶ added in v0.4.50
func (i *IngressHandler) AliasHandler(w http.ResponseWriter, r *http.Request)
func (*IngressHandler) Dispatch ¶ added in v0.4.47
func (i *IngressHandler) Dispatch(r *http.Request) http.Handler
func (*IngressHandler) GetRoundTripper ¶ added in v0.4.47
func (i *IngressHandler) GetRoundTripper(h string) (http.RoundTripper, bool)
func (*IngressHandler) RecordsHandler ¶ added in v0.4.47
func (i *IngressHandler) RecordsHandler(w http.ResponseWriter, r *http.Request)
func (*IngressHandler) ServeHTTP ¶ added in v0.4.47
func (i *IngressHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*IngressHandler) Subscribe ¶ added in v0.4.47
func (i *IngressHandler) Subscribe(upgrader edge.Upgrader)
func (*IngressHandler) Use ¶ added in v0.4.47
func (i *IngressHandler) Use(middlewares ...muxr.Middleware)
type MetricsTransport ¶ added in v0.4.51
type MetricsTransport struct {
Transport http.RoundTripper
Stats *TransportStats
}
MetricsTransport wraps http.Transport to collect various HTTP metrics
func NewMetricsTransport ¶ added in v0.4.51
func NewMetricsTransport(wrapped http.RoundTripper) *MetricsTransport
NewMetricsTransport creates a new transport that collects HTTP metrics
func (*MetricsTransport) MarshalJSON ¶ added in v0.4.51
func (t *MetricsTransport) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface
func (*MetricsTransport) MarshalJSONIndent ¶ added in v0.4.51
func (t *MetricsTransport) MarshalJSONIndent(prefix, indent string) ([]byte, error)
MarshalJSONIndent returns an indented JSON representation
type Record ¶ added in v0.3.1
type Relayer ¶ added in v0.3.6
type Relayer interface {
// dispatch to HTTPUpgrader and Storage
dispatcher.Dispatcher
// builtin HTTPUpgrader
edge.HTTPUpgrader
// edge.Edge consumer
Ingress
}
edge.Edge multiplexer with builtin HTTPUpgrader
type Storage ¶ added in v0.3.4
type Storage interface {
// allocate new session
Allocate(r *edge.Edge) (string, error)
// remove session
RemoveSession(tssn tunnel.Session)
// upsert session
Upsert(k string, r *edge.Edge)
// get record
GetRecord(h string) (*Record, bool)
// get all records
Records() (all []*Record)
// scan edge.Edge
Scan(r *edge.Edge)
// ping edge.Edge
Ping(r *edge.Edge)
// subscribe to incoming stream of edge.Edge
edge.Subscriber
// log message
WebLog(msg string)
// alias
Alias(k string, v string)
// unalias
Unalias(k string)
// get all aliases
Aliases() (all map[string]string)
// lookup record
LookupRecord(k string) (rec *Record, ok bool)
}
edge.Edge multiplexer
type Store ¶ added in v0.4.47
type Store struct {
Lock *sync.RWMutex
PingInterval time.Duration
Verbose bool
Webhook string
Client *http.Client
RecordMap map[string]*Record
AliasMap map[string]string
}
func (*Store) LookupRecord ¶ added in v0.4.50
lookup record by key, or alias
func (*Store) RemoveSession ¶ added in v0.4.47
type TransportStats ¶ added in v0.4.51
type TransportStats struct {
BytesSent int64 `json:"bytesSent"`
BytesReceived int64 `json:"bytesReceived"`
RequestCount int64 `json:"requestCount"`
ResponseCount int64 `json:"responseCount"`
FailedRequests int64 `json:"failedRequests"`
ActiveRequests int64 `json:"activeRequests"`
TotalRequestDuration time.Duration `json:"totalRequestDuration"`
LastRequestTime time.Time `json:"lastRequestTime,omitempty"`
MaxRequestDuration time.Duration `json:"maxRequestDuration,omitempty"`
MinRequestDuration time.Duration `json:"minRequestDuration,omitempty"`
}
TransportStats contains various transport-level statistics
type VerboseConn ¶ added in v0.4.32
type WSServer ¶ added in v0.3.4
type WSServer struct {
Ingress
edge.HTTPUpgrader
}
func DefaultWSServer ¶ added in v0.4.48
func NewWSServer ¶ added in v0.3.4
func (*WSServer) IsRootExternal ¶ added in v0.4.40
func (*WSServer) IsRootInternal ¶ added in v0.4.38
func (*WSServer) RootHandler ¶ added in v0.4.38
func (s *WSServer) RootHandler(w http.ResponseWriter, r *http.Request)
rewrite requests targeting example.com/sub/* to sub.example.com/*
func (*WSServer) RootInternalHandler ¶ added in v0.4.38
func (s *WSServer) RootInternalHandler(w http.ResponseWriter, r *http.Request)
type WTServer ¶ added in v0.3.6
type WTServer struct {
Ingress
*webtransport.Upgrader
}
func DefaultWTServer ¶ added in v0.4.48
func NewWTServer ¶ added in v0.3.6
func (*WTServer) IsRootExternal ¶ added in v0.4.40
func (*WTServer) IsRootInternal ¶ added in v0.4.38
Source Files
¶
Click to show internal directories.
Click to hide internal directories.