net/dns: remove ManagerConfig, pass relevant args directly.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2021-04-01 23:26:52 -07:00
parent 0ca04f1e01
commit fcfc0d3a08
16 changed files with 42 additions and 70 deletions
+6 -12
View File
@@ -37,17 +37,15 @@ type Manager struct {
impl managerImpl
config Config
mconfig ManagerConfig
config Config
}
// NewManagers created a new manager from the given config.
func NewManager(mconfig ManagerConfig) *Manager {
mconfig.Logf = logger.WithPrefix(mconfig.Logf, "dns: ")
func NewManager(logf logger.Logf, interfaceName string) *Manager {
logf = logger.WithPrefix(logf, "dns: ")
m := &Manager{
logf: mconfig.Logf,
impl: newManager(mconfig),
mconfig: mconfig,
logf: logf,
impl: newManager(logf, interfaceName),
}
m.logf("using %T", m.impl)
@@ -91,11 +89,7 @@ func (m *Manager) Down() error {
// in case the Tailscale daemon terminated without closing the router.
// No other state needs to be instantiated before this runs.
func Cleanup(logf logger.Logf, interfaceName string) {
mconfig := ManagerConfig{
Logf: logf,
InterfaceName: interfaceName,
}
dns := NewManager(mconfig)
dns := NewManager(logf, interfaceName)
if err := dns.Down(); err != nil {
logf("dns down: %v", err)
}