-
Notifications
You must be signed in to change notification settings - Fork 86
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
Force to use specific implementation #28
Comments
What's the use case for doing so? Both implementations should have feature parity. There's nothing stopping you from filtering on Device.Type in your own code, but I wouldn't recommend it. I'd really prefer not to export any more code though. |
For my specific use case, I need the kernel module implementation. And what happens is this:
|
Again, please share what your actual use case is, and why only operating on the kernel module implementation is appropriate. What is lacking in the userspace implementation? Why would you not want full parity for users who run different WireGuard implementations, if the interface for configuring each of these implementations can be identical and transparent in your code? The
This sounds like "XY Problem" (http://xyproblem.info/) territory to me.
The documentation for ConfigureDevice (https://godoc.org/github.com/mdlayher/wireguardctrl#Client.ConfigureDevice) mentions:
You can inspect the result of the call to determine this in your own code.
The package searches for all available implementations for the platform you're using, and will not report an error for this reason alone.
This type of logging belongs in your application code, not in this library. I recommend enumerating all valid WireGuard devices with https://godoc.org/github.com/mdlayher/wireguardctrl#Client.Devices, and then configuring known good devices from that list. That is, unless you already know the correct name of the device ahead of time. Edit: it could be worth exposing more information via an Error type (see: #13) but that hasn't been implemented yet. At the moment though, you'll only see "doesn't exist" in your own code if all of the registered implementations do not recognize a device: https://github.com/mdlayher/wireguardctrl/blob/master/client.go#L122. |
Thank you for taking the time to explain. I misunderstood who is creating the wireguard interface; naively I assume that is the responsibility of this library, not me doing my end use case: Have go process managing wireguard networking lifecycle. Like wg-quick, but in Go and getting configuration from the external system. Since it needs to be cross arch (( arm7 & amd64 in my case )) I'm trying to avoid having external dependencies (iproute2, mostly since this is going to run in a container and building complex arm containers require arm build machine and other complexities I'd rather avoid) Right now I've managed to create basic initial implementation in the wg-operator. Now I'm seeing how to replace calles to
Most of my problems stem from unfamiliarity with Netlink, and using wg-quick mostly, not wg tool. I'll try using github.com/vishvananda/netlink you mentioned to replace ip our of the dependency tree. (( Though wished they had more examples in their source )) |
Thanks for clarifying! I just wanted to make sure that I wasn't missing some feature or critical piece of information. This package should still be useful for you once you've done the prerequisite link configuration via route netlink like you've mentioned above. Please feel free to reach out if you run into any trouble. I also should have mentioned this sooner, but there are quite a few folks in the #networking channel in Gophers Slack that ought to be able to provide some guidance on these sorts of things as well. Please do join us if that interests you! Thanks for your time and for the report. |
Hi, I am also interested in this. I am running freebsd which is not a supported device type, and thinking if I can force a different device type, it might work for my needs (just need to parse the interface for peers). |
Right now kernel and userspace implementation are behind the
/internal
subpackage and inaccessible to foreign packages. I'd like to force my code to use only kernel implementation and fail if that's not possible.The simplest way to do it is making those implementations reachable by other packages, e.g. renaming
internal
topkg
or something like thatThe text was updated successfully, but these errors were encountered: