mirror of
https://github.com/yggdrasil-network/yggdrasil-go
synced 2024-11-10 15:30:34 +03:00
Update getRoutes format
This commit is contained in:
parent
14f4da764c
commit
f09adc2192
@ -268,11 +268,11 @@ func (a *admin) init(c *Core, listenaddr string) {
|
|||||||
return admin_info{"source_subnets": subnets}, nil
|
return admin_info{"source_subnets": subnets}, nil
|
||||||
})
|
})
|
||||||
a.addHandler("getRoutes", []string{}, func(in admin_info) (admin_info, error) {
|
a.addHandler("getRoutes", []string{}, func(in admin_info) (admin_info, error) {
|
||||||
var routes []string
|
routes := make(admin_info)
|
||||||
a.core.router.doAdmin(func() {
|
a.core.router.doAdmin(func() {
|
||||||
getRoutes := func(ckrs []cryptokey_route) {
|
getRoutes := func(ckrs []cryptokey_route) {
|
||||||
for _, ckr := range ckrs {
|
for _, ckr := range ckrs {
|
||||||
routes = append(routes, fmt.Sprintf("%s via %s", ckr.subnet.String(), hex.EncodeToString(ckr.destination[:])))
|
routes[ckr.subnet.String()] = hex.EncodeToString(ckr.destination[:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getRoutes(a.core.router.cryptokey.ipv4routes)
|
getRoutes(a.core.router.cryptokey.ipv4routes)
|
||||||
|
Loading…
Reference in New Issue
Block a user