5
0
mirror of https://github.com/cwinfo/yggdrasil-map synced 2024-11-24 01:41:57 +00:00

fix some missed edge cases in the go crawler

This commit is contained in:
Arceliar 2022-12-03 16:23:44 -06:00
parent a627042420
commit d61c033319

View File

@ -63,6 +63,9 @@ func doRequest(request map[string]interface{}) map[string]interface{} {
} }
// TODO parse res, check if there's an error // TODO parse res, check if there's an error
if res, ok := res["response"]; ok { if res, ok := res["response"]; ok {
if _, ok := res.(map[string]interface{}); !ok {
continue
}
if _, isIn := res.(map[string]interface{})["error"]; isIn { if _, isIn := res.(map[string]interface{})["error"]; isIn {
continue continue
} }
@ -101,6 +104,9 @@ func doRumor(key string, out chan rumorResult) {
defer func() { <-semaphore }() defer func() { <-semaphore }()
results := make(map[string]interface{}) results := make(map[string]interface{})
if res, ok := getNodeInfo(key)["response"]; ok { if res, ok := getNodeInfo(key)["response"]; ok {
if _, ok := res.(map[string]interface{}); !ok {
return
}
for addr, v := range res.(map[string]interface{}) { for addr, v := range res.(map[string]interface{}) {
vm, ok := v.(map[string]interface{}) vm, ok := v.(map[string]interface{})
if !ok { if !ok {
@ -111,6 +117,9 @@ func doRumor(key string, out chan rumorResult) {
} }
} }
if res, ok := getSelf(key)["response"]; ok { if res, ok := getSelf(key)["response"]; ok {
if _, ok := res.(map[string]interface{}); !ok {
return
}
for _, v := range res.(map[string]interface{}) { for _, v := range res.(map[string]interface{}) {
vm, ok := v.(map[string]interface{}) vm, ok := v.(map[string]interface{})
if !ok { if !ok {
@ -122,6 +131,9 @@ func doRumor(key string, out chan rumorResult) {
} }
} }
if res, ok := getPeers(key)["response"]; ok { if res, ok := getPeers(key)["response"]; ok {
if _, ok := res.(map[string]interface{}); !ok {
return
}
for _, v := range res.(map[string]interface{}) { for _, v := range res.(map[string]interface{}) {
vm, ok := v.(map[string]interface{}) vm, ok := v.(map[string]interface{})
if !ok { if !ok {
@ -133,6 +145,9 @@ func doRumor(key string, out chan rumorResult) {
} }
} }
if res, ok := getDHT(key)["response"]; ok { if res, ok := getDHT(key)["response"]; ok {
if _, ok := res.(map[string]interface{}); !ok {
return
}
for _, v := range res.(map[string]interface{}) { for _, v := range res.(map[string]interface{}) {
vm, ok := v.(map[string]interface{}) vm, ok := v.(map[string]interface{})
if !ok { if !ok {