{"id":15067656,"url":"https://github.com/ghztomash/public-ip-address","last_synced_at":"2025-04-10T14:36:52.590Z","repository":{"id":227332983,"uuid":"771108826","full_name":"ghztomash/public-ip-address","owner":"ghztomash","description":"Rust crate to retrieve public IP address and geolocation data. 🦀","archived":false,"fork":false,"pushed_at":"2024-04-25T21:58:34.000Z","size":830,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-01T23:33:59.519Z","etag":null,"topics":["crate","geolocation","geolocation-api","ip","network-programming","public-ip-address","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","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/ghztomash.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ghztomash"}},"created_at":"2024-03-12T17:46:38.000Z","updated_at":"2024-04-25T21:57:08.000Z","dependencies_parsed_at":"2024-04-09T23:35:34.920Z","dependency_job_id":"148980ee-42a3-4eb8-af65-9af8e44771e9","html_url":"https://github.com/ghztomash/public-ip-address","commit_stats":null,"previous_names":["ghztomash/public-ip-address"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghztomash%2Fpublic-ip-address","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghztomash%2Fpublic-ip-address/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghztomash%2Fpublic-ip-address/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghztomash%2Fpublic-ip-address/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghztomash","download_url":"https://codeload.github.com/ghztomash/public-ip-address/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248233953,"owners_count":21069493,"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":["crate","geolocation","geolocation-api","ip","network-programming","public-ip-address","rust","rust-lang"],"created_at":"2024-09-25T01:25:38.170Z","updated_at":"2025-04-10T14:36:52.568Z","avatar_url":"https://github.com/ghztomash.png","language":"Rust","funding_links":["https://github.com/sponsors/ghztomash"],"categories":[],"sub_categories":[],"readme":"# 🔎 Public IP Address Lookup and Geolocation Information\n\n\u003cdiv align=\"center\"\u003e\n  \n  [![Crates.io](https://img.shields.io/crates/v/public-ip-address.svg)](https://crates.io/crates/public-ip-address)\n  [![Documentation](https://docs.rs/public-ip-address/badge.svg)](https://docs.rs/public-ip-address)\n  ![cargo build](https://github.com/ghztomash/public-ip-address/actions/workflows/ci.yml/badge.svg)\n  ![Crates.io License](https://img.shields.io/crates/l/public-ip-address)\n\n\u003c/div\u003e\n\n![Demo](./assets/map_example.png)\n\n`public-ip-address` is a simple Rust library for performing public IP lookups from over a dozen of various services.\n\nIt provides a unified interface to fetch public IP address and geolocation information from multiple providers.\nArbitrary IP address lookup and access API keys are supported for certain providers.\nThe library provides an asynchronous and blocking interfaces to make it easy to integrate with other `async` codebase.\n\nThe library also includes caching functionality to improve performance for repeated lookups\nand minimize reaching rate-limiting thresholds.\nThe cache file can be encrypted when enabled through a feature flag for additional privacy.\n\n## Usage\n\nAdd the following to your `Cargo.toml` file:\n```toml\n[dependencies]\npublic-ip-address = { version = \"0.3\" }\n\n# with cache encryption enabled\npublic-ip-address = { version = \"0.3\", features = [\"encryption\"] }\n\n# with `async` disabled\npublic-ip-address = { version = \"0.3\", features = [\"blocking\"] }\n```\n## Example\n\nThe simplest way to use this library is to call the `perform_lookup()` function, which returns a `Result` with a `LookupResponse`.\n```rust\nuse std::error::Error;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    // Perform my public IP address lookup\n    let result = public_ip_address::perform_lookup(None).await?;\n    println!(\"{}\", result);\n    Ok(())\n}\n```\nWith `blocking` interface enabled:\n```rust\nuse std::error::Error;\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    // Perform my public IP address lookup\n    let result = public_ip_address::perform_lookup(None)?;\n    println!(\"{}\", result);\n    Ok(())\n}\n```\n\nMore examples can be found in the `examples` directory. And run them with the following command:\n```bash\ncargo run --example \u003cexample_name\u003e\n```\n\nRunning the examples with the `blocking` feature enabled: \n```bash\ncargo run --example \u003cexample_name\u003e --features blocking\n```\n\n## Providers\n\n| Provider | URL | Rate Limit | API Key | Target Lookup |\n| --- | --- | --- | --- | --- |\n| FreeIpApi | [https://freeipapi.com](https://freeipapi.com) | 60 / minute | ✔️ | ✔️ |\n| IfConfig | [https://ifconfig.co](https://ifconfig.co) | 1 / minute |  | ✔️ |\n| IpInfo | [https://ipinfo.io](https://ipinfo.io) | 50000 / month | ✔️ | ✔️ |\n| MyIp | [https://my-ip.io](https://my-ip.io) | ? / day | ️ | ️ |\n| IpApiCom | [https://ip-api.com](https://ip-api.com) | 45 / minute |  | ✔️ |\n| IpWhoIs | [https://ipwhois.io](https://ipwhois.io) | 10000 / month | ️ | ✔️ |\n| IpApiCo | [https://ipapi.co](https://ipapi.co) | 30000 / month |  | ✔️ |\n| IpApiIo | [https://ip-api.io](https://ip-api.io) | ? / day | ✔️ | ✔️ |\n| IpBase | [https://ipbase.com](https://ipbase.com) | 10 / hour | ✔️ | ✔️ |\n| IpLocateIo | [https://iplocate.io](https://iplocate.io) | 50 / day | ✔️ | ✔️ |\n| IpLeak | [https://ipleak.net](https://ipleak.net) | ? / day | ️ | ✔️ |\n| Mullvad | [https://mullvad.net](https://mullvad.net) | ? / day | ️ | ️ |\n| AbstractApi | [https://abstractapi.com](https://abstractapi.com) | 1000 / day | ✔️ | ✔️ |\n| IpGeolocation | [https://ipgeolocation.io](https://ipgeolocation.io) | 1000 / day | ✔️ | ✔️ |\n| IpData | [https://ipdata.co](https://ipdata.co) | 1500 / day | ✔️ | ✔️ |\n| Ip2Location | [https://ip2location.io](https://ip2location.io) | 500 / day (with key 30000 / month) | ✔️ | ✔️ |\n| MyIpCom | [https://myip.com](https://myip.com) | unlimited | ️ | ️ |\n| GetJsonIp | [https://getjsonip.com](https://getjsonip.com) | unlimited | ️ | ️ |\n| Ipify | [https://www.ipify.org](https://www.ipify.org) | unlimited | ️ | ️ |\n\n## Roadmap\n\n- [x] Initial release\n- [x] Add more providers\n- [x] Add support for additional providers with API key\n- [x] Add reverse lookup feature\n- [x] Add asynchronous and synchronous interface support\n- [ ] Bulk lookup\n- [ ] Offline reverse lookup\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nContributions are welcome! Please submit a pull request.\n\n## Support\n\nIf you encounter any problems or have any questions, please open an issue in the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghztomash%2Fpublic-ip-address","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghztomash%2Fpublic-ip-address","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghztomash%2Fpublic-ip-address/lists"}