Files
hadja_server/app/middleware/ipblacklist/ipblacklist.go
T
rootandClaude Opus 4.7 79ac89b458 Initial commit
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-11-07 10:47:18 +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
}
}