|
@@ -16,7 +16,7 @@ func Limiter(c *gin.Context) { |
|
|
limit := 500 // 限流次数 |
|
|
limit := 500 // 限流次数 |
|
|
ttl := 2 // 限流过期时间 |
|
|
ttl := 2 // 限流过期时间 |
|
|
ip := utils.GetIP(c.Request) |
|
|
ip := utils.GetIP(c.Request) |
|
|
if ip != "221.4.210.167" { |
|
|
|
|
|
|
|
|
if ip != "221.4.210.167" && c.Request.Host != "127.0.0.1:4000" { |
|
|
e.OutErr(c, e.ERR, "系统维护中~") |
|
|
e.OutErr(c, e.ERR, "系统维护中~") |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@@ -34,8 +34,8 @@ func Limiter(c *gin.Context) { |
|
|
// Write body back |
|
|
// Write body back |
|
|
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body)) |
|
|
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body)) |
|
|
utils.FilePutContents("Limiter", utils.SerializeStr(map[string]interface{}{ |
|
|
utils.FilePutContents("Limiter", utils.SerializeStr(map[string]interface{}{ |
|
|
"uri": c.Request.URL, |
|
|
|
|
|
"body": c.Request.Body, |
|
|
|
|
|
|
|
|
"uri": c.Request.URL.Path, |
|
|
|
|
|
"body": string(bytes.NewBuffer(body).Bytes()), |
|
|
})) |
|
|
})) |
|
|
//queryValue := utils.SerializeStr(c.Request.URL.Query()) //不建议开启,失去限流的意义 |
|
|
//queryValue := utils.SerializeStr(c.Request.URL.Query()) //不建议开启,失去限流的意义 |
|
|
|
|
|
|
|
|