WireGuard / wgctrl-go

Package wgctrl enables control of WireGuard interfaces on multiple platforms.
https://godoc.org/golang.zx2c4.com/wireguard/wgctrl
MIT License
727 stars 85 forks source link

Missing DNS? #127

Closed GoodiesHQ closed 1 year ago

GoodiesHQ commented 1 year ago

There is no member entry for DNS in the Config type in the wgtypes module and consequently no way of dealing with nameservers.

PLEASE note that the DNS field can contain something other than IP addresses, so a type of []net.IP is not desirable. It can also contain search domains which is very important.

mdlayher commented 1 year ago

DNS configuration is handled by your operating system (similar to IP address assignment) and thus out of scope for wgctrl-go. Apologies, closing.

GoodiesHQ commented 1 year ago

I'm sorry, I'm not sure what you mean. There is a field in the INI configuration of WireGuard called "DNS" which contains two types of values:

This is pertaining to the structure that defines the client configuration.

[Interface]
PrivateKey = ABCDEFGHIJKLMNOPQRSTUVWXYZ=
Address = 10.255.255.4/24
DNS = 192.168.1.250, 1.1.1.1, internal.home.com

image

mdlayher commented 1 year ago

wg-quick handles IP and DNS assignment in a special way per operating system. They are not configured at all via the interfaces that wgctrl-go provides, and you'd have to implement them separately for each operating system you want your program to work with.