mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-26 03:25:35 +00:00
a5da4ed981
This adds "//go:build" lines and tidies up existing "// +build" lines. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
31 lines
941 B
Go
31 lines
941 B
Go
// Copyright (c) 2021 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.
|
|
|
|
//go:build linux || freebsd || openbsd
|
|
// +build linux freebsd openbsd
|
|
|
|
package dns
|
|
|
|
import (
|
|
"os/exec"
|
|
|
|
"tailscale.com/types/logger"
|
|
)
|
|
|
|
func newResolvconfManager(logf logger.Logf) (OSConfigurator, error) {
|
|
_, err := exec.Command("resolvconf", "--version").CombinedOutput()
|
|
if err != nil {
|
|
if exitErr, ok := err.(*exec.ExitError); ok && exitErr.ExitCode() == 99 {
|
|
// Debian resolvconf doesn't understand --version, and
|
|
// exits with a specific error code.
|
|
return newDebianResolvconfManager(logf)
|
|
}
|
|
}
|
|
// If --version works, or we got some surprising error while
|
|
// probing, use openresolv. It's the more common implementation,
|
|
// so in cases where we can't figure things out, it's the least
|
|
// likely to misbehave.
|
|
return newOpenresolvManager()
|
|
}
|