diff --git a/main.go b/main.go index e3c520e..58e36d7 100644 --- a/main.go +++ b/main.go @@ -71,6 +71,7 @@ func main() { } // Server + http.HandleFunc("/", handleGUI) http.HandleFunc("/whitelist", handleWhitelist) http.HandleFunc("/check/", handleCheck) http.Handle("/metrics", promhttp.Handler()) @@ -223,7 +224,13 @@ func handleCheck(w http.ResponseWriter, r *http.Request) { http.Error(w, "invalid IP", http.StatusBadRequest) return } - cats := []string{"firehol", "bitwire", "RU", "CN"} + + var cats []string + for a, _ := range blocklistURLs { + cats = append(cats, a) + } + + //cats := []string{"firehol", "bitwire", "RU", "CN"} matches, err := checkIP(ip, cats) if err != nil { http.Error(w, "server error", http.StatusInternalServerError) @@ -303,3 +310,95 @@ func writeJSON(w http.ResponseWriter, v any) { w.Header().Set("Content-Type", "application/json") _ = json.NewEncoder(w).Encode(v) } + +func handleGUI(w http.ResponseWriter, r *http.Request) { + html := ` + + + + + IP Checker GUI + + + +

IP Checker + Whitelist GUI

+ + + + +

Ergebnis

+
No Request
+ +

Prometheus Metrics

+
Loading...
+ +

Check History

+
No history
+ + + + +` + w.Header().Set("Content-Type", "text/html; charset=utf-8") + _, _ = w.Write([]byte(html)) +}