Documentation ¶
Overview ¶
Package tscaddy provides a set of Caddy modules to integrate Tailscale into Caddy.
Index ¶
- type App
- type Auth
- type Node
- type Transport
- func (t *Transport) CaddyModule() caddy.ModuleInfo
- func (t *Transport) Cleanup() error
- func (h *Transport) EnableTLS(config *reverseproxy.TLSConfig) error
- func (t *Transport) Provision(ctx caddy.Context) error
- func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)
- func (h Transport) TLSEnabled() bool
- func (t *Transport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { // DefaultAuthKey is the default auth key to use for Tailscale if no other auth key is specified. DefaultAuthKey string `json:"auth_key,omitempty" caddy:"namespace=tailscale.auth_key"` // ControlURL specifies the default control URL to use for nodes. ControlURL string `json:"control_url,omitempty" caddy:"namespace=tailscale.control_url"` // Ephemeral specifies whether Tailscale nodes should be registered as ephemeral. Ephemeral bool `json:"ephemeral,omitempty" caddy:"namespace=tailscale.ephemeral"` // StateDir specifies the default state directory for Tailscale nodes. // Each node will have a subdirectory under this parent directory for its state. StateDir string `json:"state_dir,omitempty" caddy:"namespace=tailscale.state_dir"` // WebUI specifies whether Tailscale nodes should run the Web UI for remote management. WebUI bool `json:"webui,omitempty" caddy:"namespace=tailscale.webui"` // Nodes is a map of per-node configuration which overrides global options. Nodes map[string]Node `json:"nodes,omitempty" caddy:"namespace=tailscale"` // contains filtered or unexported fields }
App is the Tailscale Caddy app used to configure Tailscale nodes. Nodes can be used to serve sites privately on a Tailscale network, or to connect to other Tailnet nodes as upstream proxy backend.
func (App) CaddyModule ¶
func (App) CaddyModule() caddy.ModuleInfo
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth is an HTTP authentication provider that authenticates users based on their Tailscale identity. If configured on a caddy site that is listening on a tailscale node, that node will be used to identify the user information for inbound requests. Otherwise, it will attempt to find and use the local tailscaled daemon running on the system.
func (Auth) Authenticate ¶
Authenticate authenticates the request and sets Tailscale user data on the caddy User object.
This method will set the following user metadata:
- tailscale_login: the user's login name without the domain
- tailscale_user: the user's full login name
- tailscale_name: the user's display name
- tailscale_profile_picture: the user's profile picture URL
- tailscale_tailnet: the user's tailnet name (if the user is not connecting to a shared node)
func (Auth) CaddyModule ¶
func (Auth) CaddyModule() caddy.ModuleInfo
type Node ¶
type Node struct { // AuthKey is the Tailscale auth key used to register the node. AuthKey string `json:"auth_key,omitempty" caddy:"namespace=auth_key"` // ControlURL specifies the control URL to use for the node. ControlURL string `json:"control_url,omitempty" caddy:"namespace=tailscale.control_url"` // Ephemeral specifies whether the node should be registered as ephemeral. Ephemeral opt.Bool `json:"ephemeral,omitempty" caddy:"namespace=tailscale.ephemeral"` // WebUI specifies whether the node should run the Web UI for remote management. WebUI opt.Bool `json:"webui,omitempty" caddy:"namespace=tailscale.webui"` // Hostname is the hostname to use when registering the node. Hostname string `json:"hostname,omitempty" caddy:"namespace=tailscale.hostname"` // StateDir specifies the state directory for the node. StateDir string `json:"state_dir,omitempty" caddy:"namespace=tailscale.state_dir"` // contains filtered or unexported fields }
Node is a Tailscale node configuration. A single node can be used to serve multiple sites on different domains or ports, and/or to connect to other Tailscale nodes.
type Transport ¶
type Transport struct { Name string `json:"name,omitempty"` // A non-nil TLS config enables TLS. // We do not currently use the config values for anything. TLS *reverseproxy.TLSConfig `json:"tls,omitempty"` // contains filtered or unexported fields }
Transport is a caddy transport that uses a tailscale node to make requests.
func (*Transport) CaddyModule ¶
func (t *Transport) CaddyModule() caddy.ModuleInfo
func (*Transport) EnableTLS ¶
func (h *Transport) EnableTLS(config *reverseproxy.TLSConfig) error
EnableTLS enables TLS on the transport.
func (Transport) TLSEnabled ¶
TLSEnabled returns true if TLS is enabled.
func (*Transport) UnmarshalCaddyfile ¶
UnmarshalCaddyfile populates a Transport config from a caddyfile.
We only support a single token identifying the name of a node in the App config. For example:
reverse_proxy { transport tailscale my-node }
If a node name is not specified, a default name is used.