mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-22 15:20:30 +00:00
Rename admin socket getMeta to getMetadata
This commit is contained in:
parent
5417e33520
commit
9a5cf96c29
@ -322,12 +322,12 @@ func (a *admin) init(c *Core, listenaddr string) {
|
|||||||
return admin_info{}, err
|
return admin_info{}, err
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
a.addHandler("getMeta", []string{"box_pub_key", "coords", "[nocache]"}, func(in admin_info) (admin_info, error) {
|
a.addHandler("getMetadata", []string{"box_pub_key", "coords", "[nocache]"}, func(in admin_info) (admin_info, error) {
|
||||||
var nocache bool
|
var nocache bool
|
||||||
if in["nocache"] != nil {
|
if in["nocache"] != nil {
|
||||||
nocache = in["nocache"].(string) == "true"
|
nocache = in["nocache"].(string) == "true"
|
||||||
}
|
}
|
||||||
result, err := a.admin_getMeta(in["box_pub_key"].(string), in["coords"].(string), nocache)
|
result, err := a.admin_getMetadata(in["box_pub_key"].(string), in["coords"].(string), nocache)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
var m map[string]interface{}
|
var m map[string]interface{}
|
||||||
if err = json.Unmarshal(result, &m); err == nil {
|
if err = json.Unmarshal(result, &m); err == nil {
|
||||||
@ -817,7 +817,7 @@ func (a *admin) admin_dhtPing(keyString, coordString, targetString string) (dhtR
|
|||||||
return dhtRes{}, errors.New(fmt.Sprintf("DHT ping timeout: %s", keyString))
|
return dhtRes{}, errors.New(fmt.Sprintf("DHT ping timeout: %s", keyString))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *admin) admin_getMeta(keyString, coordString string, nocache bool) (metadataPayload, error) {
|
func (a *admin) admin_getMetadata(keyString, coordString string, nocache bool) (metadataPayload, error) {
|
||||||
var key boxPubKey
|
var key boxPubKey
|
||||||
if keyBytes, err := hex.DecodeString(keyString); err != nil {
|
if keyBytes, err := hex.DecodeString(keyString); err != nil {
|
||||||
return metadataPayload{}, err
|
return metadataPayload{}, err
|
||||||
@ -860,7 +860,7 @@ func (a *admin) admin_getMeta(keyString, coordString string, nocache bool) (meta
|
|||||||
for res := range response {
|
for res := range response {
|
||||||
return *res, nil
|
return *res, nil
|
||||||
}
|
}
|
||||||
return metadataPayload{}, errors.New(fmt.Sprintf("getMeta timeout: %s", keyString))
|
return metadataPayload{}, errors.New(fmt.Sprintf("getMetadata timeout: %s", keyString))
|
||||||
}
|
}
|
||||||
|
|
||||||
// getResponse_dot returns a response for a graphviz dot formatted representation of the known parts of the network.
|
// getResponse_dot returns a response for a graphviz dot formatted representation of the known parts of the network.
|
||||||
|
Loading…
Reference in New Issue
Block a user