Comments (2)
Should be fixed with 6365270
from local-ip-address.
Hi @swithun-liu, thanks for opening this issue.
Im testing local-ip-address
using macOS as well with the same version 0.5.1
.
➜ test-local-ip-address git:(master) ✗ cargo run
Blocking waiting for file lock on build directory
Compiling libc v0.2.140
Compiling thiserror v1.0.39
Compiling local-ip-address v0.5.1
Compiling test-local-ip-address v0.1.0 (/Users/esteban/Desktop/test-local-ip-address)
Finished dev [unoptimized + debuginfo] target(s) in 4.28s
Running `target/debug/test-local-ip-address`
Local IP: 192.168.8.104
Got 12 interfaces
IF: lo0, IP: 127.0.0.1
IF: lo0, IP: ::1
IF: lo0, IP: fe80::1
IF: anpi2, IP: fe80::44dd:3dff:fecf:ce37
IF: anpi1, IP: fe80::44dd:3dff:fecf:ce36
IF: anpi0, IP: fe80::44dd:3dff:fecf:ce35
IF: en0, IP: fe80::ca3:bf2b:686d:3ef6
IF: en0, IP: 192.168.8.104
IF: awdl0, IP: fe80::74a5:cbff:fe51:fda6
IF: llw0, IP: fe80::74a5:cbff:fe51:fda6
IF: utun0, IP: fe80::fc64:5350:be7d:d7dd
IF: utun1, IP: fe80::5b6c:784d:46a1:435e
This is the code:
use local_ip_address::{list_afinet_netifas, local_ip};
fn main() {
match local_ip() {
Ok(ip) => println!("Local IP: {}", ip),
Err(err) => println!("Failed to get local IP: {}", err),
};
match list_afinet_netifas() {
Ok(netifs) => {
println!("Got {} interfaces", netifs.len());
for netif in netifs {
println!("IF: {}, IP: {}", netif.0, netif.1);
}
}
Err(err) => println!("Failed to get list of network interfaces: {}", err),
};
}
It would be nice to have more details on how you are running this in order to reproduce, thanks!
from local-ip-address.
Related Issues (20)
- Compilation error with version local-ip-address-0.5.2 HOT 7
- error: build failed HOT 1
- Unexpected "\0" in the network interface name HOT 3
- New release for windows-sys 0.48 HOT 3
- [linux] ipv6 address reported on wrong (moving) interface alias
- Feature Request: Determining Netmask HOT 1
- thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: LocalIpAddressNotFound', HOT 7
- Why local_ip() return IpAddr? HOT 1
- Cannot compile for Windows MSVC on Linux HOT 5
- Incorrect local IP address got on Windows HOT 4
- Hope to support FreeBSD OS HOT 3
- Use Os Error HOT 5
- Release HOT 6
- Use `std::alloc::alloc` instead of `libc::malloc` HOT 2
- Misleading error message when using non-`en0` interface on macOS HOT 1
- Update `neli` to latest version or change approach
- Determine the primary outbound local IP if multiple present in interfaces HOT 1
- conditional compilation for WebAssembly HOT 1
- MacOS bug on 0.5.0 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from local-ip-address.