Start factoring out the admin socket into a separate module (not all functions implemented yet)

This commit is contained in:
Neil Alexander 2019-05-19 17:27:48 +01:00
parent 7ca5a2533d
commit 8ef1978cb1
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
4 changed files with 123 additions and 286 deletions

View file

@ -18,6 +18,7 @@ import (
"github.com/kardianos/minwinsvc"
"github.com/mitchellh/mapstructure"
"github.com/yggdrasil-network/yggdrasil-go/src/admin"
"github.com/yggdrasil-network/yggdrasil-go/src/config"
"github.com/yggdrasil-network/yggdrasil-go/src/multicast"
"github.com/yggdrasil-network/yggdrasil-go/src/tuntap"
@ -31,6 +32,7 @@ type node struct {
core Core
tuntap tuntap.TunAdapter
multicast multicast.Multicast
admin admin.AdminSocket
}
func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *nodeConfig {
@ -184,6 +186,11 @@ func main() {
logger.Errorln("An error occurred during startup")
panic(err)
}
// Start the admin socket
n.admin.Init(&n.core, state, logger, nil)
if err := n.admin.Start(); err != nil {
logger.Errorln("An error occurred starting admin socket:", err)
}
// Start the multicast interface
n.multicast.Init(&n.core, state, logger, nil)
if err := n.multicast.Start(); err != nil {