Closed MagicRB closed 3 years ago
After studying the source code a bit, I think we should create a trait, something like WireguardInterface, and then implement all the different types (2 currently, 3 if you count the android way), as for interface discovery, I think we should implicitly try all methods, and list the interfaces with the particular type of said interface. Or we could keep an internal mapping of interface and type, and dispatch the settings to the proper implementation, or we could ask the user, with an enum or something. Or we could have it both ways, a lower level trait based API, and a higher level, try everything and see what works API
Do you want to also include transparent support for userspace implementations?
Yes definitely.
If yes, then I could try to figure it out and submit a PR, but no promises
I'll take a first stab at this in the next few days and give an update Tuesday 5/26.
Thanks for the suggestions on approach. I do think some kind of WireguardPlatformInterface
trait makes sense.
:+1: If you need any help, or opinion or something, I'm your man.
Quick update:
An initial version that just reads from Unix userspace implementations is on the userspace-implementation
branch. It's not ready for public use and I wouldn't look at it yet. A few things still need to be done.
.unwrap()
/panic!
rather than proper error propagation.SocketAddrV6
doesn't handle this.I'd estimate that this issue is about another 2 weeks away from being closed.
Or we could have it both ways, a lower level trait based API, and a higher level, try everything and see what works API
Just as a heads up: I am leaning towards a less auto-magical approach to start where users of this library will have to decide whether they want to talk to a userspace implementation or to the Linux kernel through netlink. Later on it might be useful to abstract this and choose the right communication channel given a non-conflicting interface name.
Hello! I would love to see this implemented; so I wanted to ask whether you are going to have time and desire to continue this, and if not, are you willing to accept/discuss a PR continuing or reimplementing your efforts on this?
@QuentinI Sorry for the delays here. There's a work in progress PR from a few months ago. It'll be my top priority today and tomorrow to get it released.
@QuentinI @MagicRB The userspace-implementation
branch has a beta that can be used. I'm going to finish documentation and additional testing later this week. (Although the weekend is more likely since that's when I'll be free again.)
In lieu of better documentation, the example I was working off of is probably the best place to start if anyone is interested in beta testing. https://github.com/gluxon/wireguard-uapi-rs/blob/userspace-implementation/examples/userspace.rs
The API on this branch may change in the future. Happy for any kind of feedback.
So it is available in the main branch now?
Yup! The API could be better merged with the Linux-specific client though.
Do you want to also include transparent support for userspace implementations? If yes, then I could try to figure it out and submit a PR, but no promises
EDIT: getting stuff from userspace should be easy, there are actual docs on this