net/dns: remove Cleanup manager parameter.

It's only use to skip some optional initialization during cleanup,
but that work is very minor anyway, and about to change drastically.

Signed-off-by: David Anderson <danderson@tailscale.com>
pull/1644/head
David Anderson 3 years ago
parent cf361bb9b1
commit 95470c3448

@ -63,7 +63,4 @@ type ManagerConfig struct {
Logf logger.Logf
// InterfaceName is the name of the interface with which DNS settings should be associated.
InterfaceName string
// Cleanup indicates that the manager is created for cleanup only.
// A no-op manager will be instantiated if the system needs no cleanup.
Cleanup bool
}

@ -94,7 +94,6 @@ func Cleanup(logf logger.Logf, interfaceName string) {
mconfig := ManagerConfig{
Logf: logf,
InterfaceName: interfaceName,
Cleanup: true,
}
dns := NewManager(mconfig)
if err := dns.Down(); err != nil {

@ -7,17 +7,9 @@ package dns
func newManager(mconfig ManagerConfig) managerImpl {
switch {
case isResolvedActive():
if mconfig.Cleanup {
return newNoopManager(mconfig)
} else {
return newResolvedManager(mconfig)
}
return newResolvedManager(mconfig)
case isNMActive():
if mconfig.Cleanup {
return newNoopManager(mconfig)
} else {
return newNMManager(mconfig)
}
return newNMManager(mconfig)
case isResolvconfActive():
return newResolvconfManager(mconfig)
default:

@ -1,17 +0,0 @@
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package dns
type noopManager struct{}
// Up implements managerImpl.
func (m noopManager) Up(Config) error { return nil }
// Down implements managerImpl.
func (m noopManager) Down() error { return nil }
func newNoopManager(mconfig ManagerConfig) managerImpl {
return noopManager{}
}
Loading…
Cancel
Save