@@ -9,22 +9,52 @@ import (
9
9
"tailscale.com/types/key"
10
10
)
11
11
12
+ // TailscaleCoordinator is the interface that wraps the tailscale coordinator
13
+ // methods.
12
14
type TailscaleCoordinator interface {
15
+ // ControlKey returns the control key for coordinator.
13
16
ControlKey () key.MachinePrivate
17
+ // LegacyControlKey returns the legacy control key for coordinator.
14
18
LegacyControlKey () key.MachinePrivate
15
19
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.
16
23
RegisterMachine (req tailcfg.RegisterRequest , peerPublicKey key.MachinePublic ) (tailcfg.RegisterResponse , error )
17
24
25
+ // DerpMap returns the DERP map from the coordinator.
18
26
DerpMap () (tailcfg.DERPMap , error )
19
27
28
+ // KeepAliveInterval is the keep alive interval of the coordinator.
20
29
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.
21
41
PollNetMap (ctx context.Context , req tailcfg.MapRequest , peerPublicKey key.MachinePublic ) (chan tailcfg.MapResponse , chan error )
22
42
43
+ // SetDNS handles the DNS setting request from a tailscale client.
23
44
SetDNS (req tailcfg.SetDNSRequest , peerPublicKey key.MachinePublic ) (tailcfg.SetDNSResponse , error )
24
45
46
+ // HealthChange handles the health change request from a tailscale client.
25
47
HealthChange (req tailcfg.HealthChangeRequest )
26
48
49
+ // IDToken handles the ID token request from a tailscale client.
27
50
IDToken (req tailcfg.TokenRequest , peerPublicKey key.MachinePublic ) (tailcfg.TokenResponse , error )
28
51
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.
29
59
SSHAction (r * http.Request , peerPublicKey key.MachinePublic ) (tailcfg.SSHAction , error )
30
60
}
0 commit comments