-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Sys() for access to fd/handle #62
base: master
Are you sure you want to change the base?
Conversation
How about this? Expose windows Fd
|
I'm saddened that you had a commit but only submitted an issue. If you had made a PR or pointed me to that commit earlier, I'd have either taken that in or worked with you to get that in. Putting that aside, I believe your commit would work, but I'd like this package to have symmetric features for different platforms when possible though. What you have in that commit only exposes the Handle on Windows. Additionally it exports additional types that are unnecessary. |
That's my bad. |
Maybe we don't have to expose FD, there are limited functions on TAP-Windows Adapter V9 driver, we can enhance package by manipulating PlatformSpecificParams. |
Interesting. I don't have much experience with Windows. Could you further explain how DHCP mode would work? I assume one would need to listen for DHCP requests by reading from the device, and respond to them with proper packets following the protocol. Are you suggesting that this would be handled by "TAP-Windows Adapter V9 driver"? Also, I think I'm gonna need some help understanding why setup has to be before the device is brought up. If it's necessary, perhaps we could make bringing up the device optional. Currently on Linux and macOS we don't actually bring up the link at all, and one would have to issue additional calls for those. It feels a bit weird to include networking config (either DHCP or manual) in this package, as everything else is below the link layer. Everything above is handled through reading/writing the device. I guess still depends on how it's gonna look like. On Linux, one can already do that with normal network facilities like netlink. |
In my opinion, there is no real DHCP when work on TUN mode, driver just tell system to apply network in the DHCP way. As for DHCP must be setup before device is brought up, it similar to use control code tap_ioctl_config_tun to setup network, which is static mode. When device was brought up, it couldn't be changed. On Unix platforms, our library just work at the right point, there is no shell command, developers should know what they doing. It's same for Windows, we just control driver, and expose driver's functions. I think I can enhance it at soon, and make a PR. |
Fixes #60
Also abstract
*water.Interface
into aninterface{}
and have windows/unix implement different types. Unfortunately this breaks existing code that assumes a pointer type*water.Interface
, but that should be an easy fix.@chengxuncc let me know if this works for you!