Documentation
¶
Overview ¶
Package mesh puts this worker on its project's Mainplane Network: tailscale's engine (wireguard-go, magicsock, the DERP client) on a TUN of its own, with its own state, UDP port, and router, so it runs beside a user's own Tailscale. The coordinator and relay are the harness's, reached over WebSocket at its front door URL, which the harness key proves.
Index ¶
Constants ¶
const (
// Every long name is one label under it: one wildcard covers them all.
Domain = "mainplane.net"
)
Names come from a block in the hosts file, which every OS reads before DNS, so no resolver is touched. Other tools' lines stay as they are.
const Removed = "removed"
Removed marks a mesh directory whose node the harness removed. Its keys stay refused, so they stay too, until an install starts the node anew.
Variables ¶
var ErrNoWorker = errors.New("this machine is not a worker")
ErrNoWorker is a socket no worker answers: none runs on this machine.
var Prefix = netip.MustParsePrefix("fd7c:9a2e:4b10::/48")
Prefix holds every node's address, prefix::N. It is one random ULA /48, so it meets no LAN and not Tailscale's 100.64/10 or fd7a:115c:a1e0::/48.
Functions ¶
func Clean ¶
func Clean() error
Clean removes what a killed worker left: the hosts block, a status socket no worker answers (off Windows, where a named pipe goes with its process), and on Linux and Windows the rule. Uninstall runs it after the worker stops.
func Harness ¶ added in v0.4.0
Harness is the key of the harness the worker on this machine follows, and the address of its peer named name, the harness's node, while the map poll is up. A CLI whose harness has that key reaches it there, off the tunnel.
func Joined ¶ added in v0.5.0
Joined is the key of the harness the worker on this machine follows, and its name there, once the harness has registered it and until it removes it. A worker that never joined, as with a revoked token, is an error.
Types ¶
type Mesh ¶
type Mesh struct {
// contains filtered or unexported fields
}
Mesh is this worker's node.
func Up ¶
Up brings the node up with its state in dir: the TUN, then the engine. It registers as name with the join secret on first start; the keys in dir register again with none. It follows the harness with key harness through the pointer and moves its control client when the harness moves. On the harness's own machine, as admin, control is the harness on loopback: no tunnel or pointer. Its relay is still the tunnel's.
func (*Mesh) Close ¶
Close leaves the mesh: the status socket, the hosts block go, the router takes its address, route and rule away, and the TUN goes.
func (*Mesh) Logout ¶ added in v0.5.0
Logout deletes this node from the harness's registry, so the name is free for the next node from this machine, which has new keys. It waits for follow to end first, which would register the node again; Close follows.
func (*Mesh) Peer ¶
Peer is the address of the peer named name in the last map, which stays while the coordinator is out of reach.
func (*Mesh) Removed ¶
func (m *Mesh) Removed() <-chan struct{}
Removed is closed once the harness has removed this worker and it has left the mesh.