mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-05-27 12:52:27 +02:00
feat: introduce DNS intercept mode infrastructure
This commit is contained in:
committed by
Cuong Manh Le
parent
c56d4771de
commit
395335162f
+19
@@ -120,6 +120,25 @@ func InitializeOsResolver(ctx context.Context, guardAgainstNoNameservers bool) [
|
||||
return ns
|
||||
}
|
||||
|
||||
// OsResolverNameservers returns the current OS resolver nameservers (host:port format).
|
||||
// Returns nil if the OS resolver has not been initialized.
|
||||
func OsResolverNameservers() []string {
|
||||
resolverMutex.Lock()
|
||||
r := or
|
||||
resolverMutex.Unlock()
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
var nss []string
|
||||
if lan := r.lanServers.Load(); lan != nil {
|
||||
nss = append(nss, *lan...)
|
||||
}
|
||||
if pub := r.publicServers.Load(); pub != nil {
|
||||
nss = append(nss, *pub...)
|
||||
}
|
||||
return nss
|
||||
}
|
||||
|
||||
// initializeOsResolver performs logic for choosing OS resolver nameserver.
|
||||
// The logic:
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user