mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Refactor admin socket somewhat, allow modules to set up their own handlers
This commit is contained in:
parent
8ef1978cb1
commit
d575b83ec1
4 changed files with 379 additions and 400 deletions
13
src/multicast/admin.go
Normal file
13
src/multicast/admin.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package multicast
|
||||
|
||||
import "github.com/yggdrasil-network/yggdrasil-go/src/admin"
|
||||
|
||||
func (m *Multicast) SetupAdminHandlers(a *admin.AdminSocket) {
|
||||
a.AddHandler("getMulticastInterfaces", []string{}, func(in admin.Info) (admin.Info, error) {
|
||||
var intfs []string
|
||||
for _, v := range m.interfaces() {
|
||||
intfs = append(intfs, v.Name)
|
||||
}
|
||||
return admin.Info{"multicast_interfaces": intfs}, nil
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue