mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
wgengine: fix build on linux/freebsd/openbsd/windows
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
parent
431929c09a
commit
45d687e213
@ -237,7 +237,7 @@ func setFirewall(ifcGUID *windows.GUID) (bool, error) {
|
||||
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
|
||||
guid := tun.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{}
|
||||
var firstGateway4 *net.IP
|
||||
var firstGateway6 *net.IP
|
||||
addresses := make([]*net.IPNet, len(m.Interface.Addresses))
|
||||
for i, addr := range m.Interface.Addresses {
|
||||
addresses := make([]*net.IPNet, len(m.Addresses))
|
||||
for i, addr := range m.Addresses {
|
||||
ipnet := addr.IPNet()
|
||||
addresses[i] = ipnet
|
||||
gateway := ipnet.IP
|
||||
@ -361,7 +361,11 @@ func ConfigureInterface(m *wgcfg.Config, tun *tun.NativeTun, dns []net.IP, dnsDo
|
||||
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 {
|
||||
log.Printf("setdns: %v\n", err)
|
||||
errAcc = err
|
||||
|
@ -7,7 +7,6 @@
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os/exec"
|
||||
|
||||
"github.com/tailscale/wireguard-go/device"
|
||||
@ -154,5 +153,5 @@ func (r *freebsdRouter) Close() error {
|
||||
|
||||
// TODO(mbaillie): these are no-ops for now. They could re-use the Linux funcs
|
||||
// (sans systemd parts), but I note Linux DNS is disabled(?) so leaving for now.
|
||||
func (r *freebsdRouter) replaceResolvConf(_ []net.IP, _ []string) error { return nil }
|
||||
func (r *freebsdRouter) restoreResolvConf() error { return nil }
|
||||
func (r *freebsdRouter) replaceResolvConf(_ []wgcfg.IP, _ []string) error { return nil }
|
||||
func (r *freebsdRouter) restoreResolvConf() error { return nil }
|
||||
|
@ -9,7 +9,6 @@
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@ -177,7 +176,7 @@ func (r *linuxRouter) Close() error {
|
||||
resolvConf = "/etc/resolv.conf"
|
||||
)
|
||||
|
||||
func (r *linuxRouter) replaceResolvConf(servers []net.IP, domains []string) error {
|
||||
func (r *linuxRouter) replaceResolvConf(servers []wgcfg.IP, domains []string) error {
|
||||
if len(servers) == 0 {
|
||||
return r.restoreResolvConf()
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os/exec"
|
||||
|
||||
"github.com/tailscale/wireguard-go/device"
|
||||
@ -175,5 +174,5 @@ func (r *openbsdRouter) Close() error {
|
||||
|
||||
// TODO(mbaillie): these are no-ops for now. They could re-use the Linux funcs
|
||||
// (sans systemd parts), but I note Linux DNS is disabled(?) so leaving for now.
|
||||
func (r *openbsdRouter) replaceResolvConf(_ []net.IP, _ []string) error { return nil }
|
||||
func (r *openbsdRouter) restoreResolvConf() error { return nil }
|
||||
func (r *openbsdRouter) replaceResolvConf(_ []wgcfg.IP, _ []string) error { return nil }
|
||||
func (r *openbsdRouter) restoreResolvConf() error { return nil }
|
||||
|
Loading…
Reference in New Issue
Block a user