mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-26 08:21:36 +00:00
Rename key to box_pub_key in admin socket for consistency
This commit is contained in:
parent
bd9055ddd7
commit
5b10af7399
@ -202,32 +202,32 @@ func (a *admin) init(c *Core, listenaddr string) {
|
|||||||
a.addHandler("getAllowedEncryptionPublicKeys", []string{}, func(in admin_info) (admin_info, error) {
|
a.addHandler("getAllowedEncryptionPublicKeys", []string{}, func(in admin_info) (admin_info, error) {
|
||||||
return admin_info{"allowed_box_pubs": a.getAllowedEncryptionPublicKeys()}, nil
|
return admin_info{"allowed_box_pubs": a.getAllowedEncryptionPublicKeys()}, nil
|
||||||
})
|
})
|
||||||
a.addHandler("addAllowedEncryptionPublicKey", []string{"key"}, func(in admin_info) (admin_info, error) {
|
a.addHandler("addAllowedEncryptionPublicKey", []string{"box_pub_key"}, func(in admin_info) (admin_info, error) {
|
||||||
if a.addAllowedEncryptionPublicKey(in["key"].(string)) == nil {
|
if a.addAllowedEncryptionPublicKey(in["box_pub_key"].(string)) == nil {
|
||||||
return admin_info{
|
return admin_info{
|
||||||
"added": []string{
|
"added": []string{
|
||||||
in["key"].(string),
|
in["box_pub_key"].(string),
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
} else {
|
} else {
|
||||||
return admin_info{
|
return admin_info{
|
||||||
"not_added": []string{
|
"not_added": []string{
|
||||||
in["key"].(string),
|
in["box_pub_key"].(string),
|
||||||
},
|
},
|
||||||
}, errors.New("Failed to add allowed key")
|
}, errors.New("Failed to add allowed key")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
a.addHandler("removeAllowedEncryptionPublicKey", []string{"key"}, func(in admin_info) (admin_info, error) {
|
a.addHandler("removeAllowedEncryptionPublicKey", []string{"box_pub_key"}, func(in admin_info) (admin_info, error) {
|
||||||
if a.removeAllowedEncryptionPublicKey(in["key"].(string)) == nil {
|
if a.removeAllowedEncryptionPublicKey(in["box_pub_key"].(string)) == nil {
|
||||||
return admin_info{
|
return admin_info{
|
||||||
"removed": []string{
|
"removed": []string{
|
||||||
in["key"].(string),
|
in["box_pub_key"].(string),
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
} else {
|
} else {
|
||||||
return admin_info{
|
return admin_info{
|
||||||
"not_removed": []string{
|
"not_removed": []string{
|
||||||
in["key"].(string),
|
in["box_pub_key"].(string),
|
||||||
},
|
},
|
||||||
}, errors.New("Failed to remove allowed key")
|
}, errors.New("Failed to remove allowed key")
|
||||||
}
|
}
|
||||||
@ -302,17 +302,17 @@ func (a *admin) init(c *Core, listenaddr string) {
|
|||||||
return admin_info{"not_removed": []string{fmt.Sprintf("%s via %s", in["subnet"].(string), in["destPubKey"].(string))}}, errors.New("Failed to remove route")
|
return admin_info{"not_removed": []string{fmt.Sprintf("%s via %s", in["subnet"].(string), in["destPubKey"].(string))}}, errors.New("Failed to remove route")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
a.addHandler("dhtPing", []string{"key", "coords", "[target]"}, func(in admin_info) (admin_info, error) {
|
a.addHandler("dhtPing", []string{"box_pub_key", "coords", "[target]"}, func(in admin_info) (admin_info, error) {
|
||||||
if in["target"] == nil {
|
if in["target"] == nil {
|
||||||
in["target"] = "none"
|
in["target"] = "none"
|
||||||
}
|
}
|
||||||
result, err := a.admin_dhtPing(in["key"].(string), in["coords"].(string), in["target"].(string))
|
result, err := a.admin_dhtPing(in["box_pub_key"].(string), in["coords"].(string), in["target"].(string))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
infos := make(map[string]map[string]string, len(result.Infos))
|
infos := make(map[string]map[string]string, len(result.Infos))
|
||||||
for _, dinfo := range result.Infos {
|
for _, dinfo := range result.Infos {
|
||||||
info := map[string]string{
|
info := map[string]string{
|
||||||
"key": hex.EncodeToString(dinfo.key[:]),
|
"box_pub_key": hex.EncodeToString(dinfo.key[:]),
|
||||||
"coords": fmt.Sprintf("%v", dinfo.coords),
|
"coords": fmt.Sprintf("%v", dinfo.coords),
|
||||||
}
|
}
|
||||||
addr := net.IP(address_addrForNodeID(getNodeID(&dinfo.key))[:]).String()
|
addr := net.IP(address_addrForNodeID(getNodeID(&dinfo.key))[:]).String()
|
||||||
infos[addr] = info
|
infos[addr] = info
|
||||||
@ -556,7 +556,7 @@ func (a *admin) getData_getSelf() *admin_nodeInfo {
|
|||||||
table := a.core.switchTable.table.Load().(lookupTable)
|
table := a.core.switchTable.table.Load().(lookupTable)
|
||||||
coords := table.self.getCoords()
|
coords := table.self.getCoords()
|
||||||
self := admin_nodeInfo{
|
self := admin_nodeInfo{
|
||||||
{"key", hex.EncodeToString(a.core.boxPub[:])},
|
{"box_pub_key", hex.EncodeToString(a.core.boxPub[:])},
|
||||||
{"ip", a.core.GetAddress().String()},
|
{"ip", a.core.GetAddress().String()},
|
||||||
{"subnet", a.core.GetSubnet().String()},
|
{"subnet", a.core.GetSubnet().String()},
|
||||||
{"coords", fmt.Sprint(coords)},
|
{"coords", fmt.Sprint(coords)},
|
||||||
|
Loading…
Reference in New Issue
Block a user