Remove duplicate ASN field from bgpmap

This commit is contained in:
Lan Tian 2020-03-27 13:06:05 +08:00
parent 7794ec7bcb
commit cb247186f3
No known key found for this signature in database
GPG Key ID: 27F31700E751EC22

View File

@ -10,7 +10,11 @@ func getASNRepresentation(asn string) string {
if records, err := net.LookupTXT(fmt.Sprintf("AS%s.%s", asn, setting.dnsInterface)); err != nil {
return fmt.Sprintf("AS%s", asn)
} else {
return fmt.Sprintf("AS%s\\n%s", asn, strings.Join(records, " "))
result := strings.Join(records, " ")
if resultSplit := strings.Split(result, " | "); len(resultSplit) > 1 {
result = strings.Join(resultSplit[1:], "\\n")
}
return fmt.Sprintf("AS%s\\n%s", asn, result)
}
}