{"id":25105077,"url":"https://github.com/leoborai/local-ip-address","last_synced_at":"2025-03-21T23:10:01.264Z","repository":{"id":39876140,"uuid":"377041702","full_name":"LeoBorai/local-ip-address","owner":"LeoBorai","description":"Retrieve system's local IP address and Network Interfaces/Adapters on FreeBSD, Linux, macOS and Windows","archived":false,"fork":false,"pushed_at":"2024-09-17T00:17:58.000Z","size":117,"stargazers_count":112,"open_issues_count":11,"forks_count":30,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-18T06:40:35.918Z","etag":null,"topics":["bsd","dhcp","freebsd","ip","linux","local-ip","macos","network","rust","windows"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/local-ip-address","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/LeoBorai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2021-06-15T05:04:13.000Z","updated_at":"2025-03-08T13:05:32.000Z","dependencies_parsed_at":"2023-12-12T03:23:31.689Z","dependency_job_id":"877714f5-693b-482b-94bf-6308ccff4663","html_url":"https://github.com/LeoBorai/local-ip-address","commit_stats":{"total_commits":113,"total_committers":18,"mean_commits":6.277777777777778,"dds":0.6283185840707964,"last_synced_commit":"c66bf1e23ee76dd04e8332f84afca5cc648957c3"},"previous_names":["leoborai/local-ip-address","estebanborai/local-ip-address"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoBorai%2Flocal-ip-address","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoBorai%2Flocal-ip-address/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoBorai%2Flocal-ip-address/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoBorai%2Flocal-ip-address/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeoBorai","download_url":"https://codeload.github.com/LeoBorai/local-ip-address/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244880655,"owners_count":20525516,"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":["bsd","dhcp","freebsd","ip","linux","local-ip","macos","network","rust","windows"],"created_at":"2025-02-07T22:11:07.235Z","updated_at":"2025-03-21T23:10:01.219Z","avatar_url":"https://github.com/LeoBorai.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv\u003e\n  \u003ch1 align=\"center\"\u003elocal-ip-address\u003c/h1\u003e\n  \u003ch4 align=\"center\"\u003e\n    Retrieve system's local IP address and Network Interfaces/Adapters on\n\tLinux, Windows, and macOS (and other BSD-based systems).\n  \u003c/h4\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n  [![Crates.io](https://img.shields.io/crates/v/local-ip-address.svg)](https://crates.io/crates/local-ip-address)\n  [![Documentation](https://docs.rs/local-ip-address/badge.svg)](https://docs.rs/local-ip-address)\n  ![Build](https://github.com/EstebanBorai/local-ip-address/workflows/build/badge.svg)\n  ![Clippy](https://github.com/EstebanBorai/local-ip-address/workflows/clippy/badge.svg)\n  ![Formatter](https://github.com/EstebanBorai/local-ip-address/workflows/fmt/badge.svg)\n\n\u003c/div\u003e\n\n## Usage\n\nGet the local IP address of your system by executing the `local_ip` function:\n\n```rust\nuse local_ip_address::local_ip;\n\nfn main() {\n    let my_local_ip = local_ip().unwrap();\n\n    println!(\"This is my local IP address: {:?}\", my_local_ip);\n}\n```\n\nRetrieve all the available network interfaces from both, the `AF_INET` and\nthe `AF_INET6` family by executing the `list_afinet_netifas` function:\n\n```rust\nuse local_ip_address::list_afinet_netifas;\n\nfn main() {\n    let network_interfaces = list_afinet_netifas().unwrap();\n\n    for (name, ip) in network_interfaces.iter() {\n        println!(\"{}:\\t{:?}\", name, ip);\n    }\n}\n```\n\nUnderlying approach on retrieving network interfaces or the local IP address\nmay differ based on the running operative system.\n\nOS | Approach\n--- | ---\nLinux | Establishes a Netlink socket interchange to retrieve network interfaces\nBSD-based | Uses of `getifaddrs` to retrieve network interfaces\nWindows | Consumes Win32 API's to retrieve the network adapters table\n\n## Operating System Support\n\nCurrent supported platforms include:\n  - Linux (requires at least [v0.1.0](https://github.com/EstebanBorai/local-ip-address/releases/tag/v0.1.0));\n  - macOS (requires at least [v0.1.0](https://github.com/EstebanBorai/local-ip-address/releases/tag/v0.1.0));\n  - Windows (requires at least [v0.3.0](https://github.com/EstebanBorai/local-ip-address/releases/tag/v0.3.0));\n  - Other BSD-based (requires at least [v0.5.0](https://github.com/EstebanBorai/local-ip-address/releases/tag/v0.5.0)); including:\n    - FreeBSD\n    - OpenBSD\n    - NetBSD\n    - DragonFly\n\nPlease note that we only test the BSD implementation of this on macOS and FreeBSD, under the assumption that other BSD-based systems will behave similarly.  If you have any complications using this library on the other BSD-based, please create an [issue](https://github.com/EstebanBorai/local-ip-address/issues).\n\n## Release\n\nIn order to create a release you must push a Git tag as follows\n\n```sh\ngit tag -a \u003cversion\u003e -m \u003cmessage\u003e\n```\n\n**Example**\n\n```sh\ngit tag -a v0.1.0 -m \"First release\"\n```\n\n\u003e Tags must follow semver conventions\n\u003e Tags must be prefixed with a lowercase `v` letter.\n\nThen push tags as follows:\n\n```sh\ngit push origin main --follow-tags\n```\n\n## Contributing\n\nEvery contribution to this project is welcome. Feel free to open a pull request,\nan issue or just by starting this project.\n\n## License\n\nDistributed under the terms of both the MIT license and the Apache License (Version 2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoborai%2Flocal-ip-address","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleoborai%2Flocal-ip-address","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoborai%2Flocal-ip-address/lists"}