Documentation ¶
Overview ¶
Package tsnet provides Tailscale as a library.
It is an experimental work in progress.
Index ¶
- type Server
- func (s *Server) APIClient() (*tailscale.Client, error)
- func (s *Server) Close() error
- func (s *Server) Dial(ctx context.Context, network, address string) (net.Conn, error)
- func (s *Server) Listen(network, addr string) (net.Listener, error)
- func (s *Server) LocalClient() (*tailscale.LocalClient, error)
- func (s *Server) Start() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { // Dir specifies the name of the directory to use for // state. If empty, a directory is selected automatically // under os.UserConfigDir (https://golang.org/pkg/os/#UserConfigDir). // based on the name of the binary. Dir string // Store specifies the state store to use. // // If nil, a new FileStore is initialized at `Dir/tailscaled.state`. // See tailscale.com/ipn/store for supported stores. // // Logs will automatically be uploaded to uploaded to log.tailscale.io, // where the configuration file for logging will be saved at // `Dir/tailscaled.log.conf`. Store ipn.StateStore // Hostname is the hostname to present to the control server. // If empty, the binary name is used. Hostname string // Logf, if non-nil, specifies the logger to use. By default, // log.Printf is used. Logf logger.Logf // Ephemeral, if true, specifies that the instance should register // as an Ephemeral node (https://tailscale.com/kb/1111/ephemeral-nodes/). Ephemeral bool // AuthKey, if non-empty, is the auth key to create the node // and will be preferred over the TS_AUTHKEY environment // variable. If the node is already created (from state // previously stored in in Store), then this field is not // used. AuthKey string // ControlURL optionally specifies the coordination server URL. // If empty, the Tailscale default is used. ControlURL string // contains filtered or unexported fields }
Server is an embedded Tailscale server.
Its exported fields may be changed until the first call to Listen.
func (*Server) APIClient ¶ added in v1.34.0
APIClient returns a tailscale.Client that can be used to make authenticated requests to the Tailscale control server. It requires the user to set tailscale.I_Acknowledge_This_API_Is_Unstable.
func (*Server) Close ¶ added in v1.24.0
Close stops the server.
It must not be called before or concurrently with Start.
func (*Server) Dial ¶ added in v1.20.0
Dial connects to the address on the tailnet. It will start the server if it has not been started yet.
func (*Server) Listen ¶
Listen announces only on the Tailscale network. It will start the server if it has not been started yet.
func (*Server) LocalClient ¶ added in v1.26.0
func (s *Server) LocalClient() (*tailscale.LocalClient, error)
LocalClient returns a LocalClient that speaks to s.
It will start the server if it has not been started yet. If the server's already been started successfully, it doesn't return an error.