mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-10 00:51:07 +00:00
tailcfg: add TailscaleSSHEnabled helper check (#4812)
This commit adds a helper to check if Tailscale SSH is enabled. We're currently checking the SSH_HostKeys field in a few places, but later plan to add an explicit bool. This helper makes the check and any future changes easier. Signed-off-by: Ross Zurowski <ross@rosszurowski.com>
This commit is contained in:
@@ -475,6 +475,14 @@ type Hostinfo struct {
|
||||
// require changes to Hostinfo.Equal.
|
||||
}
|
||||
|
||||
// TailscaleSSHEnabled reports whether or not this node is acting as a
|
||||
// Tailscale SSH server.
|
||||
func (hi *Hostinfo) TailscaleSSHEnabled() bool {
|
||||
// Currently, we use `SSH_HostKeys` as a proxy for this. However, we may later
|
||||
// include non-Tailscale host keys, and will add a separate flag to rely on.
|
||||
return hi != nil && len(hi.SSH_HostKeys) > 0
|
||||
}
|
||||
|
||||
// NetInfo contains information about the host's network state.
|
||||
type NetInfo struct {
|
||||
// MappingVariesByDestIP says whether the host's NAT mappings
|
||||
|
Reference in New Issue
Block a user