{"id":28744175,"url":"https://github.com/ipinfo/rust","last_synced_at":"2025-06-16T11:10:59.225Z","repository":{"id":46160634,"uuid":"218668469","full_name":"ipinfo/rust","owner":"ipinfo","description":"IPinfo Rust library for IPinfo API (IP geolocation and other types of IP data)","archived":false,"fork":false,"pushed_at":"2025-05-08T17:47:32.000Z","size":153,"stargazers_count":61,"open_issues_count":0,"forks_count":14,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-06-13T11:55:45.665Z","etag":null,"topics":["ip-address","ip-database","ip-geolocation","ipinfo","rust"],"latest_commit_sha":null,"homepage":"https://ipinfo.io","language":"Rust","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":null,"contributing":"CONTRIBUTING.md","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":"2019-10-31T02:31:34.000Z","updated_at":"2025-05-19T14:07:46.000Z","dependencies_parsed_at":"2024-01-18T11:42:46.374Z","dependency_job_id":null,"html_url":"https://github.com/ipinfo/rust","commit_stats":{"total_commits":100,"total_committers":9,"mean_commits":11.11111111111111,"dds":0.72,"last_synced_commit":"6ce1786d67ee05563db230fc33bc8d1715434a26"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/ipinfo/rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Frust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Frust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Frust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Frust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipinfo","download_url":"https://codeload.github.com/ipinfo/rust/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Frust/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260148401,"owners_count":22965915,"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":["ip-address","ip-database","ip-geolocation","ipinfo","rust"],"created_at":"2025-06-16T11:10:58.633Z","updated_at":"2025-06-16T11:10:59.211Z","avatar_url":"https://github.com/ipinfo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [\u003cimg src=\"https://ipinfo.io/static/ipinfo-small.svg\" alt=\"IPinfo\" width=\"24\"/\u003e](https://ipinfo.io/) IPinfo Rust Client Library\n\nThis is the Rust client library for the [IPinfo.io](https://ipinfo.io) IP address API.\nIt allows you to look up your own IP address, or get any of the following details for an IP:\n\n- [IP Geolocation](https://ipinfo.io/ip-geolocation-api) (city, region, country, postal code, latitude, and longitude)\n- [ASN](https://ipinfo.io/asn-api) (ISP or network operator, associated domain name, and type, such as business, hosting, or company)\n- [Company data](https://ipinfo.io/ip-company-api) (the name and domain of the business that uses the IP address)\n- [Carrier details](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## Usage\n\nTo use IPinfo, add the following to your `Cargo.toml` file.\n\n```toml\n[dependencies]\nipinfo = \"3.1.1\"\n```\n\n## Getting Started\n\nAn access token is required, which can be acquired by signing up for a free account\nat [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\ndata fields such as the IP type and company information. To get the complete list of\ninformation on an IP address and make more requests per day see [https://ipinfo.io/pricing](https://ipinfo.io/pricing).\n\n⚠️ Note: This library does not currently support our newest free API https://ipinfo.io/lite. If you’d like to use IPinfo Lite, you can call the [endpoint directly](https://ipinfo.io/developers/lite-api) using your preferred HTTP client. Developers are also welcome to contribute support for Lite by submitting a pull request.\n\n## Examples\n\nThere are several ready-to-run examples located in the `/examples` directory. These can be run directly, replacing `\u003ctoken\u003e` with your access token\n\n```bash\ncargo run --example lookup -- \u003ctoken\u003e\n```\n\n```bash\ncargo run --example lookup_batch -- \u003ctoken\u003e\n```\n\n```bash\ncargo run --example get_map\n```\n\nThe `lookup` example above looks more or less like\n\n```rust\nuse ipinfo::{IpInfo, IpInfoConfig};\n#[tokio::main]\nasync fn main() {\n    let config = IpInfoConfig {\n        token: Some(\"\u003ctoken\u003e\".to_string()),\n        ..Default::default()\n    };\n\n    let mut ipinfo = IpInfo::new(config)\n        .expect(\"should construct\");\n\n    let res = ipinfo.lookup(\"8.8.8.8\").await;\n    match res {\n        Ok(r) =\u003e {\n            println!(\"{} lookup result: {:?}\", \"8.8.8.8\", r);\n        },\n        Err(e) =\u003e println!(\"error occurred: {}\", \u0026e.to_string()),\n    }\n}\n```\n\n## Features\n\n- Smart LRU cache for cost and quota savings.\n- Structured and type-checked query results.\n- Bulk IP address lookup using IPinfo [batch API](https://ipinfo.io/developers/batch).\n- Locate IPs on a World Map.\n\n#### Internationalization\n\nWhen looking up an IP address, the `response` includes `country_name` which is the country name based on American English, `is_eu` which returns `true` if the country is a member of the European Union (EU), `country_flag` which includes the emoji and Unicode of a country's flag, `country_currency`\nwhich includes the code and symbol of a country's currency, `country_flag_url` which returns a public link to the country's flag image as an SVG which can be used anywhere. and `continent` which includes the code and name of the continent.\n\n```rust\nlet r = ipinfo.lookup(\"8.8.8.8\");\nprintln!(\"{}: {}\", \"8.8.8.8\", r.country_name) // United States\nprintln!(\"{}: {:?}\", \"8.8.8.8\", r.is_eu) // Some(false)\nprintln!(\"{}: {:?}\", \"8.8.8.8\", r.country_flag) // Some(CountryFlag { emoji: \"🇺🇸\", unicode: \"U+1F1FA U+1F1F8\" })\nprintln!(\"{}: {:?}\", \"8.8.8.8\", r.country_flag_url) // Some(https://cdn.ipinfo.io/static/images/countries-flags/US.svg)\nprintln!(\"{}: {:?}\", \"8.8.8.8\", r.country_currency) // Some(CountryCurrency { code: \"USD\", symbol: \"$\" })\nprintln!(\"{}: {:?}\", \"8.8.8.8\", r.continent) // Some(Continent { code: \"NA\", name: \"North America\" })\n```\n\nIt is possible to return the country name in other languages, change the EU countries and change the flag emoji or unicode by setting the `default_countries`, `default_eu`, `default_country_flags`, `default_currencies` and `default_continents` when creating the `IPinfo` client.\n\n```rust\nlet countries = {\n    let json_data = r#\"\n        {\n            \"US\": \"United States\"\n        }\n    \"#;\n    serde_json::from_str(json_data).expect(\"error parsing user-defined JSON!\")\n};\n\nlet config = IpInfoConfig {\n    default_countries: countries,\n    ..Default::default()\n};\n```\n\n## Other Libraries\n\nThere are official IPinfo client libraries available for many languages including\nPHP, Go, Java, Ruby, and many popular frameworks such as Django, Rails, and Laravel.\nThere are also many third-party libraries and integrations available for our API.\n\n## Contributing\n\nThought of something you'd like to see? You can visit the issue tracker\nto check if it was reported or proposed before, and if not please feel free to\ncreate an issue or feature request. Ready to start contributing?\nThe [contributing guide][contributing] is a good place to start. If you have\nquestions please feel free to ask.\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, Reverse IP, 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\n[contributing]: https://github.com/ipinfo/rust/blob/master/CONTRIBUTING.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipinfo%2Frust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipinfo%2Frust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipinfo%2Frust/lists"}