Documentation
¶
Overview ¶
Package connector joins one Open Machine device to a private network served by a Tailscale-protocol control server, and carries TCP between peers that the control server permits.
The control server decides which peers and ports are reachable, and the caller may narrow that further. A Node only accepts or dials connections whose remote end is a current peer the caller allows, and closes them when that peer leaves the network map or the caller no longer allows it. Log upload to Tailscale is disabled for the whole process.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Dir string // private state directory; created owner-only if missing
ControlURL string // http or https URL of the control server
Hostname string
AuthKey string // one-use registration key; ignored once Dir holds an identity
Logf func(string, ...any) // optional; nil discards logs
// Allow, if set, narrows what the control server permits: a connection
// with peer is admitted and kept only while it returns true. Call
// Revalidate after its answers change. It may be called concurrently and
// should return quickly.
Allow func(peer Peer) bool
}
Config describes one node.
type Conn ¶
Conn is a TCP connection to a verified peer.
func (*Conn) RemoteAddr ¶
RemoteAddr returns the address the peer was verified at. Unlike the netstack's, it stays set once the connection is closed or reset.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a running network node. Close it to leave the network.
func (*Node) Close ¶
Close closes every connection and leaves the network. The node's identity stays in its state directory.
func (*Node) Dial ¶
Dial connects to a current peer that Allow permits. Addresses outside the network are refused rather than dialed through the host network.
func (*Node) Revalidate ¶
func (n *Node) Revalidate()
Revalidate closes the connections whose peer no longer owns the remote address or that Allow no longer permits. Removals from the network map are applied automatically.
type PeerStatus ¶
type PeerStatus = tailnet.PeerStatus