mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-30 13:35:19 +00:00
Merge branch 'develop' into multilink
This commit is contained in:
commit
19267beb9e
@ -173,9 +173,10 @@ func (a *admin) init(c *Core) {
|
||||
})
|
||||
a.addHandler("getTunTap", []string{}, func(in admin_info) (r admin_info, e error) {
|
||||
defer func() {
|
||||
recover()
|
||||
r = admin_info{"none": admin_info{}}
|
||||
e = nil
|
||||
if err := recover(); err != nil {
|
||||
r = admin_info{"none": admin_info{}}
|
||||
e = nil
|
||||
}
|
||||
}()
|
||||
|
||||
return admin_info{
|
||||
@ -251,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() {
|
||||
|
Loading…
Reference in New Issue
Block a user