区域封禁增加延时返回

This commit is contained in:
刘祥超
2023-07-14 16:03:58 +08:00
parent c706f2fdf1
commit 2079b0ebee

View File

@@ -12,6 +12,7 @@ import (
"github.com/iwind/TeaGo/types"
"io"
"net/http"
"time"
)
// 调用WAF
@@ -182,8 +183,8 @@ func (this *HTTPRequest) checkWAFRequest(firewallPolicy *firewallconfigs.HTTPFir
this.writeCode(http.StatusForbidden, "The region has been denied.", "当前区域禁止访问")
}
this.writer.Flush()
this.writer.Close()
// 延时返回,避免攻击
time.Sleep(1 * time.Second)
// 停止日志
if !logDenying {
@@ -209,8 +210,9 @@ func (this *HTTPRequest) checkWAFRequest(firewallPolicy *firewallconfigs.HTTPFir
} else {
this.writeCode(http.StatusForbidden, "The region has been denied.", "当前区域禁止访问")
}
this.writer.Flush()
this.writer.Close()
// 延时返回,避免攻击
time.Sleep(1 * time.Second)
// 停止日志
if !logDenying {