mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-09 16:20:26 +00:00
Only show build name and version if it is known
This commit is contained in:
parent
f2d01aa54d
commit
02f98a2592
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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...")
|
||||
|
Loading…
Reference in New Issue
Block a user