This commit is contained in:
9
main.go
9
main.go
@@ -218,10 +218,6 @@ var (
|
||||
|
||||
// Prometheus Metriken
|
||||
var (
|
||||
checkRequests = prometheus.NewCounter(prometheus.CounterOpts{
|
||||
Name: "ipcheck_requests_total",
|
||||
Help: "Total IP check requests",
|
||||
})
|
||||
checkBlocked = prometheus.NewCounter(prometheus.CounterOpts{
|
||||
Name: "ipcheck_blocked_total",
|
||||
Help: "Total blocked IPs",
|
||||
@@ -240,7 +236,7 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
prometheus.MustRegister(checkRequests, checkBlocked, checkWhitelist, blocklistHashSizes)
|
||||
prometheus.MustRegister(checkBlocked, checkWhitelist, blocklistHashSizes)
|
||||
}
|
||||
|
||||
// Main
|
||||
@@ -547,7 +543,6 @@ func handleCheck(w http.ResponseWriter, r *http.Request) {
|
||||
Username: os.Getenv("REDIS_USER"),
|
||||
Password: os.Getenv("REDIS_PASS"),
|
||||
})
|
||||
checkRequests.Inc()
|
||||
ipStr := strings.TrimPrefix(r.URL.Path, "/check/")
|
||||
ip, err := netip.ParseAddr(ipStr)
|
||||
if err != nil {
|
||||
@@ -590,8 +585,6 @@ func handleTraefik(w http.ResponseWriter, r *http.Request) {
|
||||
Password: os.Getenv("REDIS_PASS"),
|
||||
})
|
||||
|
||||
checkRequests.Inc()
|
||||
|
||||
ip, err := clientIPFromHeaders(r)
|
||||
if err != nil {
|
||||
http.Error(w, "invalid IP", http.StatusBadRequest)
|
||||
|
||||
Reference in New Issue
Block a user