@@ -9,22 +9,52 @@ import (
99 "tailscale.com/types/key"
1010)
1111
12+ // TailscaleCoordinator is the interface that wraps the tailscale coordinator
13+ // methods.
1214type TailscaleCoordinator interface {
15+ // ControlKey returns the control key for coordinator.
1316 ControlKey () key.MachinePrivate
17+ // LegacyControlKey returns the legacy control key for coordinator.
1418 LegacyControlKey () key.MachinePrivate
1519
20+ // RegisterMachine is responsible for registering the machine with the
21+ // coordinator. It returns the registration response from the coordinator
22+ // and an error if any.
1623 RegisterMachine (req tailcfg.RegisterRequest , peerPublicKey key.MachinePublic ) (tailcfg.RegisterResponse , error )
1724
25+ // DerpMap returns the DERP map from the coordinator.
1826 DerpMap () (tailcfg.DERPMap , error )
1927
28+ // KeepAliveInterval is the keep alive interval of the coordinator.
2029 KeepAliveInterval () time.Duration
30+ // PollNetMap handles the netmap polling request from a tailscale client. It
31+ // returns a channel of netmap responses and a channel of errors.
32+ //
33+ // - If the request is a streaming one, the channels are not to be closed
34+ // and new responses will be sent on the channels.
35+ //
36+ // - If the request is a non-streaming one, the channels are to be closed
37+ // after the first response is sent.
38+ //
39+ // - If the request gets closed or cancelled by the tailscale client, the
40+ // context will be cancelled and the channels shall not be used anymore.
2141 PollNetMap (ctx context.Context , req tailcfg.MapRequest , peerPublicKey key.MachinePublic ) (chan tailcfg.MapResponse , chan error )
2242
43+ // SetDNS handles the DNS setting request from a tailscale client.
2344 SetDNS (req tailcfg.SetDNSRequest , peerPublicKey key.MachinePublic ) (tailcfg.SetDNSResponse , error )
2445
46+ // HealthChange handles the health change request from a tailscale client.
2547 HealthChange (req tailcfg.HealthChangeRequest )
2648
49+ // IDToken handles the ID token request from a tailscale client.
2750 IDToken (req tailcfg.TokenRequest , peerPublicKey key.MachinePublic ) (tailcfg.TokenResponse , error )
2851
52+ // SSHAction handles the SSH action request from a tailscale client.
53+ //
54+ // It returns the SSH action response and an error if any. Additionally, the
55+ // entire request is provided to the implementation as the request may
56+ // contain additional information that is not known to the library.
57+ //
58+ // This method handles all noise requests to the `/ssh/action/*` pattern.
2959 SSHAction (r * http.Request , peerPublicKey key.MachinePublic ) (tailcfg.SSHAction , error )
3060}
0 commit comments