Files
web_hgtv_server/app/middleware/ipblacklist/ipblacklist.go
T
rootandClaude Opus 5.5 7974a42301 Initial commit
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 11:07:42 +08:00

19 lines
355 B
Go

package ipblacklist
import (
"errors"
"net/http"
"videoweb/app/service/configser"
"videoweb/pub/common/ipaddr"
"github.com/gin-gonic/gin"
)
func IpBlackListMiddleware(ctx *gin.Context) {
ip := ipaddr.ResolveClientIP(ctx)
if configser.CheckIpBlack(ip) {
ctx.AbortWithStatusJSON(http.StatusUnauthorized, errors.New("login limit"))
return
}
}