Rename internal/proxy to internal/servewaf (closes #173)
check / check (push) Successful in 6m11s

The package passes nothing to an app since rproxy took that over, so it
is named after the command it serves. Its constructor is New, like
rproxy's. The rproxy tests call their stand-in for servewaf standIn,
since a local servewaf would hide the package. No change of behaviour.

Model: opus-5-5
This commit is contained in:
2026-11-06 18:29:22 +00:00
parent 6deb9d7581
commit 1b949fddc6
50 changed files with 491 additions and 489 deletions
+21
View File
@@ -0,0 +1,21 @@
package servewaf
import (
"slices"
)
// countryDenied reports whether the country lists refuse the request, by
// the client's country as it was looked up. A client without a country,
// or whose country cannot be found, is refused only by
// SWWAF_EXCLUSIVELY_ALLOWED_COUNTRIES.
func (rq *request) countryDenied() bool {
denied := rq.h.config.DeniedCountries
allowed := rq.h.config.ExclusivelyAllowedCountries
country := rq.line.Country
if slices.Contains(denied, country) {
return true
}
return len(allowed) > 0 && !slices.Contains(allowed, country)
}