2020-08-01 04:27:09 +08:00
|
|
|
// 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
|
|
|
|
|
2021-04-02 14:26:52 +08:00
|
|
|
import "tailscale.com/types/logger"
|
|
|
|
|
|
|
|
func newManager(logf logger.Logf, interfaceName string) managerImpl {
|
2020-08-01 04:27:09 +08:00
|
|
|
switch {
|
2021-04-02 13:54:40 +08:00
|
|
|
case isResolvedActive():
|
2021-04-02 14:26:52 +08:00
|
|
|
return newResolvedManager()
|
2020-08-01 04:27:09 +08:00
|
|
|
case isNMActive():
|
2021-04-02 14:26:52 +08:00
|
|
|
return newNMManager(interfaceName)
|
2020-08-01 04:27:09 +08:00
|
|
|
case isResolvconfActive():
|
2021-04-02 14:26:52 +08:00
|
|
|
return newResolvconfManager(logf)
|
2020-08-01 04:27:09 +08:00
|
|
|
default:
|
2021-04-02 14:26:52 +08:00
|
|
|
return newDirectManager()
|
2020-08-01 04:27:09 +08:00
|
|
|
}
|
|
|
|
}
|