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

@@ -90,14 +90,18 @@ func birdRouteToGraph(servers []string, responses []string, target string) Route
// Edges between AS
for i := range paths {
var src string
var label string
// Only show nexthop information on the first hop
if i == 0 {
src = server
label = strings.TrimSpace(protocolName + "\n" + via)
} else {
src = paths[i-1]
label = ""
}
dst := paths[i]
graph.AddEdge(src, dst, strings.TrimSpace(protocolName+"\n"+via), makeEdgeAttrs(routePreferred))
graph.AddEdge(src, dst, label, makeEdgeAttrs(routePreferred))
// Only set color for next step, origin color is set to blue above
graph.AddPoint(dst, true, makePointAttrs(routePreferred))
}