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 slog. 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.
Without WithLogger, it logs through the default logger as it is when NewServer is called, with a component=tailscale attribute.
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.
Types ¶
type Listener ¶
type Listener interface {
Listen(network, addr string) (net.Listener, error)
ListenTLS(network, addr string) (net.Listener, error)
}
Listener is the part of tsnet.Server that Serve uses.
type Option ¶ added in v0.0.2
type Option func(*serverOptions)
Option configures NewServer.
func WithLogger ¶ added in v0.0.2
WithLogger logs through logger as given, adding no attributes.