2020-07-31 20:27:09 +00: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 06:26:52 +00:00
|
|
|
import "tailscale.com/types/logger"
|
|
|
|
|
2021-04-12 22:51:37 +00:00
|
|
|
func NewOSConfigurator(logf logger.Logf, interfaceName string) (OSConfigurator, error) {
|
2020-07-31 20:27:09 +00:00
|
|
|
switch {
|
2021-04-12 01:12:24 +00:00
|
|
|
case isResolvedActive():
|
2021-04-12 03:52:05 +00:00
|
|
|
return newResolvedManager(logf)
|
2021-04-11 10:37:14 +00:00
|
|
|
case isNMActive():
|
|
|
|
return newNMManager(interfaceName)
|
2020-07-31 20:27:09 +00:00
|
|
|
case isResolvconfActive():
|
2021-04-11 06:31:00 +00:00
|
|
|
return newResolvconfManager(logf)
|
2020-07-31 20:27:09 +00:00
|
|
|
default:
|
2021-04-02 06:26:52 +00:00
|
|
|
return newDirectManager()
|
2020-07-31 20:27:09 +00:00
|
|
|
}
|
|
|
|
}
|