{"id":13466206,"url":"https://github.com/oschwald/geoip2-golang","last_synced_at":"2025-05-14T08:04:47.099Z","repository":{"id":15059360,"uuid":"17785557","full_name":"oschwald/geoip2-golang","owner":"oschwald","description":"Unofficial MaxMind GeoIP2 Reader for Go","archived":false,"fork":false,"pushed_at":"2025-05-05T13:49:50.000Z","size":168,"stargazers_count":2017,"open_issues_count":7,"forks_count":205,"subscribers_count":31,"default_branch":"main","last_synced_at":"2025-05-07T07:07:25.143Z","etag":null,"topics":["database","geoip","geoip2","geolocation","go","maxmind","maxmind-db"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"bibryam/camel-redis","license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oschwald.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}},"created_at":"2014-03-15T21:10:40.000Z","updated_at":"2025-05-06T05:44:02.000Z","dependencies_parsed_at":"2022-07-20T12:17:17.614Z","dependency_job_id":"473397f0-4aa1-4516-8260-5d5cf622a889","html_url":"https://github.com/oschwald/geoip2-golang","commit_stats":{"total_commits":151,"total_committers":19,"mean_commits":7.947368421052632,"dds":0.2715231788079471,"last_synced_commit":"576a46d19bb59f32d0215cb43285b8928891b6bc"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oschwald%2Fgeoip2-golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oschwald%2Fgeoip2-golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oschwald%2Fgeoip2-golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oschwald%2Fgeoip2-golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oschwald","download_url":"https://codeload.github.com/oschwald/geoip2-golang/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101588,"owners_count":22014907,"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","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","geoip2","geolocation","go","maxmind","maxmind-db"],"created_at":"2024-07-31T15:00:40.858Z","updated_at":"2025-05-14T08:04:47.040Z","avatar_url":"https://github.com/oschwald.png","language":"Go","funding_links":[],"categories":["Go","开源类库","Open source library","🚩 Useful library","Repositories"],"sub_categories":["网络","The Internet"],"readme":"# GeoIP2 Reader for Go #\n\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/oschwald/geoip2-golang)](https://pkg.go.dev/github.com/oschwald/geoip2-golang)\n\nThis library reads MaxMind [GeoLite2](http://dev.maxmind.com/geoip/geoip2/geolite2/)\nand [GeoIP2](http://www.maxmind.com/en/geolocation_landing) databases.\n\nThis library is built using\n[the Go maxminddb reader](https://github.com/oschwald/maxminddb-golang).\nAll data for the database record is decoded using this library. If you only\nneed several fields, you may get superior performance by using maxminddb's\n`Lookup` directly with a result struct that only contains the required fields.\n(See [example_test.go](https://github.com/oschwald/maxminddb-golang/blob/main/example_test.go)\nin the maxminddb repository for an example of this.)\n\n## Installation ##\n\n```\ngo get github.com/oschwald/geoip2-golang\n```\n\n## Usage ##\n\n[See GoDoc](http://godoc.org/github.com/oschwald/geoip2-golang) for\ndocumentation and examples.\n\n## Example ##\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\n\t\"github.com/oschwald/geoip2-golang\"\n)\n\nfunc main() {\n\tdb, err := geoip2.Open(\"GeoIP2-City.mmdb\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\t// If you are using strings that may be invalid, check that ip is not nil\n\tip := net.ParseIP(\"81.2.69.142\")\n\trecord, err := db.City(ip)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"Portuguese (BR) city name: %v\\n\", record.City.Names[\"pt-BR\"])\n\tif len(record.Subdivisions) \u003e 0 {\n\t\tfmt.Printf(\"English subdivision name: %v\\n\", record.Subdivisions[0].Names[\"en\"])\n\t}\n\tfmt.Printf(\"Russian country name: %v\\n\", record.Country.Names[\"ru\"])\n\tfmt.Printf(\"ISO country code: %v\\n\", record.Country.IsoCode)\n\tfmt.Printf(\"Time zone: %v\\n\", record.Location.TimeZone)\n\tfmt.Printf(\"Coordinates: %v, %v\\n\", record.Location.Latitude, record.Location.Longitude)\n\t// Output:\n\t// Portuguese (BR) city name: Londres\n\t// English subdivision name: England\n\t// Russian country name: Великобритания\n\t// ISO country code: GB\n\t// Time zone: Europe/London\n\t// Coordinates: 51.5142, -0.0931\n}\n\n```\n\n## Testing ##\n\nMake sure you checked out test data submodule:\n\n```\ngit submodule init\ngit submodule update\n```\n\nExecute test suite:\n\n```\ngo test\n```\n\n## Contributing ##\n\nContributions welcome! Please fork the repository and open a pull request\nwith your changes.\n\n## License ##\n\nThis is free software, licensed under the ISC license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foschwald%2Fgeoip2-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foschwald%2Fgeoip2-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foschwald%2Fgeoip2-golang/lists"}