{"id":28744188,"url":"https://github.com/ipinfo/go","last_synced_at":"2025-10-07T06:49:21.023Z","repository":{"id":26850155,"uuid":"108666795","full_name":"ipinfo/go","owner":"ipinfo","description":"Go library for IPinfo API (IP geolocation and other types of IP data)","archived":false,"fork":false,"pushed_at":"2025-07-23T20:38:44.000Z","size":201,"stargazers_count":138,"open_issues_count":2,"forks_count":26,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-09-29T13:49:56.754Z","etag":null,"topics":["go","ip-address","ip-data","ip-geolocation","ipinfo"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/ipinfo/go/v2","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ipinfo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2017-10-28T16:49:42.000Z","updated_at":"2025-07-23T20:37:48.000Z","dependencies_parsed_at":"2024-01-18T09:07:44.660Z","dependency_job_id":"4c3ed479-25a8-44ef-9aa4-394d63c801ab","html_url":"https://github.com/ipinfo/go","commit_stats":null,"previous_names":["ipinfo/go-ipinfo","ipinfoio/go-ipinfo"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/ipinfo/go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Fgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Fgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Fgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Fgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipinfo","download_url":"https://codeload.github.com/ipinfo/go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Fgo/sbom","scorecard":{"id":493866,"data":{"date":"2025-08-11","repo":{"name":"github.com/ipinfo/go","commit":"4441fd11aa3b1f1c225149d26163c6fa13772f63"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":4,"reason":"Found 7/16 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":5,"reason":"6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/ipinfo/go/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/ipinfo/go/ci.yaml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T19:56:34.165Z","repository_id":26850155,"created_at":"2025-08-19T19:56:34.165Z","updated_at":"2025-08-19T19:56:34.165Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278734406,"owners_count":26036404,"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-07T02:00:06.786Z","response_time":59,"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":["go","ip-address","ip-data","ip-geolocation","ipinfo"],"created_at":"2025-06-16T11:11:00.626Z","updated_at":"2025-10-07T06:49:21.016Z","avatar_url":"https://github.com/ipinfo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [\u003cimg src=\"https://ipinfo.io/static/ipinfo-small.svg\" alt=\"IPinfo\" width=\"24\"/\u003e](https://ipinfo.io/) IPinfo Go Client Library\n\n[![License](http://img.shields.io/:license-apache-blue.svg)](LICENSE)\n[![Go Reference](https://pkg.go.dev/badge/github.com/ipinfo/go/v2/ipinfo.svg)](https://pkg.go.dev/github.com/ipinfo/go/v2/ipinfo)\n\nThis is the official Go client library for the [IPinfo.io](https://ipinfo.io) IP address API, allowing you to look up your own IP address, or get any of the following details for other IP addresses:\n\n- [IP to Geolocation](https://ipinfo.io/ip-geolocation-api) (city, region, country, postal code, latitude, and longitude)\n- [IP to ASN](https://ipinfo.io/asn-api) (ISP or network operator, associated domain name, and type, such as business, hosting, or company)\n- [IP to Company](https://ipinfo.io/ip-company-api) (the name and domain of the business that uses the IP address)\n- [IP to Carrier](https://ipinfo.io/ip-carrier-api) (the name of the mobile carrier and MNC and MCC for that carrier if the IP is used exclusively for mobile traffic)\n\nCheck all the data we have for your IP address [here](https://ipinfo.io/what-is-my-ip).\n\n\n- [Getting Started](#getting-started)\n\t- [Installation](#installation)\n\t- [Quickstart](#quickstart)\n- [Authentication](#authentication)\n- [Internationalization](#internationalization)\n\t- [Country Name](#country-name)\n\t- [European Union (EU) Country](#european-union-eu-country)\n\t- [Country Flag](#country-flag)\n\t- [Country Currency](#country-currency)\n\t- [Continent](#continent)\n- [Map IP Address](#map-ip-address)\n- [Summarize IP Address](#summarize-ip-address)\n- [Caching](#caching)\n- [Batch Operations / Bulk Lookup](#batch-operations--bulk-lookup)\n- [Other Libraries](#other-libraries)\n- [About IPinfo](#about-ipinfo)\n\n# Getting Started\n\n\nYou'll need an IPinfo API access token, which you can get by signing up for a free account at [https://ipinfo.io/signup](https://ipinfo.io/signup).\n\nThe free plan is limited to 50,000 requests per month, and doesn't include some of the data fields such as IP type and company data. To enable all the data fields and additional request volumes see [https://ipinfo.io/pricing](https://ipinfo.io/pricing)\n\nYou can find the full package-level documentation here: https://pkg.go.dev/github.com/ipinfo/go/v2/ipinfo\n\nThe library also supports the Lite API, see the [Lite API section](#lite-api) for more info.\n\n## Installation\n\n```bash\ngo get github.com/ipinfo/go/v2/ipinfo\n```\n\n## Quickstart\n\nBasic usage of the package.\n\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\t\"github.com/ipinfo/go/v2/ipinfo\"\n)\n\nfunc main() {\n\tconst token = \"YOUR_TOKEN\"\n\t\n\t// params: httpClient, cache, token. `http.DefaultClient` and no cache will be used in case of `nil`.\n\tclient := ipinfo.NewClient(nil, nil, token)\n\n\tconst ip_address = \"8.8.8.8\"\n\tinfo, err := client.GetIPInfo(net.ParseIP(ip_address))\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(info)\n\t// Output: {8.8.8.8 dns.google false true Mountain View California US United States...\n}\n```\n\nThis data is available even on our free tier which includes up to 50,000 IP geolocation requests per month.\n\n# Authentication\n\nThe IPinfo Go library can be authenticated with your IPinfo API access token, which is passed as the third positional argument of the `ipinfo.NewClient()` method. Your IPInfo access token can be found in the account section of IPinfo's website after you have signed in: https://ipinfo.io/account/token\n\n```go\nconst token = \"YOUR_TOKEN\"\n// params: httpClient, cache, token. `http.DefaultClient` and no cache will be used in case of `nil`.\nclient := ipinfo.NewClient(nil, nil, token)\n```\n\n# Internationalization\n\n## Country Name\n\n`info.Country` returns the  ISO 3166 country code and `info.CountryName` returns the entire conuntry name:\n\n```go\nfmt.Println(info.Country)\n// Output: US\nfmt.Println(info.CountryName)\n// Output: United States\n```\n\n## European Union (EU) Country\n\n`info.IsEU` returns a boolean response to see if a country is a European Union country or not.\n\n```go\nfmt.Println(info.IsEU)\n// Output: false\n```\n\n## Country Flag\n\nGet country flag as an emoji and its Unicode value with `info.CountryFlag.Emoji` and `info.CountryFlag.Unicode` respectively.\n\n```go\nfmt.Println(info.CountryFlag.Emoji)\n// Output: 🇳🇿 \nfmt.Println(info.CountryFlag.Unicode)\n// Output: \"U+1F1F3 U+1F1FF\"\n```\n\n## Country Flag URL\n\nGet the link of a country's flag image.\n\n```go\nfmt.Println(info.CountryFlagURL)\n// Output: https://cdn.ipinfo.io/static/images/countries-flags/US.svg\"\n```\n\n## Country Currency\n\nGet country's currency code and its symbol with `info.CountryCurrency.Code` and `info.CountryCurrency.Symbol` respectively.\n\n```go\nfmt.Println(info.CountryCurrency.Code)\n// Output: USD \nfmt.Println(info.CountryCurrency.Symbol)\n// Output: $\n```\n\n## Continent\n\nGet the IP's continent code and its name with `info.Continent.Code` and `info.Continent.Name` respectively.\n\n```go\nfmt.Println(info.Continent.Code)\n// Output: NA \nfmt.Println(info.Continent.Name)\n// Output: North America\n```\n\n# Map IP Address\n\nYou can map up to 500,000 IP addresses all at once using the `GetIPMap` command. You can input:\n\n- IP addresses (IPV4 and IPV6 both)\n- IP Ranges or Netblock\n- ASN\n\nAfter the operation, you will be presented with a URL to a map generated on the IPinfo website.\n\nIP Map Code:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\n\t\"github.com/ipinfo/go/v2/ipinfo\"\n)\n\nfunc main() {\n\tclient := ipinfo.NewClient(nil, nil, \"YOUR_TOKEN\")\n\tresult, err := client.GetIPMap(\n\t\t[]net.IP{\n\t\t\tnet.ParseIP(\"136.111.157.61\"),\n\t\t\tnet.ParseIP(\"231.163.78.134\"),\n\t\t\t// ...\n\t\t\tnet.ParseIP(\"228.128.213.179\"),\n\t\t\tnet.ParseIP(\"103.172.175.76\"),\n\t\t},\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(result)\n}\n\n```\n\nResult:\n\nSee the output example map: https://ipinfo.io/tools/map/f27c7d40-3ff0-4ac2-878f-8d953dbcd3c8\n\n# Summarize IP Address\n\nSummarize IP addresses with `GetIPSummary` and output a report. \n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\n\t\"github.com/ipinfo/go/v2/ipinfo\"\n)\n\nfunc main() {\n\tclient := ipinfo.NewClient(nil, nil, \"YOUR_TOKEN\")\n\tresult, err := client.GetIPSummary(\n\t\t[]net.IP{\n\t\t\tnet.ParseIP(\"171.164.236.38\"),\n\t\t\tnet.ParseIP(\"206.132.224.214\"),\n\t\t\t// ....\n\t\t\tnet.ParseIP(\"208.191.89.104\"),\n\t\t\tnet.ParseIP(\"81.216.14.76\"),\n\t\t},\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(result)\n\t// Ouptut: {100 100 map[CN:7 DE:4 JP:12 MX:3 US:32] map[Columbus, ...\n\n}\n\n```\n\n# Batch Operations / Bulk Lookup\n\nYou can do batch lookups or bulk lookups quite easily as well. The inputs supported:\n\n- IP addresses. IPV4 and IPV6 both\n- ASN\n- Specific field endpoint of an IP address e.g. `8.8.8.8/country`\n   \n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\t\"github.com/ipinfo/go/v2/ipinfo\"\n\t\"github.com/ipinfo/go/v2/ipinfo/cache\"\n)\n\nfunc main() {\n\tclient := ipinfo.NewClient(\n\t\tnil,\n\t\tipinfo.NewCache(cache.NewInMemory().WithExpiration(5*time.Minute)),\n\t\t\"YOUR_TOKEN\",\n\t)\n\n\t// batchResult will contain all the batch lookup data\n\tbatchResult, err := client.GetBatch(\n\t\t[]string{\n\t\t\t\"104.193.114.182\",                    // you can pass IPV4 address\n\t\t\t\"8.8.8.8/country\",                    // you can get specific information\n\t\t\t\"AS36811\",                            // you can lookup ASN details\n\t\t\t\"2a03:2880:f10a:83:face:b00c:0:25de\", // IPV6 address\n\t\t},\n\t\tipinfo.BatchReqOpts{\n\t\t\tBatchSize:       2,\n\t\t\tTimeoutPerBatch: 0,\n\t\t\tTimeoutTotal:    5,\n\t\t},\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor k, v := range batchResult {\n\t\tfmt.Printf(\"k=%v v=%v\\n\", k, v)\n\t}\n}\n```\n\nExamples of Batch / Bulk Lookup:\n\n- [Batch ASN](/example/batch-asn)\n- [Batch Core Net-IP](/example/batch-core-netip)\n- [Batch Core str](/example/batch-core-str)\n- [Batch Generic](/example/batch-generic)\n\nThe loop declaration in the batch lookup showcases the \"caching\" capability of the IPinfo package.\n\n### Lite API\n\nThe library gives the possibility to use the [Lite API](https://ipinfo.io/developers/lite-api) too, authentication with your token is still required.\n\nThe returned details are slightly different from the Core API.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\t\"github.com/ipinfo/go/v2/ipinfo\"\n)\n\nfunc main() {\n\tconst token = \"YOUR_TOKEN\"\n\t\n\t// Create a Lite client\n\tclient := ipinfo.NewLiteClient(nil, nil, token)\n\t\n\t// Or use the package-level client\n\tipinfo.SetLiteToken(token)\n\t\n\tinfo, err := ipinfo.GetIPInfoLite(net.ParseIP(\"8.8.8.8\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(info.ASN)         // AS15169\n\tfmt.Println(info.Country)     // United States\n\tfmt.Println(info.CountryCode) // US\n}\n```\n\n# Other Libraries\n\nThere are official [IPinfo client libraries](https://ipinfo.io/developers/libraries) available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails, and Laravel. There are also many third-party libraries and integrations available for our API.\n\n# About IPinfo\n\nFounded in 2013, IPinfo prides itself on being the most reliable, accurate, and in-depth source of IP address data available anywhere. We process terabytes of data to produce our custom IP geolocation, company, carrier, VPN detection, hosted domains, and IP type data sets. Our API handles over 40 billion requests a month for 100,000 businesses and developers.\n\n[![image](https://avatars3.githubusercontent.com/u/15721521?s=128\u0026u=7bb7dde5c4991335fb234e68a30971944abc6bf3\u0026v=4)](https://ipinfo.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipinfo%2Fgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipinfo%2Fgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipinfo%2Fgo/lists"}