Minor coding style change

This commit is contained in:
Lan Tian 2020-03-27 19:59:47 +08:00
parent f204744a4f
commit 1acc8f48ce
No known key found for this signature in database
GPG Key ID: 27F31700E751EC22

View File

@ -7,15 +7,17 @@ import (
) )
func getASNRepresentation(asn string) string { func getASNRepresentation(asn string) string {
if records, err := net.LookupTXT(fmt.Sprintf("AS%s.%s", asn, setting.dnsInterface)); err != nil { records, err := net.LookupTXT(fmt.Sprintf("AS%s.%s", asn, setting.dnsInterface))
if err != nil {
// DNS query failed, only use ASN as output
return fmt.Sprintf("AS%s", asn) return fmt.Sprintf("AS%s", asn)
} else { }
result := strings.Join(records, " ") result := strings.Join(records, " ")
if resultSplit := strings.Split(result, " | "); len(resultSplit) > 1 { if resultSplit := strings.Split(result, " | "); len(resultSplit) > 1 {
result = strings.Join(resultSplit[1:], "\\n") result = strings.Join(resultSplit[1:], "\\n")
} }
return fmt.Sprintf("AS%s\\n%s", asn, result) return fmt.Sprintf("AS%s\\n%s", asn, result)
}
} }
func birdRouteToGraphviz(servers []string, responses []string, target string) string { func birdRouteToGraphviz(servers []string, responses []string, target string) string {