diff --git a/cmd/yggdrasilctl/main.go b/cmd/yggdrasilctl/main.go index ca3078b..dcbde87 100644 --- a/cmd/yggdrasilctl/main.go +++ b/cmd/yggdrasilctl/main.go @@ -183,10 +183,10 @@ func main() { } case "getself": for k, v := range res["self"].(map[string]interface{}) { - if buildname, ok := v.(map[string]interface{})["build_name"].(string); ok { + if buildname, ok := v.(map[string]interface{})["build_name"].(string); ok && buildname != "unknown" { fmt.Println("Build name:", buildname) } - if buildversion, ok := v.(map[string]interface{})["build_version"].(string); ok { + if buildversion, ok := v.(map[string]interface{})["build_version"].(string); ok && buildversion != "unknown" { fmt.Println("Build version:", buildversion) } fmt.Println("IPv6 address:", k) diff --git a/src/yggdrasil/admin.go b/src/yggdrasil/admin.go index 7d82b13..2c65b6a 100644 --- a/src/yggdrasil/admin.go +++ b/src/yggdrasil/admin.go @@ -556,13 +556,18 @@ func (a *admin) getData_getSelf() *admin_nodeInfo { table := a.core.switchTable.table.Load().(lookupTable) coords := table.self.getCoords() self := admin_nodeInfo{ - {"build_name", GetBuildName()}, - {"build_version", GetBuildVersion()}, {"box_pub_key", hex.EncodeToString(a.core.boxPub[:])}, {"ip", a.core.GetAddress().String()}, {"subnet", a.core.GetSubnet().String()}, {"coords", fmt.Sprint(coords)}, } + if name := GetBuildName(); name != "unknown" { + self = append(self, admin_pair{"build_name", name}) + } + if version := GetBuildVersion(); version != "unknown" { + self = append(self, admin_pair{"build_version", version}) + } + return &self } diff --git a/src/yggdrasil/core.go b/src/yggdrasil/core.go index 682d815..5ab91a7 100644 --- a/src/yggdrasil/core.go +++ b/src/yggdrasil/core.go @@ -87,11 +87,11 @@ func GetBuildVersion() string { func (c *Core) Start(nc *config.NodeConfig, log *log.Logger) error { c.log = log - if buildName != "" { - c.log.Println("Build name:", buildName) + if name := GetBuildName(); name != "unknown" { + c.log.Println("Build name:", name) } - if buildVersion != "" { - c.log.Println("Build version:", buildVersion) + if version := GetBuildVersion(); version != "unknown" { + c.log.Println("Build version:", version) } c.log.Println("Starting up...")