2016-11-11 14:14:38 +01:00
|
|
|
package endpoints
|
|
|
|
|
|
|
|
import (
|
2016-12-15 14:42:37 +01:00
|
|
|
"net/http"
|
|
|
|
|
2016-11-11 15:33:08 +01:00
|
|
|
"github.com/ecix/birdwatcher/bird"
|
2016-11-11 14:14:38 +01:00
|
|
|
"github.com/julienschmidt/httprouter"
|
|
|
|
)
|
|
|
|
|
2016-12-15 14:42:37 +01:00
|
|
|
func Symbols(r *http.Request, ps httprouter.Params) (bird.Parsed, bool) {
|
2016-11-11 14:14:38 +01:00
|
|
|
return bird.Symbols()
|
|
|
|
}
|
|
|
|
|
2016-12-15 14:42:37 +01:00
|
|
|
func SymbolTables(r *http.Request, ps httprouter.Params) (bird.Parsed, bool) {
|
2016-11-11 17:47:51 +01:00
|
|
|
val, from_cache := bird.Symbols()
|
2016-11-11 17:33:33 +01:00
|
|
|
return bird.Parsed{"symbols": val["routing table"]}, from_cache
|
2016-11-11 14:14:38 +01:00
|
|
|
}
|
|
|
|
|
2016-12-15 14:42:37 +01:00
|
|
|
func SymbolProtocols(r *http.Request, ps httprouter.Params) (bird.Parsed, bool) {
|
2016-11-11 17:47:51 +01:00
|
|
|
val, from_cache := bird.Symbols()
|
2016-11-11 17:33:33 +01:00
|
|
|
return bird.Parsed{"symbols": val["protocols"]}, from_cache
|
2016-11-11 14:14:38 +01:00
|
|
|
}
|