Documentation
¶
Overview ¶
Package tailnet adapts the stock tsnet.Server. It is the only package that imports Tailscale, so upstream types never reach the public API.
Index ¶
- Variables
- type Peer
- type PeerStatus
- type Server
- func (s *Server) Close() error
- func (s *Server) Dial(ctx context.Context, addr netip.AddrPort) (net.Conn, error)
- func (s *Server) Listen(port uint16) (net.Listener, error)
- func (s *Server) Status(ctx context.Context) (Status, error)
- func (s *Server) WatchRemovals(ctx context.Context, changed func()) (run func() error, err error)
- func (s *Server) WhoIs(ctx context.Context, addr string) (Peer, error)
- type Status
Constants ¶
This section is empty.
Variables ¶
var ErrHostDial = errors.New("tailnet: refusing a connection outside the private network")
Functions ¶
This section is empty.
Types ¶
type Peer ¶
type Peer struct {
ID string // stable node ID assigned by the control server
NodeKey string // the node's public key as the control server holds it, "nodekey:<hex>"
Name string // host name
Addrs []netip.Addr // network addresses
}
Peer is a node identified by the control server.
type PeerStatus ¶
type PeerStatus struct {
Peer
Online bool
Direct string // current direct UDP endpoint; empty when relayed or idle
Relay string // home relay region code
}
PeerStatus is a peer as currently seen by this node.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func Start ¶
func Start(ctx context.Context, dir, controlURL, hostname, authKey string, logf func(string, ...any)) (*Server, error)
Start runs a node and waits until it is connected. authKey is used only when dir holds no registered identity.
func (*Server) Dial ¶
Dial connects over the private network only. tsnet hands an address that is not a current peer at dial time to the host network instead; that connection is closed here and never returned.
func (*Server) WatchRemovals ¶
WatchRemovals subscribes before returning, so no later removal is missed. The returned run calls changed whenever a peer leaves the network map or the backend state changes, until ctx ends or the watch fails.
type Status ¶
type Status struct {
State string // backend state, such as "Running" or "NeedsLogin"
Self Peer
Peers []PeerStatus
}
Status is this node's current view of the network.