5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 03:40:28 +00:00

Add getTunnelRouting and setTunnelRouting (fixes #362)

This commit is contained in:
Neil Alexander 2019-03-05 17:55:46 +00:00
parent fbc0b866fc
commit 236692bdc4
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -252,6 +252,23 @@ func (a *admin) init(c *Core) {
}, errors.New("Failed to remove allowed key")
}
})
a.addHandler("getTunnelRouting", []string{}, func(in admin_info) (admin_info, error) {
enabled := false
a.core.router.doAdmin(func() {
enabled = a.core.router.cryptokey.isEnabled()
})
return admin_info{"enabled": enabled}, nil
})
a.addHandler("setTunnelRouting", []string{"enabled"}, func(in admin_info) (admin_info, error) {
enabled := false
if e, ok := in["enabled"].(bool); ok {
enabled = e
}
a.core.router.doAdmin(func() {
a.core.router.cryptokey.setEnabled(enabled)
})
return admin_info{"enabled": enabled}, nil
})
a.addHandler("addSourceSubnet", []string{"subnet"}, func(in admin_info) (admin_info, error) {
var err error
a.core.router.doAdmin(func() {