# routeros-geoip Generate RouterOS address lists from GeoIP data for MikroTik routers. Supports multiple data providers for flexibility and redundancy. ## Supported Providers | Provider | Source | URL | |----------|--------|-----| | `ipverse` (default) | RIR data via GitHub | [ipverse/country-ip-blocks](https://github.com/ipverse/country-ip-blocks) | | `ipdeny` | RIR data via ipdeny.com | [ipdeny.com](https://www.ipdeny.com/ipblocks/) | ## Configuration Create a JSON config file specifying your list name, provider, and countries (ISO 3166-1 alpha-2 codes): ```json { "list_name": "GeoBlock", "provider": "ipverse", "countries": [ "ca", "au" ] } ``` ### Configuration Fields | Field | Required | Default | Description | |-------|----------|---------|-------------| | `list_name` | Yes | — | RouterOS address list name | | `provider` | No | `ipverse` | GeoIP data provider | | `countries` | Yes | — | ISO 3166-1 alpha-2 country codes | ## Usage ```sh # Build go build -o routeros-geoip . # Generate blocklist ./routeros-geoip blocklist.json # Import on your MikroTik router /import CountryIPBlocks.rsc ``` ## Example Output The generated `.rsc` file includes metadata headers and cleans up old entries before importing: ```routeros # RouterOS GeoIP Address List: CountryIPBlocks # Generated: 2026-05-01T22:44:48Z # Countries: 14 # Total entries: 33210 # /ip firewall address-list remove [find list=CountryIPBlocks] /ip firewall address-list add address=24.152.0.0/19 comment="BRAZIL" list=CountryIPBlocks add address=45.4.4.0/22 comment="BRAZIL" list=CountryIPBlocks ... ``` ## Adding a New Provider Implement the `Provider` interface: ```go type Provider interface { Name() string FetchCIDRs(countryCode string) ([]string, error) } ``` Then register it in `NewProvider()` in `provider.go`.