1
0
Fork 0
mirror of https://github.com/alice-lg/birdwatcher.git synced 2025-03-09 00:00:05 +01:00

Merge pull request #20 from nstgt/exported-routes-endpoint

Add exported routes endpoint
This commit is contained in:
Annika Hannig 2020-04-20 14:08:19 +02:00 committed by GitHub
commit bbffff13c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View file

@ -81,6 +81,9 @@ func makeRouter(config endpoints.ServerConfig) *httprouter.Router {
if isModuleEnabled("routes_filtered", whitelist) {
r.GET("/routes/filtered/:protocol", endpoints.Endpoint(endpoints.RoutesFiltered))
}
if isModuleEnabled("routes_export", whitelist) {
r.GET("/routes/export/:protocol", endpoints.Endpoint(endpoints.RoutesExport))
}
if isModuleEnabled("routes_noexport", whitelist) {
r.GET("/routes/noexport/:protocol", endpoints.Endpoint(endpoints.RoutesNoExport))
}

View file

@ -26,6 +26,15 @@ func RoutesFiltered(r *http.Request, ps httprouter.Params, useCache bool) (bird.
return bird.RoutesFiltered(useCache, protocol)
}
func RoutesExport(r *http.Request, ps httprouter.Params, useCache bool) (bird.Parsed, bool) {
protocol, err := ValidateProtocolParam(ps.ByName("protocol"))
if err != nil {
return bird.Parsed{"error": fmt.Sprintf("%s", err)}, false
}
return bird.RoutesExport(useCache, protocol)
}
func RoutesNoExport(r *http.Request, ps httprouter.Params, useCache bool) (bird.Parsed, bool) {
protocol, err := ValidateProtocolParam(ps.ByName("protocol"))
if err != nil {

View file

@ -27,6 +27,7 @@ allow_uncached = false
# routes_count_primary
# routes_filtered
# routes_prefixed
# routes_export
# routes_noexport
# route_net
# routes_pipe_filtered_count
@ -45,6 +46,7 @@ modules_enabled = ["status",
"routes_table_peer",
"routes_filtered",
"routes_prefixed",
"routes_export",
"routes_noexport",
"routes_pipe_filtered_count",
"routes_pipe_filtered"