Documentation
¶
Overview ¶
Package tsid is a Caddy plugin that allows access only to requests coming from the Tailscale network and allows to identify users behind these requests by setting some Caddy placeholders.
Index ¶
Constants ¶
View Source
const ( RangePrefix = "ip" LoginPrefix = "login" CapabilityPrefix = "cap" )
View Source
const LenientEmailRegexString = "^[^@]+@[^@]+\\.[^@]+$"
View Source
const (
TailscaleAdminCap = tailcfg.NodeCapability("https://tailscale.com/cap/is-admin")
)
Variables ¶
View Source
var LenientEmailRegex *regexp.Regexp
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware struct { RawAllowed []string `json:"allowed,omitempty"` // contains filtered or unexported fields }
Middleware is a Caddy HTTP handler that allows requests only from the Tailscale network and sets placeholders based on the Tailscale node information.
func (Middleware) CaddyModule ¶
func (Middleware) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Middleware) Provision ¶
func (m *Middleware) Provision(ctx caddy.Context) error
func (*Middleware) ServeHTTP ¶
func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
ServeHTTP implements the caddyhttp.MiddlewareHandler interface.
func (*Middleware) UnmarshalCaddyfile ¶
func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile implements the caddyfile.Unmarshaler interface.
type Requirements ¶
func (Requirements) HasCapacities ¶
func (a Requirements) HasCapacities(m tailcfg.NodeCapMap) bool
func (Requirements) IsIpAllowed ¶
func (a Requirements) IsIpAllowed(ip netip.Addr) bool
func (Requirements) IsLoginAllowed ¶
func (a Requirements) IsLoginAllowed(s string) bool
func (Requirements) IsWhoIsLegal ¶
func (a Requirements) IsWhoIsLegal(whoIs *apitype.WhoIsResponse) bool
Click to show internal directories.
Click to hide internal directories.