wgengine/router: rename config.Settings to config.Config, make pointer.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2020-05-12 07:08:52 +00:00
committed by Dave Anderson
parent 72cae5504c
commit 9ccbcda612
13 changed files with 78 additions and 54 deletions
+15 -6
View File
@@ -20,10 +20,10 @@ type Router interface {
// Up brings the router up.
Up() error
// Set updates the OS network stack with new settings. It may be
// called multiple times with identical Settings, which the
// Set updates the OS network stack with a new Config. It may be
// called multiple times with identical Configs, which the
// implementation should handle gracefully.
Set(Settings) error
Set(*Config) error
// Close closes the router.
Close() error
@@ -35,9 +35,9 @@ func New(logf logger.Logf, wgdev *device.Device, tundev tun.Device) (Router, err
return newUserspaceRouter(logf, wgdev, tundev)
}
// Settings is the subset of Tailscale configuration that is relevant
// to the OS's network stack.
type Settings struct {
// Config is the subset of Tailscale configuration that is relevant to
// the OS's network stack.
type Config struct {
LocalAddrs []netaddr.IPPrefix
DNS []netaddr.IP
DNSDomains []string
@@ -45,3 +45,12 @@ type Settings struct {
SubnetRoutes []netaddr.IPPrefix // subnets being advertised to other Tailscale nodes
NoSNAT bool // don't SNAT traffic to local subnets
}
// shutdownConfig is a routing configuration that removes all router
// state from the OS. It's the config used when callers pass in a nil
// Config.
var shutdownConfig = Config{
// TODO(danderson): set more things in here to disable all
// firewall rules and routing overrides when nil.
NoSNAT: true,
}