mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-03-25 23:30:41 +01:00
fix(windows): make staticcheck happy
This commit is contained in:
committed by
Cuong Manh Le
parent
9b2e51f53a
commit
9be15aeec8
@@ -1062,36 +1062,6 @@ func (p *prog) stopDNSIntercept() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// dnsInterceptSupported reports whether DNS intercept mode is supported on this platform.
|
||||
func dnsInterceptSupported() bool {
|
||||
if err := fwpuclntDLL.Load(); err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// validateDNSIntercept checks that the system meets requirements for DNS intercept mode.
|
||||
func (p *prog) validateDNSIntercept() error {
|
||||
// Hard mode requires WFP and elevation for filter management.
|
||||
if hardIntercept {
|
||||
if !dnsInterceptSupported() {
|
||||
return fmt.Errorf("dns intercept: fwpuclnt.dll not available — WFP requires Windows Vista or later")
|
||||
}
|
||||
if !isElevated() {
|
||||
return fmt.Errorf("dns intercept: administrator privileges required for WFP filter management in hard mode")
|
||||
}
|
||||
}
|
||||
// dns mode only needs NRPT (HKLM registry writes), which services can do
|
||||
// without explicit elevation checks.
|
||||
return nil
|
||||
}
|
||||
|
||||
// isElevated checks if the current process has administrator privileges.
|
||||
func isElevated() bool {
|
||||
token := windows.GetCurrentProcessToken()
|
||||
return token.IsElevated()
|
||||
}
|
||||
|
||||
// exemptVPNDNSServers updates the WFP filters to permit outbound DNS to the given
|
||||
// VPN DNS server IPs. This prevents the block filters from intercepting ctrld's own
|
||||
// forwarded queries to VPN DNS servers (split DNS routing).
|
||||
@@ -1319,11 +1289,6 @@ func (p *prog) ensurePFAnchorActive() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// pfAnchorIsWiped is a no-op on Windows (WFP handles intercept differently).
|
||||
func (p *prog) pfAnchorIsWiped() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// checkTunnelInterfaceChanges is a no-op on Windows (WFP handles intercept differently).
|
||||
func (p *prog) checkTunnelInterfaceChanges() bool {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user