Documentation
¶
Overview ¶
Package buildinfo holds values stamped into the binaries at build time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Built = ""
Built is the Unix time (decimal seconds) of the source commit, set with -X github.com/mistgate/mistgate/internal/buildinfo.Built=<git log -1 --format=%ct>. It orders releases: the version string ("0.1.0-<hash>") does not. Empty = a build without it (go run, go test): BuiltUnix is 0.
var ErrReleaseKeyMismatch = errors.New("buildinfo: <data-dir>/release.pub is not the release key compiled into this binary; " +
"nothing is trusted until you confirm the new key with `mistgate release trust-key`")
ErrReleaseKeyMismatch is LoadReleasePublicKey's answer when <data-dir>/release.pub and the compiled-in key differ.
var ErrUnsignedBuild = errors.New("unsigned build: update by hand")
ErrUnsignedBuild is what a binary without ReleaseKey answers to anything that needs to verify a release.
var ReleaseKey = ""
ReleaseKey is the owner's release public key, 32 bytes of ed25519 in standard base64, set with -X github.com/mistgate/mistgate/internal/buildinfo.ReleaseKey=<base64>. Both binaries carry it; the node agent trusts an update only if the owner signed it. Empty = unsigned build: self-update is off.
var Version = "0.1.0-dev"
Version is set with -ldflags "-X github.com/mistgate/mistgate/internal/buildinfo.Version=1.2.3".
Functions ¶
func BuiltUnix ¶
func BuiltUnix() int64
BuiltUnix is Built as a number; 0 when it is empty or not a positive decimal integer.
func KeyFingerprint ¶
KeyFingerprint is the first 16 hex characters of SHA-256 of a public key: what `mistgate release keygen` prints next to the key and the Updates page shows, to compare by eye.
func LoadReleasePublicKey ¶
LoadReleasePublicKey is the installation's release trust root. The first keyed build stores its public key in the data directory. A later build with the same key uses it; one with another compiled-in key gets ErrReleaseKeyMismatch (a key rotation is an explicit step, TrustCompiledReleaseKey, never a side effect of a file in the data directory or of a new binary); a build without a key keeps using the stored one.
func ReleasePublicKey ¶
ReleasePublicKey decodes ReleaseKey. It returns ErrUnsignedBuild when there is none, and another error when the stamped value is not a valid key (a broken build must not look like an unsigned one).
func TrustCompiledReleaseKey ¶ added in v0.1.15
TrustCompiledReleaseKey makes the key compiled into this binary the installation's release key: the explicit step of a key rotation. It returns the key it replaced (nil when there was none).
Types ¶
This section is empty.