mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-26 00:11:36 +00:00
Act multicast updates for safety
This commit is contained in:
parent
a072e063d8
commit
337626a32c
2
go.mod
2
go.mod
@ -17,5 +17,3 @@ require (
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
|
||||
golang.org/x/text v0.3.2
|
||||
)
|
||||
|
||||
go 1.13
|
||||
|
@ -60,6 +60,13 @@ func (a *AdminSocket) Init(c *yggdrasil.Core, state *config.NodeState, log *log.
|
||||
a.handlers = make(map[string]handler)
|
||||
current := state.GetCurrent()
|
||||
a.listenaddr = current.AdminListen
|
||||
a.AddHandler("list", []string{}, func(in Info) (Info, error) {
|
||||
handlers := make(map[string]interface{})
|
||||
for handlername, handler := range a.handlers {
|
||||
handlers[handlername] = Info{"fields": handler.args}
|
||||
}
|
||||
return Info{"list": handlers}, nil
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -75,13 +82,6 @@ func (a *AdminSocket) UpdateConfig(config *config.NodeConfig) {
|
||||
}
|
||||
|
||||
func (a *AdminSocket) SetupAdminHandlers(na *AdminSocket) {
|
||||
a.AddHandler("list", []string{}, func(in Info) (Info, error) {
|
||||
handlers := make(map[string]interface{})
|
||||
for handlername, handler := range a.handlers {
|
||||
handlers[handlername] = Info{"fields": handler.args}
|
||||
}
|
||||
return Info{"list": handlers}, nil
|
||||
})
|
||||
a.AddHandler("getSelf", []string{}, func(in Info) (Info, error) {
|
||||
ip := a.core.Address().String()
|
||||
subnet := a.core.Subnet()
|
||||
|
@ -109,6 +109,10 @@ func (m *Multicast) Stop() error {
|
||||
// and then signals the various module goroutines to reconfigure themselves if
|
||||
// needed.
|
||||
func (m *Multicast) UpdateConfig(config *config.NodeConfig) {
|
||||
m.Act(m, func() { m._updateConfig(config) })
|
||||
}
|
||||
|
||||
func (m *Multicast) _updateConfig(config *config.NodeConfig) {
|
||||
m.log.Debugln("Reloading multicast configuration...")
|
||||
if m.IsStarted() {
|
||||
if len(config.MulticastInterfaces) == 0 || config.LinkLocalTCPPort != m.listenPort {
|
||||
|
Loading…
Reference in New Issue
Block a user