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.
This commit is contained in:
Anthony Wong authored and Cuong Manh Le committed 2026-09-28 16:49:05 +07:00
1 parent 8934e09428
commit 8ae09ac98e
68 files changed
+10458 -442

No files matched your search

+11 -2
View File
@@ -2,11 +2,20 @@ package cli
import "github.com/Control-D-Inc/ctrld"
var initializeOsResolver = ctrld.InitializeOsResolver
var initializeOsResolver = ctrld.InitializeOsResolverWithReason
// Reasons that the journal reports when the resolver set changes. Each one
// names the code path that read the resolvers of the host.
const (
osResolverReasonStart = "start"
osResolverReasonWakeProbe = "wake_probe"
osResolverReasonVPNSettle = "vpn_settle"
osResolverReasonDelayedRecheck = "delayed_recheck"
)
func (p *prog) refreshDNSAfterVPNSettle(reason string) (routes, domainlessServers, exemptions int) {
mainLog.Load().Info().Msgf("DNS intercept: refreshing OS/VPN DNS route state after VPN settle (%s)", reason)
ns := initializeOsResolver(true)
ns := initializeOsResolver(true, osResolverReasonVPNSettle)
mainLog.Load().Debug().Msgf("DNS intercept: post-settle OS resolver nameservers: %v", ns)
if p.vpnDNS == nil {