naggie / dsnet

FAST command to manage a centralised wireguard VPN. Think wg-quick but quicker: key generation + address allocation.
https://calbryant.uk/blog/how-to-set-up-a-wireguard-vpn-in-minutes-with-dsnet/
MIT License
673 stars 33 forks source link

Use hostname instead of static IP/IPv6 in generated peer config #27

Closed SoerenBusse closed 3 years ago

SoerenBusse commented 3 years ago

Hey there,

the generated peer configuration only contains the external IPv4 address and not the external IPv6 address of the server. Some ISPs may have a better connectivity using IPv6 than IPv4, because of Carrier Grade NAT.

I think the best solution would be to add a configuration option "UseDomain", which uses the domain specified in the "Domain" configuration option as endpoint in the peer configuration. This way the client will automatically decide if it's using IPv6 or IPv4.

Keep up the great work!

naggie commented 3 years ago

Actually that's a good idea. I was a little annoyed that it's not possible to specify both in a wq-quick client/peer config.

Perhaps if an external IPv4+IPv6 is not specified, dsnet could use the Domain. This follows an existing precedent in the code -- the external IPv4 is used if it exists, else the IPv6 if it does not exist. The third fallback could be the domain.

Though it should probably be ExternalDomain instead of Domain as the internal domain might be different. There's also a convention that things are assumed to be internal unless they have an External prefix.

Thanks for the idea, I'll implement it as I described in the next release.

naggie commented 3 years ago

Implemented in 0.4, with ExternalHost which can be set to a domain. If set, it will be used instead of ExternalIP and ExternalIP6