|
|
@ -237,7 +237,7 @@ func setFirewall(ifcGUID *windows.GUID) (bool, error) {
|
|
|
|
return false, nil
|
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func ConfigureInterface(m *wgcfg.Config, tun *tun.NativeTun, dns []net.IP, dnsDomains []string) error {
|
|
|
|
func ConfigureInterface(m *wgcfg.Config, tun *tun.NativeTun, dns []wgcfg.IP, dnsDomains []string) error {
|
|
|
|
const mtu = 0
|
|
|
|
const mtu = 0
|
|
|
|
guid := tun.GUID()
|
|
|
|
guid := tun.GUID()
|
|
|
|
log.Printf("wintun GUID is %v\n", guid)
|
|
|
|
log.Printf("wintun GUID is %v\n", guid)
|
|
|
@ -268,8 +268,8 @@ func ConfigureInterface(m *wgcfg.Config, tun *tun.NativeTun, dns []net.IP, dnsDo
|
|
|
|
routes := []winipcfg.RouteData{}
|
|
|
|
routes := []winipcfg.RouteData{}
|
|
|
|
var firstGateway4 *net.IP
|
|
|
|
var firstGateway4 *net.IP
|
|
|
|
var firstGateway6 *net.IP
|
|
|
|
var firstGateway6 *net.IP
|
|
|
|
addresses := make([]*net.IPNet, len(m.Interface.Addresses))
|
|
|
|
addresses := make([]*net.IPNet, len(m.Addresses))
|
|
|
|
for i, addr := range m.Interface.Addresses {
|
|
|
|
for i, addr := range m.Addresses {
|
|
|
|
ipnet := addr.IPNet()
|
|
|
|
ipnet := addr.IPNet()
|
|
|
|
addresses[i] = ipnet
|
|
|
|
addresses[i] = ipnet
|
|
|
|
gateway := ipnet.IP
|
|
|
|
gateway := ipnet.IP
|
|
|
@ -361,7 +361,11 @@ func ConfigureInterface(m *wgcfg.Config, tun *tun.NativeTun, dns []net.IP, dnsDo
|
|
|
|
errAcc = err
|
|
|
|
errAcc = err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
err = iface.SetDNS(dns)
|
|
|
|
var dnsIPs []net.IP
|
|
|
|
|
|
|
|
for _, ip := range dns {
|
|
|
|
|
|
|
|
dnsIPs = append(dnsIPs, ip.IP())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
err = iface.SetDNS(dnsIPs)
|
|
|
|
if err != nil && errAcc == nil {
|
|
|
|
if err != nil && errAcc == nil {
|
|
|
|
log.Printf("setdns: %v\n", err)
|
|
|
|
log.Printf("setdns: %v\n", err)
|
|
|
|
errAcc = err
|
|
|
|
errAcc = err
|
|
|
|