Documentation
¶
Index ¶
- func ActorCanAccessClient(actor *Actor, clientID int) bool
- func ActorPrimaryClientID(actor *Actor) (int, bool)
- func ApplySessionIdentity(c Context, identity *webservice.SessionIdentity) error
- func PageSpecEnabled(cfg *servercfg.Snapshot, spec PageSpec) bool
- func PrincipalFromActor(actor *Actor) webservice.Principal
- type ActionEntry
- type ActionOwnership
- type ActionSpec
- type Actor
- func ActorFromSessionIdentity(identity *webservice.SessionIdentity) *Actor
- func ActorFromSessionIdentityWithFallback(identity *webservice.SessionIdentity, fallbackAdminUsername string) *Actor
- func AdminActorWithFallback(username, fallbackAdminUsername string) *Actor
- func AnonymousActor() *Actor
- func UserActor(username string, clientIDs []int) *Actor
- type App
- func (a *App) AddClient(c Context)
- func (a *App) AddHost(c Context)
- func (a *App) AddTunnel(c Context)
- func (a *App) BanClean(c Context)
- func (a *App) BanList(c Context)
- func (a *App) Bootstrap(c Context)
- func (a *App) ChangeClientStatus(c Context)
- func (a *App) ClearClient(c Context)
- func (a *App) ClearHost(c Context)
- func (a *App) ClearTunnel(c Context)
- func (a *App) ClientQRCode(c Context)
- func (a *App) CurrentConfig() *servercfg.Snapshot
- func (a *App) DashboardStats(c Context)
- func (a *App) DeleteClient(c Context)
- func (a *App) DeleteHost(c Context)
- func (a *App) DeleteTunnel(c Context)
- func (a *App) EditClient(c Context)
- func (a *App) EditHost(c Context)
- func (a *App) EditTunnel(c Context)
- func (a *App) Emit(c Context, event Event)
- func (a *App) GetAuthKey(c Context)
- func (a *App) GetCert(c Context)
- func (a *App) GetClient(c Context)
- func (a *App) GetHost(c Context)
- func (a *App) GetOneTunnel(c Context)
- func (a *App) GetTime(c Context)
- func (a *App) GetTunnel(c Context)
- func (a *App) HostList(c Context)
- func (a *App) IPRegister(c Context)
- func (a *App) IPRegisterPage(c Context)
- func (a *App) ListClients(c Context)
- func (a *App) LoginVerify(c Context)
- func (a *App) Logout(c Context)
- func (a *App) LogoutRedirect(c Context)
- func (a *App) ManagementShell(c Context)
- func (a *App) PageModel(c Context, controller, action string)
- func (a *App) PageModelController(c Context, controller string, defaultAction string)
- func (a *App) PingClient(c Context)
- func (a *App) RegisterUser(c Context)
- func (a *App) RenderControllerPage(c Context, controller string, defaultAction string)
- func (a *App) RenderPage(c Context, controller, action string)
- func (a *App) SaveGlobal(c Context)
- func (a *App) StandaloneIPRegisterPage(c Context)
- func (a *App) StartHost(c Context)
- func (a *App) StartTunnel(c Context)
- func (a *App) StopHost(c Context)
- func (a *App) StopTunnel(c Context)
- func (a *App) Unban(c Context)
- func (a *App) UnbanAll(c Context)
- func (a *App) UpdateClient(c Context)
- func (a *App) UpdateGeoData(c Context)
- func (a *App) UpdateServer(c Context)
- type AuthKeyResponse
- type BootstrapApp
- type BootstrapAuthorizationExtension
- type BootstrapClusterExtension
- type BootstrapExtensions
- type BootstrapFeatures
- type BootstrapPayload
- type BootstrapRoutes
- type BootstrapSecurity
- type BootstrapSession
- type BootstrapUI
- type CertResponse
- type ClientListResponse
- type CodeDataResponse
- type CodeRTTResponse
- type CodeResponse
- type Context
- type Event
- type GlobalTrafficPayload
- type Handler
- type Hooks
- type IPRegisterHourOption
- type IPRegisterResponse
- type NoopHooks
- type Options
- type PageEntry
- type PageFeature
- type PageModelResponse
- type PageOwnership
- type PageParam
- type PageSpec
- type RequestMetadata
- type StatusMessageIDResponse
- type StatusMessageResponse
- type StatusNonceBitsResponse
- type StatusNonceCertResponse
- type StatusNonceResponse
- type StatusNonceTimestampResponse
- type TableResponse
- type TimeResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActorCanAccessClient ¶
func ActorPrimaryClientID ¶
func ApplySessionIdentity ¶
func ApplySessionIdentity(c Context, identity *webservice.SessionIdentity) error
ApplySessionIdentity stores identity in the session; an error says that the session could not be saved.
func PrincipalFromActor ¶
func PrincipalFromActor(actor *Actor) webservice.Principal
Types ¶
type ActionEntry ¶
type ActionEntry struct {
Controller string `json:"controller"`
Name string `json:"name"`
Method string `json:"method"`
APIPath string `json:"api_path"`
LegacyPath string `json:"legacy_path,omitempty"`
Permission string `json:"permission,omitempty"`
Ownership ActionOwnership `json:"ownership,omitempty"`
RequiredFeatures []PageFeature `json:"required_features,omitempty"`
ClientScope bool `json:"client_scope"`
Protected bool `json:"protected"`
}
func VisibleActionEntries ¶
func VisibleActionEntries(cfg *servercfg.Snapshot, baseURL string, actor *Actor, authz webservice.AuthorizationService, specs []ActionSpec) []ActionEntry
type ActionOwnership ¶
type ActionOwnership string
const ( ActionOwnershipNone ActionOwnership = "" ActionOwnershipClient ActionOwnership = "client" ActionOwnershipTunnel ActionOwnership = "tunnel" ActionOwnershipHost ActionOwnership = "host" )
type ActionSpec ¶
type ActionSpec struct {
Controller string
Name string
Method string
APIPath string
LegacyPath string
Permission string
Ownership ActionOwnership
RequiredFeatures []PageFeature
Handler Handler
ClientScope bool
Protected bool
}
func ProtectedActionCatalog ¶
func ProtectedActionCatalog(app *App) []ActionSpec
func SessionActionCatalog ¶
func SessionActionCatalog(app *App) []ActionSpec
type Actor ¶
type Actor struct {
Kind string `json:"kind"`
SubjectID string `json:"subject_id,omitempty"`
Username string `json:"username,omitempty"`
IsAdmin bool `json:"is_admin"`
ClientIDs []int `json:"client_ids,omitempty"`
Roles []string `json:"roles,omitempty"`
Permissions []string `json:"permissions,omitempty"`
Attributes map[string]string `json:"attributes,omitempty"`
}
func ActorFromSessionIdentity ¶
func ActorFromSessionIdentity(identity *webservice.SessionIdentity) *Actor
func ActorFromSessionIdentityWithFallback ¶
func ActorFromSessionIdentityWithFallback(identity *webservice.SessionIdentity, fallbackAdminUsername string) *Actor
func AdminActorWithFallback ¶
func AnonymousActor ¶
func AnonymousActor() *Actor
type App ¶
type App struct {
NodeID string
Hooks Hooks
Services webservice.Services
ConfigProvider func() *servercfg.Snapshot
}
func (*App) ChangeClientStatus ¶
func (*App) ClearClient ¶
func (*App) ClearTunnel ¶
func (*App) ClientQRCode ¶
func (*App) CurrentConfig ¶
func (*App) DashboardStats ¶
func (*App) DeleteClient ¶
func (*App) DeleteHost ¶
func (*App) DeleteTunnel ¶
func (*App) EditClient ¶
func (*App) EditTunnel ¶
func (*App) GetAuthKey ¶
func (*App) GetOneTunnel ¶
func (*App) IPRegister ¶ added in v0.34.9
IPRegister registers the address of the visitor. Wrong keys count as failed logins, so that guessing them leads to a ban.
func (*App) IPRegisterPage ¶ added in v0.34.9
IPRegisterPage renders the registration page of the web interface; a key query parameter fills in the key, so that a link can be shared.
func (*App) ListClients ¶
func (*App) LoginVerify ¶
func (*App) LogoutRedirect ¶
func (*App) ManagementShell ¶
func (*App) PageModelController ¶
func (*App) PingClient ¶
func (*App) RegisterUser ¶
func (*App) RenderControllerPage ¶
func (*App) RenderPage ¶
func (*App) SaveGlobal ¶
func (*App) StandaloneIPRegisterPage ¶ added in v0.34.9
StandaloneIPRegisterPage renders the registration page of its own listener, which serves it from the root.
func (*App) StartTunnel ¶
func (*App) StopTunnel ¶
func (*App) UpdateClient ¶ added in v0.34.9
func (*App) UpdateGeoData ¶ added in v0.34.9
func (*App) UpdateServer ¶ added in v0.34.9
type AuthKeyResponse ¶
type BootstrapApp ¶
type BootstrapAuthorizationExtension ¶
type BootstrapAuthorizationExtension struct {
Roles []string `json:"roles,omitempty"`
Permissions []string `json:"permissions,omitempty"`
ClientIDs []int `json:"client_ids,omitempty"`
KnownRoles []string `json:"known_roles,omitempty"`
KnownPermissions []string `json:"known_permissions,omitempty"`
ManagementAdmin string `json:"management_admin"`
ResourcePermissions map[string][]string `json:"resource_permissions,omitempty"`
}
type BootstrapExtensions ¶
type BootstrapExtensions struct {
Authorization BootstrapAuthorizationExtension `json:"authorization"`
Cluster BootstrapClusterExtension `json:"cluster"`
}
type BootstrapFeatures ¶
type BootstrapFeatures struct {
AllowUserLogin bool `json:"allow_user_login"`
AllowUserRegister bool `json:"allow_user_register"`
AllowUserVkeyLogin bool `json:"allow_user_vkey_login"`
AllowFlowLimit bool `json:"allow_flow_limit"`
AllowRateLimit bool `json:"allow_rate_limit"`
AllowTimeLimit bool `json:"allow_time_limit"`
AllowConnectionNumLimit bool `json:"allow_connection_num_limit"`
AllowMultiIP bool `json:"allow_multi_ip"`
AllowTunnelNumLimit bool `json:"allow_tunnel_num_limit"`
AllowLocalProxy bool `json:"allow_local_proxy"`
AllowUserLocal bool `json:"allow_user_local"`
AllowSecretLink bool `json:"allow_secret_link"`
AllowUserChangeUsername bool `json:"allow_user_change_username"`
SystemInfoDisplay bool `json:"system_info_display"`
OpenCaptcha bool `json:"open_captcha"`
}
type BootstrapPayload ¶
type BootstrapPayload struct {
Status int `json:"status"`
App BootstrapApp `json:"app"`
Session BootstrapSession `json:"session"`
Actor *Actor `json:"actor"`
Pages []PageEntry `json:"pages"`
Actions []ActionEntry `json:"actions"`
Features BootstrapFeatures `json:"features"`
Security BootstrapSecurity `json:"security"`
Routes BootstrapRoutes `json:"routes"`
UI BootstrapUI `json:"ui"`
Extensions BootstrapExtensions `json:"extensions"`
Request RequestMetadata `json:"request"`
PublicKey string `json:"public_key,omitempty"`
}
type BootstrapRoutes ¶
type BootstrapRoutes struct {
Page string `json:"page"`
Render string `json:"render"`
AppShell string `json:"app_shell"`
StaticBase string `json:"static_base"`
AppAssetsBase string `json:"app_assets_base"`
CaptchaNew string `json:"captcha_new"`
CaptchaBase string `json:"captcha_base"`
APIBase string `json:"api_base"`
ManagementAPIBase string `json:"management_api_base"`
APIAuth string `json:"api_auth"`
APILogin string `json:"api_login"`
APICaptcha string `json:"api_captcha"`
APIGetAuthKey string `json:"api_get_auth_key"`
APIGetTime string `json:"api_get_time"`
APIGetCert string `json:"api_get_cert"`
GetAuthKey string `json:"get_auth_key"`
GetTime string `json:"get_time"`
GetCert string `json:"get_cert"`
Login string `json:"login"`
Logout string `json:"logout"`
}
type BootstrapSecurity ¶
type BootstrapSession ¶
type BootstrapSession struct {
Authenticated bool `json:"authenticated"`
IsAdmin bool `json:"is_admin"`
Username string `json:"username,omitempty"`
ClientID *int `json:"client_id"`
ClientIDs []int `json:"client_ids,omitempty"`
SubjectID string `json:"subject_id,omitempty"`
Provider string `json:"provider,omitempty"`
Kind string `json:"kind,omitempty"`
}
type BootstrapUI ¶
type BootstrapUI struct {
Mode string `json:"mode"`
ManagementShell string `json:"management_shell"`
LegacyPagesEnabled bool `json:"legacy_pages_enabled"`
SPAFallbackEnabled bool `json:"spa_fallback_enabled"`
ReactBootstrapReady bool `json:"react_bootstrap_ready"`
ShellAssetsReady bool `json:"shell_assets_ready"`
ShellAssets ui.ManagementShellAssets `json:"shell_assets"`
}
type CertResponse ¶
type ClientListResponse ¶
type ClientListResponse struct {
Rows any `json:"rows"`
Total int `json:"total"`
IP string `json:"ip"`
Addr string `json:"addr"`
BridgeType string `json:"bridgeType"`
BridgePort int `json:"bridgePort"`
// Traffic is the server-wide forwarded traffic, for administrators.
Traffic *GlobalTrafficPayload `json:"traffic,omitempty"`
}
type CodeDataResponse ¶
type CodeRTTResponse ¶
type CodeResponse ¶
type CodeResponse struct {
Code int `json:"code"`
}
type Context ¶
type Context interface {
BaseContext() context.Context
String(string) string
Int(string, ...int) int
Bool(string, ...bool) bool
Method() string
Host() string
RemoteAddr() string
ClientIP() string
RequestHeader(string) string
SessionValue(string) interface{}
// SetSessionValue and DeleteSessionValue change the session and save it
// in the response; an error says that it could not be saved.
SetSessionValue(string, interface{}) error
DeleteSessionValue(string) error
RespondJSON(int, interface{})
RespondString(int, string)
RespondData(int, string, []byte)
Redirect(int, string)
SetResponseHeader(string, string)
IsWritten() bool
Actor() *Actor
SetActor(*Actor)
Metadata() RequestMetadata
}
type GlobalTrafficPayload ¶ added in v0.34.9
type GlobalTrafficPayload struct {
In int64 `json:"in"`
Out int64 `json:"out"`
InBps int64 `json:"inBps"`
OutBps int64 `json:"outBps"`
Limit int64 `json:"limit"`
}
GlobalTrafficPayload is the traffic forwarded by the whole server: In from visitors to clients and Out back, in bytes and bytes per second, and the global rate limit in bytes per second, 0 for none.
type IPRegisterHourOption ¶ added in v0.34.9
IPRegisterHourOption is a duration offered on the registration page.
type IPRegisterResponse ¶ added in v0.34.9
type IPRegisterResponse struct {
Status int `json:"status"`
Msg string `json:"msg"`
IP string `json:"ip,omitempty"`
Until string `json:"until,omitempty"`
}
IPRegisterResponse answers a registration.
type Options ¶
type Options struct {
NodeID string
Hooks Hooks
Services *webservice.Services
ConfigureServices func(*webservice.Services)
ConfigProvider func() *servercfg.Snapshot
}
type PageEntry ¶
type PageEntry struct {
Controller string `json:"controller"`
Action string `json:"action"`
Section string `json:"section,omitempty"`
Menu string `json:"menu,omitempty"`
Template string `json:"template,omitempty"`
Permission string `json:"permission,omitempty"`
Ownership PageOwnership `json:"ownership,omitempty"`
Protected bool `json:"protected"`
Params []PageParam `json:"params,omitempty"`
RequiredFeatures []PageFeature `json:"required_features,omitempty"`
PagePath string `json:"page_path"`
RenderPath string `json:"render_path"`
DirectPath string `json:"direct_path"`
}
func VisiblePageEntries ¶
func VisiblePageEntries(cfg *servercfg.Snapshot, baseURL string, actor *Actor, authz webservice.AuthorizationService) []PageEntry
type PageFeature ¶
type PageFeature string
const (
PageFeatureAllowUserRegister PageFeature = "allow_user_register"
)
type PageModelResponse ¶
type PageOwnership ¶
type PageOwnership string
const ( PageOwnershipClient PageOwnership = "client" PageOwnershipTunnel PageOwnership = "tunnel" PageOwnershipHost PageOwnership = "host" )
type PageSpec ¶
type PageSpec struct {
Controller string
Action string
Permission string
Ownership PageOwnership
Section string
Menu string
Template string
Params []PageParam
RequiredFeatures []PageFeature
IncludeControllerRoot bool
Protected bool
}
func AllPageSpecs ¶
func AllPageSpecs() []PageSpec
func AvailablePageSpecs ¶
func FindPageSpec ¶
func ProtectedPageSpecs ¶
func ProtectedPageSpecs() []PageSpec
func SessionPageSpecs ¶
func SessionPageSpecs() []PageSpec
type RequestMetadata ¶
type StatusMessageIDResponse ¶
type StatusMessageResponse ¶
type StatusNonceBitsResponse ¶
type StatusNonceCertResponse ¶
type StatusNonceResponse ¶
type TableResponse ¶
type TimeResponse ¶
type TimeResponse struct {
Time int64 `json:"time"`
}