diff --git a/frontend/template.go b/frontend/template.go
index a709beb..4a9fade 100644
--- a/frontend/template.go
+++ b/frontend/template.go
@@ -106,6 +106,16 @@ func templateHeader(w http.ResponseWriter, r *http.Request, title string) {
} else {
options += ``
}
+ if split[2] == "route_where" {
+ options += ``
+ } else {
+ options += ``
+ }
+ if split[2] == "route_where_all" {
+ options += ``
+ } else {
+ options += ``
+ }
if isWhois {
options += ``
} else {
@@ -122,10 +132,10 @@ func templateHeader(w http.ResponseWriter, r *http.Request, title string) {
// This is a whois request, use original path URL instead of the modified one
// and extract the target
whoisSplit := strings.Split(r.URL.Path, "/")
- target = whoisSplit[2]
+ target = strings.Join(whoisSplit[2:], "/")
} else if len(split) >= 5 {
// This is a normal request, just extract the target
- target = split[4]
+ target = strings.Join(split[4:], "/")
}
w.Write([]byte(`
diff --git a/frontend/webserver.go b/frontend/webserver.go
index 304be0f..cd748b4 100644
--- a/frontend/webserver.go
+++ b/frontend/webserver.go
@@ -46,6 +46,26 @@ func webDispatcherIPv6RouteAll(w http.ResponseWriter, r *http.Request) {
webHandler(w, r, "bird6", split[0], "show route for " + strings.Join(split[1:], "/") + " all")
}
+func webDispatcherIPv4RouteWhere(w http.ResponseWriter, r *http.Request) {
+ split := strings.Split(r.URL.Path[len("/ipv4/route_where/"):], "/")
+ webHandler(w, r, "bird", split[0], "show route where net ~ [ " + strings.Join(split[1:], "/") + " ]")
+}
+
+func webDispatcherIPv6RouteWhere(w http.ResponseWriter, r *http.Request) {
+ split := strings.Split(r.URL.Path[len("/ipv6/route_where/"):], "/")
+ webHandler(w, r, "bird6", split[0], "show route where net ~ [ " + strings.Join(split[1:], "/") + " ]")
+}
+
+func webDispatcherIPv4RouteWhereAll(w http.ResponseWriter, r *http.Request) {
+ split := strings.Split(r.URL.Path[len("/ipv4/route_where_all/"):], "/")
+ webHandler(w, r, "bird", split[0], "show route where net ~ [ " + strings.Join(split[1:], "/") + " ] all")
+}
+
+func webDispatcherIPv6RouteWhereAll(w http.ResponseWriter, r *http.Request) {
+ split := strings.Split(r.URL.Path[len("/ipv6/route_where_all/"):], "/")
+ webHandler(w, r, "bird6", split[0], "show route where net ~ [ " + strings.Join(split[1:], "/") + " ] all")
+}
+
func webDispatcherWhois(w http.ResponseWriter, r *http.Request) {
var target string = r.URL.Path[len("/whois/"):]
@@ -112,6 +132,10 @@ func webServerStart() {
http.HandleFunc("/ipv6/route/", webDispatcherIPv6Route)
http.HandleFunc("/ipv4/route_all/", webDispatcherIPv4RouteAll)
http.HandleFunc("/ipv6/route_all/", webDispatcherIPv6RouteAll)
+ http.HandleFunc("/ipv4/route_where/", webDispatcherIPv4RouteWhere)
+ http.HandleFunc("/ipv6/route_where/", webDispatcherIPv6RouteWhere)
+ http.HandleFunc("/ipv4/route_where_all/", webDispatcherIPv4RouteWhereAll)
+ http.HandleFunc("/ipv6/route_where_all/", webDispatcherIPv6RouteWhereAll)
http.HandleFunc("/ipv4/traceroute/", webDispatcherIPv4Traceroute)
http.HandleFunc("/ipv6/traceroute/", webDispatcherIPv6Traceroute)
http.HandleFunc("/whois/", webDispatcherWhois)