切换util工具函数
This commit is contained in:
@ -10,7 +10,7 @@ package middleware
|
||||
import (
|
||||
"git.zhangdeman.cn/zhangdeman/gin/define"
|
||||
"git.zhangdeman.cn/zhangdeman/gin/response"
|
||||
"git.zhangdeman.cn/zhangdeman/util"
|
||||
networkUtil "git.zhangdeman.cn/zhangdeman/network/util"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@ -26,7 +26,7 @@ func ValidateBlackIPMiddleware(code interface{}, httpCode int, validateFunc defi
|
||||
ctx.Next()
|
||||
return
|
||||
}
|
||||
if validateFunc(ctx, util.IP.GetRemoteIP(ctx.Request)) {
|
||||
if validateFunc(ctx, networkUtil.IP.GetRemoteIP(ctx.Request)) {
|
||||
// 命中黑名单
|
||||
response.Send(ctx, code, httpCode, nil)
|
||||
ctx.Abort()
|
||||
@ -48,7 +48,7 @@ func ValidateWhiteIPMiddleware(code interface{}, httpCode int, validateFunc defi
|
||||
ctx.Next()
|
||||
return
|
||||
}
|
||||
if !validateFunc(ctx, util.IP.GetRemoteIP(ctx.Request)) {
|
||||
if !validateFunc(ctx, networkUtil.IP.GetRemoteIP(ctx.Request)) {
|
||||
// 非名单
|
||||
response.Send(ctx, code, httpCode, nil)
|
||||
ctx.Abort()
|
||||
|
Reference in New Issue
Block a user