for _, address := range addresses {
a, err := netip.ParseAddr(address)
if err != nil {
conf.Interface.DNSSearch = append(conf.Interface.DNSSearch, address)
} else {
conf.Interface.DNS = append(conf.Interface.DNS, a)
}
Additionally maybe to allow running some command in posupt etc would also be nice to handle:
case "preup":
conf.Interface.PreUp = val
case "postup":
conf.Interface.PostUp = val
case "predown":
conf.Interface.PreDown = val
case "postdown":
conf.Interface.PostDown = val
case "table":
Override DNS for Specific Domains
If you use WireGuard to connect to an internal network, and that network includes a custom DNS resolver which resolves an internal domain name for hosts on that network, you can configure systemd-resolved to use that resolver for that particular domain name.
For example, if the resolver’s IP address is 10.0.0.2, and the domain name is internal.example.com, you might normally use the following DNS settting:
DNS = 10.0.0.2, internal.example.com
With systemd-resolved, however, instead of using the DNS setting, add the following PostUp command to the [Interface] section of your WireGuard config file:
PostUp = resolvectl dns %i 10.0.0.2; resolvectl domain %i ~internal.example.com
Hi, currently the parsing of the config file is missing the case, if there is a searchdomain added as string in DNS, and that can't be parsed as IP.
https://github.com/damob-byun/WireGuardNTSharp/blob/main/WireGuardNT-PInvoke/Adapter.cs#L185
For reference see parsing in the go client: https://git.zx2c4.com/wireguard-windows/tree/conf/parser.go#n231
Additionally maybe to allow running some command in posupt etc would also be nice to handle:
Override DNS for Specific Domains
If you use WireGuard to connect to an internal network, and that network includes a custom DNS resolver which resolves an internal domain name for hosts on that network, you can configure systemd-resolved to use that resolver for that particular domain name.
For example, if the resolver’s IP address is 10.0.0.2, and the domain name is internal.example.com, you might normally use the following DNS settting:
DNS = 10.0.0.2, internal.example.com
With systemd-resolved, however, instead of using the DNS setting, add the following PostUp command to the [Interface] section of your WireGuard config file:
PostUp = resolvectl dns %i 10.0.0.2; resolvectl domain %i ~internal.example.com