diff --git a/caddywaf.go b/caddywaf.go index 42c1535..f652f90 100644 --- a/caddywaf.go +++ b/caddywaf.go @@ -26,17 +26,15 @@ import ( "sync" "sync/atomic" - + "github.com/caddyserver/caddy/v2" + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" + "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile" + "github.com/caddyserver/caddy/v2/modules/caddyhttp" "github.com/fsnotify/fsnotify" "github.com/oschwald/maxminddb-golang" "github.com/phemmer/go-iptrie" "go.uber.org/zap" "go.uber.org/zap/zapcore" - - "github.com/caddyserver/caddy/v2" - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" - "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile" - "github.com/caddyserver/caddy/v2/modules/caddyhttp" ) // ==================== Constants and Globals ==================== diff --git a/rules.go b/rules.go index bc300b3..e49af21 100644 --- a/rules.go +++ b/rules.go @@ -4,13 +4,14 @@ package caddywaf import ( "encoding/json" "fmt" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" "net/http" "os" "regexp" "sort" "sync/atomic" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" ) func (m *Middleware) processRuleMatch(w http.ResponseWriter, r *http.Request, rule *Rule, target, value string, state *WAFState) bool { diff --git a/types.go b/types.go index b48207a..9daa572 100644 --- a/types.go +++ b/types.go @@ -5,14 +5,13 @@ import ( "sync" "time" + "github.com/caddyserver/caddy/v2" + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" + "github.com/caddyserver/caddy/v2/modules/caddyhttp" "github.com/oschwald/maxminddb-golang" "github.com/phemmer/go-iptrie" "go.uber.org/zap" "go.uber.org/zap/zapcore" - - "github.com/caddyserver/caddy/v2" - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" - "github.com/caddyserver/caddy/v2/modules/caddyhttp" ) // Package caddywaf is a Caddy module providing web application firewall functionality. @@ -135,8 +134,8 @@ type Middleware struct { CustomResponses map[int]CustomBlockResponse `json:"custom_responses,omitempty"` LogFilePath string - LogBuffer int `json:"log_buffer,omitempty"` // Add the LogBuffer field - RedactSensitiveData bool `json:"redact_sensitive_data,omitempty"` + LogBuffer int `json:"log_buffer,omitempty"` // Add the LogBuffer field + RedactSensitiveData bool `json:"redact_sensitive_data,omitempty"` MaxRequestBodySize int64 `json:"max_request_body_size,omitempty"` GeoIPFailOpen bool `json:"geoip_fail_open,omitempty"`