Giter VIP home page Giter VIP logo

Comments (2)

cgzones avatar cgzones commented on June 5, 2024 1

Should be fixed with 6365270

from local-ip-address.

EstebanBorai avatar EstebanBorai commented on June 5, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.