{"id":31977662,"url":"https://github.com/eterline/geo-filt","last_synced_at":"2025-10-14T21:49:15.430Z","repository":{"id":315980896,"uuid":"1061301472","full_name":"eterline/geo-filt","owner":"eterline","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-22T01:50:55.000Z","size":5257,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-22T02:29:20.109Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eterline.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-21T16:39:13.000Z","updated_at":"2025-09-22T01:50:58.000Z","dependencies_parsed_at":"2025-09-28T10:45:09.611Z","dependency_job_id":null,"html_url":"https://github.com/eterline/geo-filt","commit_stats":null,"previous_names":["eterline/geo-filt"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/eterline/geo-filt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eterline%2Fgeo-filt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eterline%2Fgeo-filt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eterline%2Fgeo-filt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eterline%2Fgeo-filt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eterline","download_url":"https://codeload.github.com/eterline/geo-filt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eterline%2Fgeo-filt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279021375,"owners_count":26087023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-14T21:48:41.527Z","updated_at":"2025-10-14T21:49:15.423Z","avatar_url":"https://github.com/eterline.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# geo-filt\n\n**geo-filt** is a [Traefik](https://traefik.io/) middleware plugin that filters incoming HTTP requests by IP address and geographic location (country, subnet, custom rules). Written in ![Go](https://img.shields.io/badge/go-%2300ADD8.svg?style=for-the-badge\u0026logo=go\u0026logoColor=white)\n\n## Features\n\n- Extracts client IP from standard headers: `Forwarded`, `X-Forwarded-For`, `X-Real-IP`.\n- IPv4 and IPv6 support.\n- Option to allow private ranges (RFC1918, RFC4193, loopback).\n- Country-based access filtering (ISO codes).\n- IP or subnet allow-list.\n- Fully compatible with the [Traefik Plugin System](https://doc.traefik.io/traefik/plugins/overview/).\n\n## Installation\n\nEnable the local plugin in your `traefik.yaml` or `config.yaml`:\n\n```yaml\nexperimental:\n  localPlugins:\n    traefik-plugin-geo-filt:\n      moduleName: github.com/eterline/geo-filt\n```\n\n### Configuration\n\nExample middleware configuration (dynamic.yaml):\n\n```yaml\nhttp:\n  middlewares:\n    geofilter:\n        plugin:\n            traefik-plugin-geo-filt:\n                enabled: true # Turn on filter plugin\n                headerBearer: false # Search request IP in headers \"Forwarded\", \"X-Forwarded-For\", \"X-Real-IP\"\n                allowPrivate: true # Allows RFC 1918 (IPv4 addresses), RFC 4193 (IPv6 addresses) and loopback IPs\n                codeFile: \"./plugins/github.com/eterline/geo-filt/dataset/locations.csv\"\n                geoFile: \n                  - \"./plugins/github.com/eterline/geo-filt/dataset/subnets_ipv4.csv\"\n                  - \"./plugins/github.com/eterline/geo-filt/dataset/subnets_ipv6.csv\"\n                tags: [\"ru\"] # Country allow code\n                defined: [\"216.58.211.0/24\", \"142.250.74.142\"] # IP or subnet allow\n\n```\n\nDefault parameters usage:\n| Option         | Type      | Default | Description                                                           |\n| -------------- | --------- | ------- | --------------------------------------------------------------------- |\n| `enabled`      | bool      | `false` | Enable or disable the filter                                          |\n| `headerBearer` | bool      | `false` | If `true`, try to resolve IP from headers; otherwise use `RemoteAddr` |\n| `allowPrivate` | bool      | `false` | Allow private and loopback IPs                                        |\n| `codeFile`     | string    | —       | Path to CSV with country codes                                        |\n| `geoFile`      | \\[]string | —       | Paths to IP subnets CSV                                              |                                      |\n| `tags`         | \\[]string | —       | Allowed country ISO codes                                             |\n| `defined`      | \\[]string | —       | Additional allowed IPs or subnets                                     |\n\nExample router usage:\n```yaml\nhttp:\n  routers:\n    my-app:\n      rule: \"Host(`example.com`)\"\n      service: my-app-svc\n      middlewares:\n        - geofilter@file\n```\n\n## Update database\n\n1. Go to [Site](https://www.iplocate.io).\n2. Register in site. ![Reg screenshot](./img/reg.jpg)\n3. Copy api key. ![Key screenshot](./img/key.jpg)\n4. go to address: `https://www.iplocate.io/download/ip-to-country-geolite2.csv?apikey=`\u003cb\u003e\\\u003capi_key_here\\\u003e\u003c/b\u003e.\n5. Unzip archive. ![Key screenshot](./img/cli.jpg)\n6. Move it to container mounted dir and set path in config.\n\n## License\n\n[AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.txt)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feterline%2Fgeo-filt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feterline%2Fgeo-filt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feterline%2Fgeo-filt/lists"}