Add build version to NetBird client user agent. (#248)

This also fix the runtime import aliases to avoid conflicts with stdlib
runtime.
This commit is contained in:
Philip Laine
2026-05-13 12:43:46 +02:00
committed by GitHub
parent 0ef20e5dc3
commit 360ef52aa3
4 changed files with 45 additions and 14 deletions
+30
View File
@@ -2,6 +2,36 @@
package version
import (
"runtime/debug"
)
func ClientImage() string {
return "ghcr.io/netbirdio/netbird:0.70.4@sha256:3a28b9f7f32875c6a35f952ca7e9cb688b1e610365365ff55f6e790da3950f55"
}
func BuildVersion() string {
bi, ok := debug.ReadBuildInfo()
if !ok {
return "unknown"
}
modified := true
for _, s := range bi.Settings {
if s.Key == "vcs.modified" {
if s.Value == "false" {
modified = false
}
break
}
}
develVersion := "devel"
if modified {
return develVersion
}
if bi.Main.Version == "" {
return develVersion
}
return bi.Main.Version
}