Define module.Module interface, update admin/tuntap/multicast modules to comply with it, fix #581

This commit is contained in:
Neil Alexander 2019-10-23 10:44:58 +01:00
parent fc71624919
commit a072e063d8
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
6 changed files with 108 additions and 42 deletions

20
src/module/module.go Normal file
View file

@ -0,0 +1,20 @@
package module
import (
"github.com/gologme/log"
"github.com/yggdrasil-network/yggdrasil-go/src/admin"
"github.com/yggdrasil-network/yggdrasil-go/src/config"
"github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil"
)
// Module is an interface that defines which functions must be supported by a
// given Yggdrasil module.
type Module interface {
Init(core *yggdrasil.Core, state *config.NodeState, log *log.Logger, options interface{}) error
Start() error
Stop() error
UpdateConfig(config *config.NodeConfig)
SetupAdminHandlers(a *admin.AdminSocket)
IsStarted() bool
}