wgengine: update for wgcfg changes

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
David Crawshaw 2020-02-19 10:32:25 -05:00
parent c4f6f622f0
commit d0f697ee07
3 changed files with 6 additions and 7 deletions

2
go.mod
View File

@ -16,7 +16,7 @@ require (
github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3
github.com/tailscale/hujson v0.0.0-20190930033718-5098e564d9b3
github.com/tailscale/winipcfg-go v0.0.0-20200213045944-185b07f8233f
github.com/tailscale/wireguard-go v0.0.0-20200213180345-a7c4b7719b1d
github.com/tailscale/wireguard-go v0.0.0-20200219153225-c9c88282e81d
golang.org/x/crypto v0.0.0-20200210222208-86ce3cb69678
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200217220822-9197077df867

View File

@ -237,15 +237,15 @@ func (e *userspaceEngine) Reconfig(cfg *wgcfg.Config, dnsDomains []string) error
return err
}
if err := e.magicConn.SetPrivateKey(cfg.Interface.PrivateKey); err != nil {
if err := e.magicConn.SetPrivateKey(cfg.PrivateKey); err != nil {
e.logf("magicsock: %v\n", err)
}
// TODO(apenwarr): only handling the first local address.
// Currently we never use more than one anyway.
var cidr wgcfg.CIDR
if len(cfg.Interface.Addresses) > 0 {
cidr = cfg.Interface.Addresses[0]
if len(cfg.Addresses) > 0 {
cidr = cfg.Addresses[0]
// TODO(apenwarr): this shouldn't be hardcoded in the client
cidr.Mask = 10 // route the whole cgnat range
}
@ -253,7 +253,7 @@ func (e *userspaceEngine) Reconfig(cfg *wgcfg.Config, dnsDomains []string) error
rs := RouteSettings{
LocalAddr: cidr,
Cfg: cfg,
DNS: cfg.Interface.Dns,
DNS: cfg.DNS,
DNSDomains: dnsDomains,
}
e.logf("Reconfiguring router. la=%v dns=%v dom=%v\n",

View File

@ -6,7 +6,6 @@
import (
"fmt"
"net"
"time"
"github.com/tailscale/wireguard-go/device"
@ -46,7 +45,7 @@ type Status struct {
// itself, like DNS stuff.
type RouteSettings struct {
LocalAddr wgcfg.CIDR // TODO: why is this here? how does it differ from wgcfg.Config's info?
DNS []net.IP
DNS []wgcfg.IP
DNSDomains []string
Cfg *wgcfg.Config
}