wireguard-rs icon indicating copy to clipboard operation
wireguard-rs copied to clipboard

IPv6 Support

Open aw1875 opened this issue 1 year ago • 4 comments

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!

aw1875 avatar Nov 11 '24 20:11 aw1875

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

moubctez avatar Nov 12 '24 13:11 moubctez

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.

aw1875 avatar Nov 12 '24 14:11 aw1875

@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.

teon avatar Nov 12 '24 19:11 teon

@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?

aw1875 avatar Nov 13 '24 05:11 aw1875