web
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package web provides the Tailscale client for web.
Index¶
Constants¶
const ListenPort = 5252ListenPort is the static port used for the web client when run inside tailscaled.(5252 are the numbers above the letters "TSTS" on a qwerty keyboard.)
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeServer¶
type Server struct {// contains filtered or unexported fields}Server is the backend server for a Tailscale web client.
funcNewServer¶
func NewServer(optsServerOpts) (s *Server, errerror)
NewServer constructs a new Tailscale web client server.If err is empty, s is always non-nil.ctx is only required to live the duration of the NewServer call,and not the lifespan of the web server.
typeServerMode¶added inv1.54.0
type ServerModestring
ServerMode specifies the mode of a running web.Server.
const (// LoginServerMode serves a read-only login client for logging a// node into a tailnet, and viewing a read-only interface of the// node's current Tailscale settings.//// In this mode, API calls are authenticated via platform auth.LoginServerModeServerMode = "login"// ReadOnlyServerMode is identical to LoginServerMode,// but does not present a login button to switch to manage mode,// even if the management client is running and reachable.//// This is designed for platforms where the device is configured by other means,// such as Home Assistant's declarative YAML configuration.ReadOnlyServerModeServerMode = "readonly"// ManageServerMode serves a management client for editing tailscale// settings of a node.//// This mode restricts the app to only being assessible over Tailscale,// and API calls are authenticated via browser sessions associated with// the source's Tailscale identity. If the source browser does not have// a valid session, a read-only version of the app is displayed.ManageServerModeServerMode = "manage")
typeServerOpts¶added inv1.50.0
type ServerOpts struct {// Mode specifies the mode of web client being constructed.ModeServerMode// CGIMode indicates if the server is running as a CGI script.CGIModebool// PathPrefix is the URL prefix added to requests by CGI or reverse proxy.PathPrefixstring// LocalClient is the local.Client to use for this web server.// If nil, a new one will be created.LocalClient *local.Client// TimeNow optionally provides a time function.// time.Now is used as default.TimeNow func()time.Time// Logf optionally provides a logger function.// If nil, log.Printf is used as default.Logflogger.Logf// PolicyClient, if non-nil, will be used to fetch policy settings.// If nil, the default policy client will be used.PolicyClientpolicyclient.Client// NewAuthURL should be provided as a function that generates// a new tailcfg.WebClientAuthResponse.// This field is required for ManageServerMode mode.NewAuthURL func(ctxcontext.Context, srctailcfg.NodeID) (*tailcfg.WebClientAuthResponse,error)// WaitAuthURL should be provided as a function that blocks until// the associated tailcfg.WebClientAuthResponse has been marked// as completed.// This field is required for ManageServerMode mode.WaitAuthURL func(ctxcontext.Context, idstring, srctailcfg.NodeID) (*tailcfg.WebClientAuthResponse,error)// OriginOverride specifies the origin that the web UI will be accessible from if hosted behind a reverse proxy or CGI.OriginOverridestring}ServerOpts contains options for constructing a new Server.