Add logic return to bypass when IP is unfiltered, update documentation

This commit is contained in:
MathieuHa
2022-11-19 12:16:20 +01:00
parent 3742b6b540
commit 5b0d4b533f
9 changed files with 128 additions and 9 deletions
+3 -2
View File
@@ -53,7 +53,7 @@ type Config struct {
func CreateConfig() *Config {
return &Config{
Enabled: false,
LogLevel: "DEBUG",
LogLevel: "INFO",
CrowdsecMode: liveMode,
CrowdsecLapiScheme: "http",
CrowdsecLapiHost: "crowdsec:8080",
@@ -162,7 +162,6 @@ func (bouncer *Bouncer) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
bouncer.next.ServeHTTP(rw, req)
return
}
logger.Debug(fmt.Sprintf("ServeHTTP ip:%v", remoteHost))
if bouncer.CheckerTrusted == nil {
logger.Debug("CheckerTrusted == nil")
} else {
@@ -173,7 +172,9 @@ func (bouncer *Bouncer) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
}
// if our IP is in the trusted list we bypass the next checks
if trusted {
logger.Debug(fmt.Sprintf("IP %v is trusted", remoteHost))
bouncer.next.ServeHTTP(rw, req)
return
}
}