Fix CreateConfig failed with Yaegi

This commit is contained in:
hoelee committed 2026-08-04 09:58:00 +08:00
1 parent 371d9389c5
commit 4690e08348
7 files changed
+11 -7

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
// Package traefik_botfilter is a Traefik middleware plugin that blocks known scans
// and applies a bounded, in-memory per-IP suspicion score.
package botfilter
package traefik_botfilter
import (
"bufio"
+5 -1
View File
@@ -1,4 +1,4 @@
package botfilter
package traefik_botfilter
import (
"context"
@@ -73,6 +73,10 @@ func TestEncodedScanPathBansBeforeUpstream(t *testing.T) {
cfg := CreateConfig()
cfg.RequireUserAgent = false
cfg.RequireAccept = false
// Blocked paths are opt-in, so the test must configure the rule it expects to
// match; the point under test is that the encoded traversal form normalises
// onto that rule instead of slipping past it.
cfg.BlockedPaths = []string{"/.env"}
nextCalls := 0
handler, err := New(context.Background(), http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) {
nextCalls++
+1 -1
View File
@@ -1,4 +1,4 @@
package botfilter
package traefik_botfilter
import (
"sync"
+1 -1
View File
@@ -1,4 +1,4 @@
package botfilter
package traefik_botfilter
import (
"fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package botfilter
package traefik_botfilter
import "log"
+1 -1
View File
@@ -1,4 +1,4 @@
package botfilter
package traefik_botfilter
import (
"net/http"
+1 -1
View File
@@ -1,4 +1,4 @@
package botfilter
package traefik_botfilter
import (
"net"