windows: adopt GP-managed NRPT catch-all

This commit is contained in:
Dev Scribe
2026-08-12 14:32:13 +07:00
committed by Cuong Manh Le
parent 58a5ea56af
commit e4e1c0abb9
13 changed files with 3618 additions and 287 deletions
+7 -8
View File
@@ -20,6 +20,10 @@ import (
"github.com/Control-D-Inc/ctrld"
)
// skipInitialDNSReset is Windows-only; macOS keeps the normal adapter cleanup
// before installing its pf redirect.
func (p *prog) skipInitialDNSReset() bool { return false }
const (
// pfWatchdogInterval is how often the periodic pf watchdog checks
// that our anchor references are still present in the running ruleset.
@@ -1890,14 +1894,9 @@ func (p *prog) probePFIntercept() bool {
// Generate unique probe domain
probeID := fmt.Sprintf("_pf-probe-%x.%s", time.Now().UnixNano()&0xFFFFFFFF, pfProbeDomain)
// Register probe so DNS handler can detect and signal it
probeCh := make(chan struct{}, 1)
p.pfProbeExpected.Store(probeID)
p.pfProbeCh.Store(&probeCh)
defer func() {
p.pfProbeExpected.Store("")
p.pfProbeCh.Store((*chan struct{})(nil))
}()
// Register this attempt's own domain: overlapping probes must not cancel each other.
probeCh, deregister := p.registerInterceptProbe(probeID)
defer deregister()
// Build a minimal DNS query packet for the probe domain.
// We use exec.Command to send from a subprocess with GID=0 (wheel),