fengyc / natpmp

NAT-PMP library in rust
MIT License
29 stars 7 forks source link

Replace the C `get_default_gateway` implementation with netdev #6

Open sgued opened 5 months ago

sgued commented 5 months ago

https://crates.io/crates/netdev is a crate that can allow you to get the default gateway and is widely used (it was previously named default-net with almost 70k downloads/montth

It has a bit of unsafe but does not link against C code. I find it preferable to using the embeded C code that never got updated.

If compile adding dependencies are an issue, i could also be possible to make the C implementation of get_default_gateway optional.

That would allow my project to get rid of the unupdated c dependency I don't like.

quietvoid commented 3 weeks ago

@sgued Seeing this issue as I was about to fork your natpmp-ng. For my usecase I don't need get_default_gateway, so if you made it optional in your fork I could use it.

I'm just going to remove it for now.

sgued commented 3 weeks ago

Feel free to open a PR on natpmp-ng that makes this optional. I will merge it. https://gitlab.com/sgued/natpmp-ng/-/merge_requests

quietvoid commented 3 weeks ago

I'm not sure how complicated it would be to make optional, though. I'll have to look into it.