mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-10 20:50:25 +08:00
在对IP封禁时,不写入访问日志
This commit is contained in:
@@ -66,6 +66,8 @@ type HTTPRequest struct {
|
|||||||
firewallRuleId int64
|
firewallRuleId int64
|
||||||
|
|
||||||
logAttrs map[string]string
|
logAttrs map[string]string
|
||||||
|
|
||||||
|
disableLog bool // 此请求中关闭Log
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ var requestId int64 = 1_0000_0000_0000_0000
|
|||||||
|
|
||||||
// 日志
|
// 日志
|
||||||
func (this *HTTPRequest) log() {
|
func (this *HTTPRequest) log() {
|
||||||
|
if this.disableLog {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 计算请求时间
|
// 计算请求时间
|
||||||
this.requestCost = time.Since(this.requestFromTime).Seconds()
|
this.requestCost = time.Since(this.requestFromTime).Seconds()
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ func (this *HTTPRequest) doWAFRequest() (blocked bool) {
|
|||||||
this.writer.WriteHeader(http.StatusForbidden)
|
this.writer.WriteHeader(http.StatusForbidden)
|
||||||
this.writer.Close()
|
this.writer.Close()
|
||||||
|
|
||||||
|
// 停止日志
|
||||||
|
this.disableLog = true
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,6 +57,10 @@ func (this *HTTPRequest) doWAFRequest() (blocked bool) {
|
|||||||
// TODO 可以配置对封禁的处理方式等
|
// TODO 可以配置对封禁的处理方式等
|
||||||
this.writer.WriteHeader(http.StatusForbidden)
|
this.writer.WriteHeader(http.StatusForbidden)
|
||||||
this.writer.Close()
|
this.writer.Close()
|
||||||
|
|
||||||
|
// 停止日志
|
||||||
|
this.disableLog = true
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,6 +72,10 @@ func (this *HTTPRequest) doWAFRequest() (blocked bool) {
|
|||||||
// TODO 可以配置对封禁的处理方式等
|
// TODO 可以配置对封禁的处理方式等
|
||||||
this.writer.WriteHeader(http.StatusForbidden)
|
this.writer.WriteHeader(http.StatusForbidden)
|
||||||
this.writer.Close()
|
this.writer.Close()
|
||||||
|
|
||||||
|
// 停止日志
|
||||||
|
this.disableLog = true
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,6 +84,7 @@ func (this *HTTPRequest) doWAFRequest() (blocked bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 规则测试
|
||||||
w := sharedWAFManager.FindWAF(this.web.FirewallPolicy.Id)
|
w := sharedWAFManager.FindWAF(this.web.FirewallPolicy.Id)
|
||||||
if w == nil {
|
if w == nil {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user