Fix unused variable compilation error in geoip.go

This commit is contained in:
Patrick Britton 2026-02-01 12:46:28 -06:00
parent 3b91a48c06
commit 400f4116eb

View file

@ -54,8 +54,6 @@ func (g *SimpleGeoBlockMiddleware) Middleware() gin.HandlerFunc {
// isBlockedIP checks if the IP falls into known problematic ranges
func (g *SimpleGeoBlockMiddleware) isBlockedIP(ip net.IP) bool {
ipStr := ip.String()
// Block common bot/scanner IP ranges
blockedRanges := []string{
// Chinese IP ranges (simplified)
@ -109,8 +107,6 @@ func (g *SimpleGeoBlockMiddleware) isBlockedIP(ip net.IP) bool {
// isHostingProvider checks if IP is from known hosting providers often used by bots
func (g *SimpleGeoBlockMiddleware) isHostingProvider(ip net.IP) bool {
ipStr := ip.String()
// Common hosting provider ASN prefixes (simplified)
hostingPrefixes := []string{
"34.", "35.", "52.", "54.", // AWS
@ -122,7 +118,7 @@ func (g *SimpleGeoBlockMiddleware) isHostingProvider(ip net.IP) bool {
}
for _, prefix := range hostingPrefixes {
if strings.HasPrefix(ipStr, prefix) {
if strings.HasPrefix(ip.String(), prefix) {
// Additional check - if it's a known datacenter IP range
if g.isDatacenterIP(ip) {
return true