5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-09-19 16:09:36 +00:00

attempt to convert old multicast listen regexps into new struct format

This commit is contained in:
Arceliar 2021-06-27 03:33:29 -05:00
parent 2874ce1327
commit a42b77db84

View File

@ -96,6 +96,24 @@ func readConfig(log *log.Logger, useconf *bool, useconffile *string, normaliseco
}
}
}
if oldmc, ok := dat["MulticastInterfaces"]; ok {
fmt.Println("DEBUG:", oldmc)
if oldmcvals, ok := oldmc.([]interface{}); ok {
var newmc []config.MulticastInterfaceConfig
for _, oldmcval := range oldmcvals {
if str, ok := oldmcval.(string); ok {
newmc = append(newmc, config.MulticastInterfaceConfig{
Regex: str,
Incoming: true,
Outgoing: true,
})
}
}
if newmc != nil {
dat["MulticastInterfaces"] = newmc
}
}
}
// Sanitise the config
confJson, err := json.Marshal(dat)
if err != nil {