Documentation ¶
Overview ¶
Package tsnet provides metehods for creating Tailscale virtual private service for HTTP resources.
Index ¶
Constants ¶
const WHOIS_CONTEXT_KEY string = "x-urn:aaronland:tsnet#whois"
WHOIS_CONTEXT_KEY is the key used to store `apitype.WhoIsResponse` instances in a `context.Context` instance.
Variables ¶
This section is empty.
Functions ¶
func GetWhoIs ¶
func GetWhoIs(req *http.Request) (*apitype.WhoIsResponse, error)
GetWhoIs will return the Tailscale `apitype.WhoIsResponse` instance stored in the 'req.Context'.
func NewTSNetServer ¶
NewTSNetServer returns a new `TSNetServer` instance configured by 'uri' which is expected to be defined in the form of:
tsnet://{HOSTNAME}:{PORT}?{PARAMETERS}
Valid parameters are: * `auth-key` is a valid Tailscale auth key. If absent it is assumed that a valid `TS_AUTH_KEY` environment variable has already been set.
Types ¶
type TSNetServer ¶
type TSNetServer struct { server.Server // contains filtered or unexported fields }
TSNServer implements the `Server` interface for a `net/http` server running as a Tailscale virtual private service.
func (*TSNetServer) Address ¶
func (s *TSNetServer) Address() string
Address returns the fully-qualified URI where the server instance can be contacted.
func (*TSNetServer) ListenAndServe ¶
ListenAndServe starts the server and listens for requests using 'mux' for routing. Additionally each handler in mux will be wrapped by a middleware handler that will ensure a Tailscale `api.WhoIsResponse` instance can be derived from the current request and then store that value in the request's context. This value can be retrieved using the `GetWhoIs` method.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
example
example is a command-line application demonstrating how a tsnet-enabled HTTP server works.
|
example is a command-line application demonstrating how a tsnet-enabled HTTP server works. |
Package http provides methods for creating tsnet-specific `http.Handler` instances
|
Package http provides methods for creating tsnet-specific `http.Handler` instances |
www
Package www provides user-facing HTTP handlers
|
Package www provides user-facing HTTP handlers |