DefGuard / wireguard-rs

Rust library providing unified WireGuard interface to native/kernel and userspace implementations
https://github.com/defguard/defguard/
Other
162 stars 17 forks source link

IPv6 Support #81

Open aw1875 opened 1 week ago

aw1875 commented 1 week ago

I'm not entirely sure if this exists in the project so wanted to reach out to verify. I did notice a few PRs that address IPv6 support but it wasn't super clear if I needed to do something different with my setup to have this working. Currently, I'm trying to mimic bringing up an interface using this config:

[Interface]
Address = 10.0.0.3/32,fd00::4/128
PrivateKey = <private_key>
DNS = 192.168.100.10

[Peer]
PublicKey = <public_key>
PresharedKey = <preshared_key>
Endpoint = <endpoint>
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25

I noticed that the InterfaceConfiguration struct expects only a string for the address field, so trying something like address: "10.0.0.3/32,fd00::4/128".to_string() will not parse correctly. I also tried using the assign_address method on the WireguardInterfaceApi struct but that doesn't seem to work either. It seems like the second approach does add the IP to the interface as expected, but no traffic is routed and it seems like only the IPv4 address is found when checking against my public address. I'd be happy to share a code snippet if needed but I wasn't able to find any really clear documentation on this so figured I'd ask. Thank you in advance!

moubctez commented 1 week ago

Currently, wireguard-rs does not support multiple addresses on a network interface. Possibly, this will be added in the future.

aw1875 commented 1 week ago

Thank you for the response! Is this something that hasn't been implemented due to difficulty or lack of interest/need? If it doesn't seem too complicated I'd be interested in taking a look at it.

teon commented 1 week ago

@aw1875 this library is developed for our main product: https://GitHub.com/defguard/defguard - especially for it's gateway and client, thus most of the features are added here when implementing features in those products.

I agree that's easy, you are warmly welcome to contribute the code.

aw1875 commented 1 week ago

@teon sounds good I'll definitely take a look! Is there any part of the codebase I should be looking to add this logic before I dive into it?