Documentation
¶
Index ¶
- func ResolveAuthKey(ctx context.Context, v, tags string) (string, error)
- type Config
- type Server
- func (s *Server) CloseTunnels()
- func (s *Server) Dial(ctx context.Context, network, address string) (net.Conn, error)
- func (s *Server) Listen(network, address string) (net.Listener, error)
- func (s *Server) SetupTunnels(ctx context.Context, tunnels []Tunnel) error
- func (s *Server) Shutdown()
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) StartIdleTimeoutChecker(ctx context.Context, timeout time.Duration)
- func (s *Server) StopTunnel(name string)
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveAuthKey ¶
ResolveAuthKey either returns v unchanged (in the common case) or, if it starts with "tskey-client-" (as Tailscale OAuth secrets do) parses it like
tskey-client-xxxx[?ephemeral=false&bar&preauthorized=BOOL&baseURL=...]
and does the OAuth2 dance to get and return an authkey. The "ephemeral" property defaults to true if unspecified. The "preauthorized" defaults to false. The "baseURL" defaults to https://api.tailscale.com. The passed in tags are required, and must be non-empty. These will be set on the authkey generated by the OAuth2 dance.
Types ¶
type Config ¶
type Config struct {
Tunnels []Tunnel `json:"tunnels"`
}
Config represents the application configuration
func LoadConfig ¶
LoadConfig reads and parses the configuration file
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the tsnet server and its configuration
func (*Server) CloseTunnels ¶
func (s *Server) CloseTunnels()
CloseTunnels closes all active tunnels
func (*Server) SetupTunnels ¶
SetupTunnels initializes all enabled tunnels
func (*Server) StartIdleTimeoutChecker ¶
StartIdleTimeoutChecker starts a goroutine to check for idle timeout
func (*Server) StopTunnel ¶
StopTunnel disables a single tunnel