mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
use isRoutesFilterd in routes dump
This commit is contained in:
parent
1d0b28b354
commit
43182aa59d
1 changed files with 30 additions and 3 deletions
33
bird/bird.go
33
bird/bird.go
|
@ -376,11 +376,38 @@ func RoutesPeer(peer string) (Parsed, bool) {
|
|||
}
|
||||
|
||||
func RoutesDump() (Parsed, bool) {
|
||||
if ParserConf.PerPeerTables {
|
||||
return RoutesDumpPerPeerTable()
|
||||
/*
|
||||
if ParserConf.PerPeerTables {
|
||||
return RoutesDumpPerPeerTable()
|
||||
}
|
||||
|
||||
return RoutesDumpSingleTable()
|
||||
*/
|
||||
return RoutesDumpCommunityFilter()
|
||||
}
|
||||
|
||||
func RoutesDumpCommunityFilter() (Parsed, bool) {
|
||||
importedRes, cached := RunAndParse(routeQueryForChannel("route all"), parseRoutes)
|
||||
|
||||
routes := importedRes["routes"].([]Parsed)
|
||||
|
||||
imported := make([]interface{}, 0, len(routes))
|
||||
filtered := make([]interface{}, 0, len(routes))
|
||||
|
||||
for _, route := range routes {
|
||||
if isRouteFiltered(route) {
|
||||
filtered = append(filtered, route)
|
||||
} else {
|
||||
imported = append(imported, route)
|
||||
}
|
||||
}
|
||||
|
||||
return RoutesDumpSingleTable()
|
||||
result := Parsed{
|
||||
"imported": imported,
|
||||
"filtered": filtered,
|
||||
}
|
||||
|
||||
return result, cached
|
||||
}
|
||||
|
||||
func RoutesDumpSingleTable() (Parsed, bool) {
|
||||
|
|
Loading…
Add table
Reference in a new issue