{"id":18968942,"url":"https://github.com/finnbear/db_ip","last_synced_at":"2025-04-19T14:45:17.593Z","repository":{"id":57616622,"uuid":"457167538","full_name":"finnbear/db_ip","owner":"finnbear","description":"An (unofficial) Rust library for querying db-ip.com data","archived":false,"fork":false,"pushed_at":"2024-12-11T03:56:16.000Z","size":3754,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T08:51:09.616Z","etag":null,"topics":["country-codes","geolocation","geolocation-database","ip","ipv4","ipv6","rust","rust-crate","rust-lang","rust-library"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/db_ip","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/finnbear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-DBIP","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}},"created_at":"2022-02-09T01:38:16.000Z","updated_at":"2024-12-11T03:56:20.000Z","dependencies_parsed_at":"2024-11-08T20:16:50.326Z","dependency_job_id":null,"html_url":"https://github.com/finnbear/db_ip","commit_stats":{"total_commits":40,"total_committers":2,"mean_commits":20.0,"dds":"0.19999999999999996","last_synced_commit":"bed74e5cde6ecb3bfad4a21e8e487a3fbe8976b6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnbear%2Fdb_ip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnbear%2Fdb_ip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnbear%2Fdb_ip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnbear%2Fdb_ip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/finnbear","download_url":"https://codeload.github.com/finnbear/db_ip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248852183,"owners_count":21171842,"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":["country-codes","geolocation","geolocation-database","ip","ipv4","ipv6","rust","rust-crate","rust-lang","rust-library"],"created_at":"2024-11-08T14:48:54.191Z","updated_at":"2025-04-16T07:34:28.570Z","avatar_url":"https://github.com/finnbear.png","language":"Rust","readme":"# db_ip\n\nAn (unofficial) library for querying [db-ip.com](https://db-ip.com/) CSV databases in safe Rust.\n\nThis library is not affiliated with or endorsed by [db-ip.com](https://db-ip.com/).\n\nBe advised that, by using this library with lite databases (such as the one downloaded\nautomatically in the build step), you are subject to [license terms](LICENSE-DBIP)\n(requiring attribution).\n\n## Examples\n\nYou can use `DbIpDatabase\u003cCountryCode\u003e` to get the actual two-letter country code. The country code database will be\nembedded, in a compressed form, in your Rust binary.\n\n```rust\nuse db_ip::{DbIpDatabase, CountryCode, include_country_code_database};\n\n// Embed compressed database in binary:\nlet db = include_country_code_database!();\n// Or, load it from the filesystem:\n// let db = DbIpDatabase::\u003cCountryCode\u003e::from_csv_file(\"country_or_city_data.csv\").unwrap();\n\nassert_eq!(\n    db.get(\u0026\"192.99.174.0\".parse().unwrap()),\n    Some(CountryCode::from_str(\"US\").unwrap())\n);\n```\n\nYou can use `DbIpDatabase\u003cRegion\u003e`, enabled by the `region` feature, to gain a broad understanding of an IP's location.\nSince there are fewer possibilities, this takes less binary size and RAM.\n\n```rust\nuse db_ip::{DbIpDatabase, Region, include_region_database};\n\n// Embed compressed database in binary:\nlet db = include_region_database!();\n// Or, load it from the filesystem:\n// let db = DbIpDatabase::\u003cRegion\u003e::from_csv_file(\"country_or_city_data.csv\").unwrap();\n\nassert_eq!(\n    db.get(\u0026\"192.99.174.0\".parse().unwrap()),\n    Some(Region::NorthAmerica)\n);\n```\n\nFinally, you can implement `IpData` yourself, to store any other type of data that can be derived from Country or\nCity data records.\n\n## Downloading IP Geolocation Data\n\nYou can manually download the actual ip geolocation data (in CSV format) in one of the following ways.\n\n- Use the default `download-country-lite` feature, which attempts to download the most recent available Country lite data\n- [Country data lite](https://db-ip.com/db/download/ip-to-country-lite) (recommended)\n- [City data lite](https://db-ip.com/db/download/ip-to-city-lite) (larger file size)\n- You may also try the paid database versions for better accuracy, but they have not been tested with this crate\n\nOnce you have downloaded a CSV file, use the `csv` feature to load it.\n\n## Features\n\nThe raw csv data takes a while to parse, even in release mode. You may use\nthe `serde` feature to create and load a serialized version.\n\nYou can selectively disable the `ipv4` and `ipv6` features, depending on your needs. Both are\non by default.\n\nLookups are relatively speedy, taking less than 100ns in release mode.\n\n## Limitations\n\nIf you want easier access to data other than `CountryCode` and `Region`, create an issue.\n\nThe [db-ip.com](https://db-ip.com/) API is not currently supported, so it is difficult to\nkeep the database up to date.\n\n## License\n\nCode licensed 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\nBundled/downloaded geolocation data licensed under [LICENSE-DBIP](LICENSE-DBIP).\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinnbear%2Fdb_ip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffinnbear%2Fdb_ip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinnbear%2Fdb_ip/lists"}