Giter VIP home page Giter VIP logo

ifcfg-rs's People

Contributors

marirs avatar postrequest avatar tuxu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ifcfg-rs's Issues

Request: Add IPv6 scope IDs for link-local addresses.

IPv6 link-local addresses are not necessarily globally unique. To use them, you need to also add a "scope ID" when addressing them.

I saw that ifcfg returns SocketAddrs, which contain a scope_id for the V6 variant, but it looks like they're not being populated:

fn main() -> Result<(), Box<dyn Error>> {

    let interfaces = ifcfg::IfCfg::get().expect("ifcfg");

    // for interface in &interfaces {
    //     println!("{:#?}", interface);
    // }

    for interface in &interfaces {
        for address in &interface.addresses {
            if let Some(ref sock_addr) = address.address {
                if let SocketAddr::V6(v6_sock_addr) = sock_addr {
                    println!("scope_id: {} for {}", v6_sock_addr.scope_id(), v6_sock_addr)
                }
                
            }
        }
    }

    Ok(())
}

Results: All of theIPv6 addresses across multiple interfaces have scope_id 0.


I'm just trying to write my first IPv6 networking code, so I don't know how to actually get the scope ID. (Though I was playing around with Deno's new Deno.networkInterfaces() API yesterday and noticed that the do provide that. Maybe there's an example to follow somewhere in their code?)

also: Thanks for writing this library! ๐Ÿ˜„

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.