From a42b77db84bf1488547a66147c8b5376520da784 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 27 Jun 2021 03:33:29 -0500 Subject: [PATCH] attempt to convert old multicast listen regexps into new struct format --- cmd/yggdrasil/main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cmd/yggdrasil/main.go b/cmd/yggdrasil/main.go index 79c243b..67a822e 100644 --- a/cmd/yggdrasil/main.go +++ b/cmd/yggdrasil/main.go @@ -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 {