frontend: fix whois lookup & only show bgpmap nexthop info on the first hop

This commit is contained in:
Lan Tian
2023-05-05 20:20:12 -07:00
parent 5625058e71
commit 594ca80f50
3 changed files with 13 additions and 6 deletions

View File

@@ -9,9 +9,8 @@ import (
type ASNCache map[string]string
func (cache ASNCache) _lookup(asn string) string {
// Try to get ASN representation using DNS
if setting.dnsInterface != "" {
// get ASN representation using DNS
records, err := net.LookupTXT(fmt.Sprintf("AS%s.%s", asn, setting.dnsInterface))
if err == nil {
result := strings.Join(records, " ")
@@ -20,8 +19,10 @@ func (cache ASNCache) _lookup(asn string) string {
}
return fmt.Sprintf("AS%s\n%s", asn, result)
}
} else if setting.whoisServer != "" {
// get ASN representation using WHOIS
}
// Try to get ASN representation using WHOIS
if setting.whoisServer != "" {
if setting.bgpmapInfo == "" {
setting.bgpmapInfo = "asn,as-name,ASName,descr"
}