|
|
@ -76,14 +76,6 @@ func readResolv(r io.Reader) (config OSConfig, err error) {
|
|
|
|
return config, nil
|
|
|
|
return config, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (m directManager) readResolvFile(path string) (OSConfig, error) {
|
|
|
|
|
|
|
|
b, err := m.fs.ReadFile(path)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return OSConfig{}, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return readResolv(bytes.NewReader(b))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// resolvOwner returns the apparent owner of the resolv.conf
|
|
|
|
// resolvOwner returns the apparent owner of the resolv.conf
|
|
|
|
// configuration in bs - one of "resolvconf", "systemd-resolved" or
|
|
|
|
// configuration in bs - one of "resolvconf", "systemd-resolved" or
|
|
|
|
// "NetworkManager", or "" if no known owner was found.
|
|
|
|
// "NetworkManager", or "" if no known owner was found.
|
|
|
@ -152,6 +144,14 @@ func newDirectManagerOnFS(fs wholeFileFS) directManager {
|
|
|
|
return directManager{fs: fs}
|
|
|
|
return directManager{fs: fs}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (m directManager) readResolvFile(path string) (OSConfig, error) {
|
|
|
|
|
|
|
|
b, err := m.fs.ReadFile(path)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return OSConfig{}, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return readResolv(bytes.NewReader(b))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ownedByTailscale reports whether /etc/resolv.conf seems to be a
|
|
|
|
// ownedByTailscale reports whether /etc/resolv.conf seems to be a
|
|
|
|
// tailscale-managed file.
|
|
|
|
// tailscale-managed file.
|
|
|
|
func (m directManager) ownedByTailscale() (bool, error) {
|
|
|
|
func (m directManager) ownedByTailscale() (bool, error) {
|
|
|
|