Documentation
¶
Overview ¶
Package tailscale sets up tsnet nodes and serves HTTP handlers on them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
NewServer returns a tsnet server with the given hostname, state directory and auth key, logging through the default slog logger. Messages meant for the user (such as login URLs) are logged at info level, and backend chatter at debug level. Empty dir and authKey leave tsnet's defaults in place.
func Serve ¶
Serve serves handler over HTTPS on port 443 of s, and redirects plain HTTP on port 80 to the same path at https://name, until ctx is done. name should be the node's full MagicDNS name, as returned by Up, as that's the name on the certificate.
When ctx is done the servers are shut down gracefully, giving in-flight requests a few seconds to finish before their connections are closed. Serve returns nil after a clean shutdown, or the error that stopped it otherwise.