[PATCH] Periodically update endpoint IP in windows app (dynamic DNS)

Tobias Tangemann tobias at tangemann.org
Wed Dec 8 14:26:27 UTC 2021


I know of the reresolvedns script for Linux but there is no nice
solution for the other platforms. I think this is a feature many users
would benefit from if directly integrated into the wireguard apps
(including me).

I implemented a new config option which periodically updates the
endpoint IP in the same way the reresolvedns script does it, but
inside the windows app.
A go routine gets created inside the tunnel manager for each peer
which has the option set. if the option is not set for any peer there
is no change in behavior.
Kudos to the well-crafted build system and awesome build.bat for
windows, this made it very easy to get started.
I think there are some points left open:
- The name of the option cannot easily be changed later as it would
require additional migration code (I’m not tied to the name “Update
endpoint IP”).
- Is the amount of logging this feature currently creates ok?
- I haven’t updated the localization to not blow this patch up to
much, this can be done after settling on a name for the option.
- Most of the code is ui related and pretty straight forward. I
implemented the PeerUpdateEndpointConfiguration based on my analysis
of the wireguard-tools set.c source and it seems to work but I think
someone with a deeper understanding of the driver interface should
check that. During my testing the feature seems to work fine with 1
peer, maybe someone can test this in a more complicated setup.
- I think this will not work if all traffic is routed through the VPN
including DNS therefor once the IP of the peer changes, the link
breaks and updating the endpoint IP will not work. I’m not sure if
there is a way to fix this.
- I’m not sure on the position of config options only being supported
on specific clients. I think this is already the case but I don’t have
a good overview.
It would be nice to also have this feature in the other clients like
iOS/macOS and android. I think it is not necessary to update the Linux
tool. If desired I think it could be included in wg-quick.
I’m unsure how to tackle this feature for macOS/iOS, my assumption is
that it would need to be included in the PacketTunnelProvider and be
part of the NetworkExtension or maybe in the userland driver
Sadly, due to all the apple signing and provisioning hoops you have to
jump through I was not able to get even the macOS app to build using
my free developer account.

I hope this patch can be reviewed and upstreamed.

The patch can also be found here:

Best regards - Tobias Tangemann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tunnel-conf-ui-periodic-update-of-endpoint-ip.patch
Type: application/octet-stream
Size: 12617 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/wireguard/attachments/20211208/9d57e6e8/attachment.obj>

More information about the WireGuard mailing list