mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
added filtered routes
This commit is contained in:
parent
d6f2d9cc14
commit
53e6da37e0
3 changed files with 15 additions and 0 deletions
|
@ -119,6 +119,10 @@ func RoutesProtoCount(protocol string) (Parsed, bool) {
|
|||
parseRoutesCount)
|
||||
}
|
||||
|
||||
func RoutesFiltered(protocol string) (Parsed, bool) {
|
||||
return RunAndParse("route protocol '"+protocol+"' filtered", parseRoutes)
|
||||
}
|
||||
|
||||
func RoutesExport(protocol string) (Parsed, bool) {
|
||||
return RunAndParse("route export '"+protocol+"' all",
|
||||
parseRoutes)
|
||||
|
|
|
@ -55,6 +55,9 @@ func makeRouter(config endpoints.ServerConfig) *httprouter.Router {
|
|||
if isModuleEnabled("routes_count_table", whitelist) {
|
||||
r.GET("/routes/count/table/:table", endpoints.Endpoint(endpoints.TableCount))
|
||||
}
|
||||
if isModuleEnabled("routes_filtered", whitelist) {
|
||||
r.GET("routes/filtered/:protocol", endpoints.Endpoint(endpoints.RoutesFiltered))
|
||||
}
|
||||
if isModuleEnabled("route_net", whitelist) {
|
||||
r.GET("/route/net/:net", endpoints.Endpoint(endpoints.RouteNet))
|
||||
r.GET("/route/net/:net/table/:table", endpoints.Endpoint(endpoints.RouteNetTable))
|
||||
|
|
|
@ -15,6 +15,14 @@ func ProtoRoutes(ps httprouter.Params) (bird.Parsed, bool) {
|
|||
return bird.RoutesProto(protocol)
|
||||
}
|
||||
|
||||
func RoutesFiltered(ps httprouter.Params) (bird.Parsed, bool) {
|
||||
protocol, err := ValidateProtocolParam(ps.ByName("protocol"))
|
||||
if err != nil {
|
||||
return bird.Parsed{"error": fmt.Sprintf("%s", err)}, false
|
||||
}
|
||||
return bird.RoutesFiltered(protocol)
|
||||
}
|
||||
|
||||
func TableRoutes(ps httprouter.Params) (bird.Parsed, bool) {
|
||||
return bird.RoutesTable(ps.ByName("table"))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue