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>
This commit is contained in:
parent
cf361bb9b1
commit
95470c3448
|
@ -63,7 +63,4 @@ type ManagerConfig struct {
|
||||||
Logf logger.Logf
|
Logf logger.Logf
|
||||||
// InterfaceName is the name of the interface with which DNS settings should be associated.
|
// InterfaceName is the name of the interface with which DNS settings should be associated.
|
||||||
InterfaceName string
|
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{
|
mconfig := ManagerConfig{
|
||||||
Logf: logf,
|
Logf: logf,
|
||||||
InterfaceName: interfaceName,
|
InterfaceName: interfaceName,
|
||||||
Cleanup: true,
|
|
||||||
}
|
}
|
||||||
dns := NewManager(mconfig)
|
dns := NewManager(mconfig)
|
||||||
if err := dns.Down(); err != nil {
|
if err := dns.Down(); err != nil {
|
||||||
|
|
|
@ -7,17 +7,9 @@ package dns
|
||||||
func newManager(mconfig ManagerConfig) managerImpl {
|
func newManager(mconfig ManagerConfig) managerImpl {
|
||||||
switch {
|
switch {
|
||||||
case isResolvedActive():
|
case isResolvedActive():
|
||||||
if mconfig.Cleanup {
|
return newResolvedManager(mconfig)
|
||||||
return newNoopManager(mconfig)
|
|
||||||
} else {
|
|
||||||
return newResolvedManager(mconfig)
|
|
||||||
}
|
|
||||||
case isNMActive():
|
case isNMActive():
|
||||||
if mconfig.Cleanup {
|
return newNMManager(mconfig)
|
||||||
return newNoopManager(mconfig)
|
|
||||||
} else {
|
|
||||||
return newNMManager(mconfig)
|
|
||||||
}
|
|
||||||
case isResolvconfActive():
|
case isResolvconfActive():
|
||||||
return newResolvconfManager(mconfig)
|
return newResolvconfManager(mconfig)
|
||||||
default:
|
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…
Reference in New Issue