Add custom routing for DNS server connections

This commit is contained in:
Daniel
2021-10-12 16:18:36 +02:00
parent 0f48d32ac2
commit 960101d3a9
5 changed files with 46 additions and 111 deletions

View File

@@ -395,3 +395,18 @@ func checkSearchScope(searchDomain string) (ok bool) {
return true
}
// IsResolverAddress returns whether the given ip and port match a configured resolver.
func IsResolverAddress(ip net.IP, port uint16) bool {
resolversLock.RLock()
defer resolversLock.RUnlock()
// Check if the given IP and port matches a resolver.
for _, r := range globalResolvers {
if port == r.Info.Port && r.Info.IP.Equal(ip) {
return true
}
}
return false
}