diff options
| author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2021-09-29 12:19:16 -0700 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@tailscale.com> | 2021-09-29 12:21:27 -0700 |
| commit | d39e972e595a2f39526f323584e2991863c27502 (patch) | |
| tree | f70b37637020e6af83e84126abe685e9ac53fcae /version/updates/updates.go | |
| parent | 0fa1da2d1b1a89102a6199b99ce3c07e725aade0 (diff) | |
| download | tailscale-bradfitz/updates.tar.xz tailscale-bradfitz/updates.zip | |
version/updates: start of version updates policy packagebradfitz/updates
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'version/updates/updates.go')
| -rw-r--r-- | version/updates/updates.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/version/updates/updates.go b/version/updates/updates.go new file mode 100644 index 000000000..df39e6bd9 --- /dev/null +++ b/version/updates/updates.go @@ -0,0 +1,50 @@ +// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Packate updates is an evalator for a update policy file that controls +// when users get update available notifications (and which types). +// +// It's used and hot reloaded by several servers. It permits us to +// centralize and test the update policy. +package updates + +type Policy struct { + Tests []*Test + Rules []*Rule +} + +type Test struct { + OS string + Distro string // "synology" on Linux + Ver string // "1.2.3-tXXXX-gXXX" + Want string // "", "update", "update/security" +} + +type Rule struct { + // Ver, if non-empty, matches the version number. + // If it begins with an operator ("<", "<=", then the comparison + // is done semantically based on semver, not lexically. + Ver string + + // OS, if non-empty, matches the node operating system. + // Possible values: "linux", "windows", "macOS", "iOS", or + // else a runtime.GOOS value (except not "darwin" or "ios"). + OS string + + // Package, if non-empty, matches the packaging variant. + // Possible values: "choco", "appstore", "macsys", "tailscaled". + Package string + + // Distro, if non-empty, matches the node's distro. + // Possible values: "synology". + Distro string + + // Now, if non-empty, matches based on the current date in UTC. + // e.g. ">=2021-10-07". + Now string + + Then string // "stop", "update", "update/security", "update: note" + ThenRules []*Rule + ElseRules []*Rule +} |
