{"id":19062615,"url":"https://github.com/mellon85/external-ip","last_synced_at":"2025-04-16T01:23:50.649Z","repository":{"id":36897524,"uuid":"230725773","full_name":"mellon85/external-ip","owner":"mellon85","description":"External IP crate","archived":false,"fork":false,"pushed_at":"2025-03-16T09:22:07.000Z","size":108,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T03:23:28.174Z","etag":null,"topics":["dns","http","igd","ip","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mellon85.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}},"created_at":"2019-12-29T08:51:20.000Z","updated_at":"2025-03-16T09:20:01.000Z","dependencies_parsed_at":"2024-04-26T18:32:37.591Z","dependency_job_id":"583021e0-f42b-419b-84bc-fe1caa149a0d","html_url":"https://github.com/mellon85/external-ip","commit_stats":{"total_commits":51,"total_committers":5,"mean_commits":10.2,"dds":"0.13725490196078427","last_synced_commit":"974c1846bb86e51ccb5bc0342423d7445e3380a5"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellon85%2Fexternal-ip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellon85%2Fexternal-ip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellon85%2Fexternal-ip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellon85%2Fexternal-ip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mellon85","download_url":"https://codeload.github.com/mellon85/external-ip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249179877,"owners_count":21225621,"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":["dns","http","igd","ip","rust"],"created_at":"2024-11-09T00:26:54.098Z","updated_at":"2025-04-16T01:23:50.628Z","avatar_url":"https://github.com/mellon85.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# external-ip\n\n[![Build Status](https://travis-ci.com/mellon85/external-ip.svg?branch=master)](https://travis-ci.com/mellon85/external-ip) \n\nFinds the current external IP address contacting http and dns external\nservices.\n\nIf at least one of the sources replies the reply with the highest occurrences\nwill be reported as the IP address.\n\nThree functions provides sets of known working sources.\n\n* `get_http_sources`\n  Returns all known http sources\n* `get_dns_sources`\n  Returns all known dns sources\n* `get_sources`\n  Returns all sources combined\n\nAdditionally a single igd source can be instantiated if the feature is enabled\n(`discover_igd`), to retrieve the IP from an home router.\nIf the feature is enabled `get_sources` will return it as a source too.\n\n\n# Runtime\n\nIt requires to run with Tokio runtime due to the dependency on hyper if you use the HTTP resolver.\nThe DNS resolver can work with other executors at the moment. (tested with futures)\n\n# Extend\n\nIt's possible to extend how the sources dynamically via the API as long as the\nSource interface is implemented and it's passed as a boxed trait object.\n\n# Example\n\nFor ease of use a single async function is enough to obtain the IP trying with\nall the default sources enabled\n\n```rust\n  let result = external_ip::get_ipv4();\n  let value : Option\u003cIpAddr\u003e = block_on(result);\n\n```\n\n```rust\n  let result = external_ip::get_ipv6();\n  let value : Option\u003cIpAddr\u003e = block_on(result);\n\n```\n\n# Policies\n\nThe library supports 3 consensus policies. The default policy is Random\n\n- All\n  Query all sources in parallel and return the most common response\n- First\n  Query the sources one by one and return the first success\n- Random\n  Query the sources one by one in random order and return the first success\n\n# Families\n\nIt's possible to select a specific address family to resolve to and all resolver will try to resolve to that or fail.\n- All\n- IPv4\n- IPv6\n\n# Changelog\n\n## v1\n\n- Initial release\n\n## v2\n\n- Based on trust dns instead of c-ares. Now requires less external dependencies (only ssl at the moment)\n\n## v3\n\n- The default policy is now random\n\n## v4\n\n- Consensus is now not consumed when used\n\n## v5\n\n- Added ip family selection option\n- Support http sources with IPv6\n- Updated http and dns sources\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmellon85%2Fexternal-ip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmellon85%2Fexternal-ip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmellon85%2Fexternal-ip/lists"}