4
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2025-06-14 19:46:05 +00:00

Merge pull request #360 from neilalexander/multilink

Support for multiple listeners
This commit is contained in:
Arceliar
2019-03-08 18:56:47 -06:00
committed by GitHub
17 changed files with 359 additions and 203 deletions

View File

@ -134,12 +134,20 @@ func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *nodeCo
}
}
}
// Do a quick check for old-format Listen statement so that mapstructure
// doesn't fail and crash
if listen, ok := dat["Listen"].(string); ok {
if strings.HasPrefix(listen, "tcp://") {
dat["Listen"] = []string{listen}
} else {
dat["Listen"] = []string{"tcp://" + listen}
}
}
// Overlay our newly mapped configuration onto the autoconf node config that
// we generated above.
if err = mapstructure.Decode(dat, &cfg); err != nil {
panic(err)
}
return cfg
}