These are statically discovered using #17670.
This migrates all usages of omitempty to instead use omitzero
where it is safe to do so. These should behave the same as before,
but allow the behavior to be identical between v1 and v2.
Updates tailscale/corp#791
Signed-off-by: Joe Tsai <joetsai@digital-static.net>
AcceptRoutesopt.Bool`json:",omitzero"`// Accepts routes advertised by other Tailscale nodes.
AdvertiseServices[]string`json:",omitempty"`// Tailscale Services to advertise.
APIServerProxy*APIServerProxyConfig`json:",omitempty"`// Config specific to the API Server proxy.
APIServerProxy*APIServerProxyConfig`json:",omitzero"`// Config specific to the API Server proxy.
StaticEndpoints[]netip.AddrPort`json:",omitempty"`// StaticEndpoints are additional, user-defined endpoints that this node should advertise amongst its wireguard endpoints.
}
typeAPIServerProxyConfigstruct{
Enabledopt.Bool`json:",omitempty"`// Whether to enable the API Server proxy.
Mode*kubetypes.APIServerProxyMode`json:",omitempty"`// "auth" or "noauth" mode.
ServiceName*tailcfg.ServiceName`json:",omitempty"`// Name of the Tailscale Service to advertise.
IssueCertsopt.Bool`json:",omitempty"`// Whether this replica should issue TLS certs for the Tailscale Service.
Enabledopt.Bool`json:",omitzero"`// Whether to enable the API Server proxy.
Mode*kubetypes.APIServerProxyMode`json:",omitzero"`// "auth" or "noauth" mode.
ServiceName*tailcfg.ServiceName`json:",omitzero"`// Name of the Tailscale Service to advertise.
IssueCertsopt.Bool`json:",omitzero"`// Whether this replica should issue TLS certs for the Tailscale Service.
}
// Load reads and parses the config file at the provided path on disk.
Desktopopt.Bool`json:",omitempty"`// if a desktop was detected on Linux
Desktopopt.Bool`json:",omitzero"`// if a desktop was detected on Linux
Packagestring`json:",omitempty"`// Tailscale package to disambiguate ("choco", "appstore", etc; "" for unknown)
DeviceModelstring`json:",omitempty"`// mobile phone model ("Pixel 3a", "iPhone12,3")
PushDeviceTokenstring`json:",omitempty"`// macOS/iOS APNs device token for notifications (and Android in the future)
@ -879,27 +879,27 @@ type Hostinfo struct {
RequestTags[]string`json:",omitempty"`// set of ACL tags this node wants to claim
WoLMACs[]string`json:",omitempty"`// MAC address(es) to send Wake-on-LAN packets to wake this node (lowercase hex w/ colons)
Services[]Service`json:",omitempty"`// services advertised by this machine
NetInfo*NetInfo`json:",omitempty"`
NetInfo*NetInfo`json:",omitzero"`
SSH_HostKeys[]string`json:"sshHostKeys,omitempty"`// if advertised
Cloudstring`json:",omitempty"`
Userspaceopt.Bool`json:",omitempty"`// if the client is running in userspace (netstack) mode
UserspaceRouteropt.Bool`json:",omitempty"`// if the client's subnet router is running in userspace (netstack) mode
AppConnectoropt.Bool`json:",omitempty"`// if the client is running the app-connector service
Userspaceopt.Bool`json:",omitzero"`// if the client is running in userspace (netstack) mode
UserspaceRouteropt.Bool`json:",omitzero"`// if the client's subnet router is running in userspace (netstack) mode
AppConnectoropt.Bool`json:",omitzero"`// if the client is running the app-connector service
ServicesHashstring`json:",omitempty"`// opaque hash of the most recent list of tailnet services, change in hash indicates config should be fetched via c2n
ExitNodeIDStableNodeID`json:",omitzero"`// the client’s selected exit node, empty when unselected.
// Location represents geographical location data about a
// Tailscale host. Location is optional and only set if
// explicitly declared by a node.
Location*Location`json:",omitempty"`
Location*Location`json:",omitzero"`
TPM*TPMInfo`json:",omitempty"`// TPM device metadata, if available
TPM*TPMInfo`json:",omitzero"`// TPM device metadata, if available
// StateEncrypted reports whether the node state is stored encrypted on
// disk. The actual mechanism is platform-specific:
// * Apple nodes use the Keychain
// * Linux and Windows nodes use the TPM
// * Android apps use EncryptedSharedPreferences
StateEncryptedopt.Bool`json:",omitempty"`
StateEncryptedopt.Bool`json:",omitzero"`
// NOTE: any new fields containing pointers in this type
// require changes to Hostinfo.Equal.
@ -1234,7 +1234,7 @@ type RegisterResponseAuth struct {
// At most one of Oauth2Token or AuthKey is set.
Oauth2Token*Oauth2Token`json:",omitempty"`// used by pre-1.66 Android only
Oauth2Token*Oauth2Token`json:",omitzero"`// used by pre-1.66 Android only
AuthKeystring`json:",omitempty"`
}
@ -1256,7 +1256,7 @@ type RegisterRequest struct {
NodeKeykey.NodePublic
OldNodeKeykey.NodePublic
NLKeykey.NLPublic
Auth*RegisterResponseAuth`json:",omitempty"`
Auth*RegisterResponseAuth`json:",omitzero"`
// Expiry optionally specifies the requested key expiry.
// The server policy may override.
// As a special case, if Expiry is in the past and NodeKey is