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) }