{"id":30663588,"url":"https://github.com/termermc/go-ipdb","last_synced_at":"2026-06-29T11:31:31.469Z","repository":{"id":305658530,"uuid":"1021775887","full_name":"termermc/go-ipdb","owner":"termermc","description":"Go library to get IP country, check for VPNs and detect Tor users","archived":false,"fork":false,"pushed_at":"2025-11-13T07:01:18.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-13T08:15:35.043Z","etag":null,"topics":["database","geoip","ip","vpn-blocker"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/termermc.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-07-17T23:57:42.000Z","updated_at":"2025-11-13T06:59:00.000Z","dependencies_parsed_at":"2025-07-21T11:41:25.278Z","dependency_job_id":null,"html_url":"https://github.com/termermc/go-ipdb","commit_stats":null,"previous_names":["termermc/go-ipdb"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/termermc/go-ipdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fgo-ipdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fgo-ipdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fgo-ipdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fgo-ipdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/termermc","download_url":"https://codeload.github.com/termermc/go-ipdb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fgo-ipdb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34925718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"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":["database","geoip","ip","vpn-blocker"],"created_at":"2025-08-31T17:13:44.381Z","updated_at":"2026-06-29T11:31:31.464Z","avatar_url":"https://github.com/termermc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-ipdb\n\nSelf-contained IP database library for Go.\n\n**See also: [go-domaindb](https://github.com/termermc/go-domaindb)**\n\nAutomatically downloads and caches various types of IP databases for local in-process querying without reaching out to external APIs.\n\nSupports the following operations:\n - Get ISO 3166 country code for IP address (geoIP)\n - Check if IP address is a range database (such as Tor exit nodes or known VPNs)\n - Optional bring-your-own download logic\n - Optional bring-your-own caching logic\n\nRequests for IP data do not leave your process, and you can aggregate multiple data sources into a single database for better accuracy.\n\nEven if remote lists go down, the library can still function by using cached data.\nIf you specify multiple data sources, the failing sources will be skipped and the remaining sources will be used.\n\n## Use Cases\n\nThis library is useful if:\n - You need to block non-human requests to parts of your application\n - You don't want to rely on an external service for IP data\n - You have strict privacy requirements that prevent using an external service for IP data\n - You need to aggregate multiple IP data sources into a single database\n\n## Download\n\nAdd to your project by running:\n\n```bash\ngo get github.com/termermc/go-ipdb\n```\n\n## Examples\n\nSee [examples](examples) for more usage examples.\n\nBelow are some simpler examples demonstrating the basic usage of the library.\n\n## IP to Country\n\nThe IP to country system uses the MaxMindDB (`.mmdb`) format. By specifying a URL to a mirror of the MaxMind GeoLite2 database,\nyour application can resolve the ISO 3166 country code of visitor IP addresses. A default can be provided if the IP address's country is not known.\n\n```go\nip := netip.MustParseAddr(\"13.107.246.40\")\n\ncc, err := ipdb.ResolveIpIsoCountry(ip)\nif err != nil {\n\tpanic(err)\n}\n\nprintln(cc) // US\n```\n\n## IP Range Database Check\n\nThe IP range database check system uses newline-separated list(s) of IP ranges in CIDR notation or bare IP addresses.\nAny bare IP addresses will be assumed to be `/32` for IPv4 and `/128` for IPv6.\nBare IPs and CIDR ranges can be mixed in the same list.\n\nAll lists will be loaded into the in-memory database and IPs can be checked against them.\nMultiple lists can be combined for better detection.\n\n```go\n// Assuming you have a DB named \"tor-exit\" containing Tor exit node IPs\nconst DbTorExit = \"tor-exit\"\n\nip := netip.MustParseAddr(\"13.107.246.40\")\n\nisTor, err := ipdb.IsIpInRangeDb(DbTorExit, ip)\nif err != nil {\n     panic(err)\n}\n\nif isTor {\n\tprintln(\"Tor exit node IP detected\")\n}\n```\n\n## Obtaining Database Files\n\nYou can find many different IP lists online in `.txt` format for datacenter and VPN ranges.\nA few list URLs are included in the examples directory.\nGoogling will yield more results. You should avoid any lists that are not updated frequently.\n\nFor Tor exit nodes, you can use [Dan's exit node list](https://www.dan.me.uk/torlist/?exit).\nKeep in mind that this list rate limits you to 1 request per 30 minutes, so ensure you configure the Ipdb not to download faster than that.\nIn general, you should be updating your databases every hour, or even less frequently.\n\nMaxMind provides the free GeoLite2 database on their website, but you must agree to their terms of use and sign up before downloading it.\nThere are public mirrors without this limitation online. You can Google \"geolite2 country mmdb\" to find them.\nA mirror URL from an NPM package is included in the examples directory.\n\nPlease keep in mind that the more lists you use, the more memory your process will consume.\nThe in-memory representation of a database is larger than the database file itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftermermc%2Fgo-ipdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftermermc%2Fgo-ipdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftermermc%2Fgo-ipdb/lists"}