mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-23 18:15:24 +00:00
Merge pull request #78 from neilalexander/admin
Add getTunTap to admin socket
This commit is contained in:
commit
85cae4501e
@ -73,6 +73,24 @@ func (a *admin) init(c *Core, listenaddr string) {
|
||||
*out = []byte("Failed to remove peer: " + sport[0] + "\n")
|
||||
}
|
||||
})
|
||||
a.addHandler("getTunTap", nil, func(out *[]byte, _ ...string) {
|
||||
var info admin_nodeInfo
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
info = admin_nodeInfo{
|
||||
{"Interface name", "none"},
|
||||
}
|
||||
*out = []byte(a.printInfos([]admin_nodeInfo{info}))
|
||||
}
|
||||
}()
|
||||
|
||||
info = admin_nodeInfo{
|
||||
{"Interface name", a.core.tun.iface.Name()},
|
||||
{"TAP mode", strconv.FormatBool(a.core.tun.iface.IsTAP())},
|
||||
{"MTU", strconv.Itoa(a.core.tun.mtu)},
|
||||
}
|
||||
*out = []byte(a.printInfos([]admin_nodeInfo{info}))
|
||||
})
|
||||
a.addHandler("setTunTap", []string{"<ifname|auto|none>", "[<tun|tap>]", "[<mtu>]"}, func(out *[]byte, ifparams ...string) {
|
||||
// Set sane defaults
|
||||
iftapmode := false
|
||||
|
Loading…
Reference in New Issue
Block a user