Files
routeros-geoip/provider_ipdeny.go
Steven Polley b1ed8f75ec mondern slopify hand crafted code for the greater good.
(move from user specified blocklist download URLs to simply country codes with multiple providers available.)
2026-05-01 17:18:50 -06:00

25 lines
739 B
Go

package main
import (
"fmt"
"strings"
)
const ipdenyBaseURL = "https://www.ipdeny.com/ipblocks/data/aggregated"
// IPDenyProvider fetches GeoIP data from ipdeny.com.
// IPDeny provides aggregated country-level IP blocks derived from RIR data.
// Website: https://www.ipdeny.com/ipblocks/
type IPDenyProvider struct{}
func (p *IPDenyProvider) Name() string {
return "ipdeny"
}
// FetchCIDRs downloads IPv4 CIDR blocks for a country from ipdeny.
// URL format: https://www.ipdeny.com/ipblocks/data/aggregated/{cc}-aggregated.zone
func (p *IPDenyProvider) FetchCIDRs(countryCode string) ([]string, error) {
url := fmt.Sprintf("%s/%s-aggregated.zone", ipdenyBaseURL, strings.ToLower(countryCode))
return downloadAndParseCIDRs(url)
}