将IP加入黑名单时,同时也会关闭此IP相关的连接

This commit is contained in:
刘祥超
2022-09-02 15:20:58 +08:00
parent af4cd05df2
commit 3cb69f4c71
11 changed files with 280 additions and 50 deletions

View File

@@ -34,17 +34,7 @@ func (this *HTTPRequest) MetricValue(value string) (result int64, ok bool) {
}
return this.RawReq.ContentLength + hl, true
case "${countConnection}":
metricNewConnMapLocker.Lock()
_, ok := metricNewConnMap[this.RawReq.RemoteAddr]
if ok {
delete(metricNewConnMap, this.RawReq.RemoteAddr)
}
metricNewConnMapLocker.Unlock()
if ok {
return 1, true
} else {
return 0, false
}
return 1, true
}
return 0, false
}