tsid

package module
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2022 License: MIT Imports: 11 Imported by: 0

README

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:

Placeholder Description
{http.vars.tailscale.name} User name
{http.vars.tailscale.email} User email

Usage

  1. Build Caddy with this plugin by xcaddy:

     $ xcaddy build --with go.astrophena.name/tsid
    
  2. Make sure that tsid is ordered first:

     {
       order tsid first
     }
    
  3. Add the tsid directive to your Caddyfile and use the placeholders:

     tsid
    
     respond "Hello, {http.vars.tailscale.name}!"
    

License

MIT © Ilya Mateyko

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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware struct{}

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) ServeHTTP

ServeHTTP implements the caddyhttp.MiddlewareHandler interface.

func (Middleware) UnmarshalCaddyfile

func (Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements the caddyfile.Unmarshaler interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL