Files
ctrld/cmd/cli/dns_config_darwin.go
T
Anthony Wong 8ae09ac98e feat(cli): put the network state of the host in the log journal
The journal records the network state of the host and each change of
that state. The support team reads one file to see the interfaces, the
routes, the resolvers, and the recoveries around an incident. The same
file shows the health of the query path. A change that touches only
AirDrop or virtual interfaces runs no DNS work.
2026-09-28 16:49:05 +07:00

23 lines
529 B
Go

package cli
import (
"bytes"
"context"
"os/exec"
"time"
)
// scutilDNSTimeout bounds the read. scutil talks to the configuration daemon,
// and that daemon stalls while the network moves.
const scutilDNSTimeout = 5 * time.Second
func runSCUtilDNS() ([]dnsResolverEntry, error) {
ctx, cancel := context.WithTimeout(context.Background(), scutilDNSTimeout)
defer cancel()
out, err := exec.CommandContext(ctx, "scutil", "--dns").Output()
if err != nil {
return nil, err
}
return parseSCUtilDNS(bytes.NewReader(out))
}