Git Product home page Git Product logo

ipconfig's People

Contributors

ancwrd1 avatar anderender avatar attila-lin avatar bdbai avatar conblem avatar hoodad avatar jesdazrez avatar jfro avatar kpcyrd avatar liranringel avatar paolobarbolini avatar rotty avatar tynril avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ipconfig's Issues

unix support

Hi,

any reason not to have unix support as well?
Would be nice to have one cross platform crate instead of multiple

New release 0.2.1?

It would be nice to have the ipv6_if_index() feature (PR #30) in an official release.

On get_search_list returns extra first result

get_search_list is returning

["lan ad.x.com other.com", "lan", "ad.x.com", "other.com"]

Looking at adaptor properties the first entry doesn't appear but the other three do. The spaces in the first entry cause issues upstream in trust_dns_proto.

This is on Windows 10.

Build fails on x86_64 -msvc targets because clang.dll cannot be found

I couldn't get ipconfig to build using cargo 0.23.0-nightly because it could not find clang.dll:

thread 'main' panicked at 'Unable to find libclang: "couldn't find any of ['clang.dll', 'libclang.dll'], set the LIBCLANG_PATH environment variable to a path where one of these files can be found (skipped: [])"', src\libcore\result.rs:906:4
note: Run with RUST_BACKTRACE=1 for a backtrace.

IMO, it would be much better to add the necessary Windows API bindings to winapi and/or at least generate them once statically using bindgen, instead of running bindgen as part of build.rs. That way, people using the library wouldn't have to build all of bindgen's dependencies and they wouldn't have to run into issues like this one.

[Question] How to know which interface is the one used?

Hi,

thank you very much for this useful crate :D

I'm trying to get the local ip address of the computer and as I have VirtualBox installed, I have multiple interfaces.

How can I distinguish the real one from the virtual one? Both are EthernetCsmacd.

I'd like to create a server which as the IP address of my computer :)

Panic in get_search_list when the SearchList registry key is missing

On two different computers running Windows 10 version 1803 (OS build 17134.191), I encountered the following panic while running cargo test:

thread 'no_error' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Io(Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }), State { next_error: None, backtrace: Some(stack backtrace:
   0:     0x7ff743abc920 - backtrace::backtrace::trace<closure>
                        at C:\Users\tyn\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.9\src\backtrace\mod.rs:42
   1:     0x7ff743ab3f94 - backtrace::capture::Backtrace::new_unresolved
                        at C:\Users\tyn\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.9\src\capture.rs:88
   2:     0x7ff743ab3efd - backtrace::capture::Backtrace::new
                        at C:\Users\tyn\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.9\src\capture.rs:64
   3:     0x7ff743ab1ccc - error_chain::make_backtrace
                        at C:\Users\tyn\.cargo\registry\src\github.com-1ecc6299db9ec823\error-chain-0.8.1\src\lib.rs:413
   4:     0x7ff743ab1d8a - error_chain::{{impl}}::default
                        at C:\Users\tyn\.cargo\registry\src\github.com-1ecc6299db9ec823\error-chain-0.8.1\src\lib.rs:494
   5:     0x7ff743a8fdb8 - ipconfig::error::Error::from_kind
                        at E:\dev\ipconfig\<error_chain_processed macros>:49
   6:     0x7ff743a8fee3 - ipconfig::error::{{impl}}::from
                        at E:\dev\ipconfig\<error_chain_processed macros>:77
   7:     0x7ff743a9580a - ipconfig::computer::get_search_list
                        at E:\dev\ipconfig\src\computer.rs:52
   8:     0x7ff743a42fe3 - test::no_error
                        at E:\dev\ipconfig\tests\test.rs:7
   9:     0x7ff743a4244e - test::__test::TESTS::{{closure}}
                        at E:\dev\ipconfig\tests\test.rs:5
  10:     0x7ff743a419fb - core::ops::function::FnOnce::call_once<closure,()>
                        at C:\projects\rust\src\libcore\ops\function.rs:223
  11:     0x7ff743a4569e - alloc::boxed::{{impl}}::call_box<(),closure>
                        at C:\projects\rust\src\liballoc\boxed.rs:643
  12:     0x7ff743ae7fe2 - panic_unwind::__rust_maybe_catch_panic
                        at C:\projects\rust\src\libpanic_unwind\lib.rs:105
  13:     0x7ff743a5097b - std::sys_common::backtrace::__rust_begin_short_backtrace<closure,()>
                        at C:\projects\rust\src\libstd\sys_common\backtrace.rs:136
  14:     0x7ff743a5186e - std::panicking::try::do_call<std::panic::AssertUnwindSafe<closure>,()>
                        at C:\projects\rust\src\libstd\panicking.rs:312
  15:     0x7ff743ae7fe2 - panic_unwind::__rust_maybe_catch_panic
                        at C:\projects\rust\src\libpanic_unwind\lib.rs:105
  16:     0x7ff743a58a15 - alloc::boxed::{{impl}}::call_box<(),closure>
                        at C:\projects\rust\src\liballoc\boxed.rs:642
  17:     0x7ff743ad04a2 - std::sys_common::thread::start_thread
                        at C:\projects\rust\src\libstd\sys_common\thread.rs:25
  18:     0x7ff743ad29e9 - std::sys::windows::thread::{{impl}}::new::thread_start
                        at C:\projects\rust\src\libstd\sys\windows\thread.rs:58
  19:     0x7ff8975e3034 - BaseThreadInitThunk) })', libcore\result.rs:983:5

On both computers, I do not have a SearchList subkey in SYSTEM\CurrentControlSet\Services\Tcpip\Parameters. I assume that it can be a valid state, since I didn't remove it manually.

I can work around this issue by creating an empty SearchList subkey at that location, but it's obviously not great.

Feature Request: Connection Profile

Hey there,
I'm interested in getting the Connection Profile of an Adapter. It's in a different section of the windows api sadly. It's the thing that says if a network is "private" or "public".

If I figure out how to do this FFI stuff, would you take a PR?

get-netconnectionprofile

Name                     : Network
InterfaceAlias           : Ethernet
InterfaceIndex           : 7
NetworkCategory          : Private
DomainAuthenticationKind : None
IPv4Connectivity         : Internet
IPv6Connectivity         : Internet

https://learn.microsoft.com/en-us/windows/win32/api/netlistmgr/nf-netlistmgr-inetwork-getcategory

misaligned pointer dereference

I'm seeing this in our GitHub Actions failing. Tests worked with Rust 1.69.0 using stable-i686-pc-windows-msvc toolchain, but seems to fail with Rust 1.70.0 with same toolchain.

thread '<redacted>' panicked at 'panic in a function that cannot unwind', library\core\src\panicking.rs:126:5
thread '<redacted>' panicked at 'misaligned pointer dereference: address must be a multiple of 0x8 but is 0x189f604', C:\Users\runneradmin\.cargo\registry\src\index.crates.io-1cd66030c949c28d\ipconfig-0.3.1\src\adapter.rs:293:23

Affected function:

ipconfig/src/adapter.rs

Lines 289 to 301 in f6d918f

unsafe fn get_gateways(mut gateway_ptr: PIP_ADAPTER_GATEWAY_ADDRESS_LH) -> Result<Vec<IpAddr>> {
let mut gateways = vec![];
while !gateway_ptr.is_null() {
let gateway = &*gateway_ptr;
let ipaddr = socket_address_to_ipaddr(&gateway.Address);
gateways.push(ipaddr);
gateway_ptr = gateway.Next;
}
Ok(gateways)
}

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.