mirror of
https://github.com/safing/portmaster
synced 2025-09-15 09:19:48 +00:00
Improve support for DNS-SD and fall back to cached data for non-ICANN queries
This commit is contained in:
parent
49e79fe3fd
commit
9a89f65027
6 changed files with 211 additions and 28 deletions
|
@ -128,7 +128,7 @@ func (er *envResolverConn) makeRRCache(q *Query, answers []dns.RR) *RRCache {
|
|||
// Disable caching, as the env always has the raw data available.
|
||||
q.NoCaching = true
|
||||
|
||||
return &RRCache{
|
||||
rrCache := &RRCache{
|
||||
Domain: q.FQDN,
|
||||
Question: q.QType,
|
||||
RCode: dns.RcodeSuccess,
|
||||
|
@ -136,6 +136,10 @@ func (er *envResolverConn) makeRRCache(q *Query, answers []dns.RR) *RRCache {
|
|||
Extra: []dns.RR{internalSpecialUseComment}, // Always add comment about this TLD.
|
||||
Resolver: envResolver.Info.Copy(),
|
||||
}
|
||||
if len(rrCache.Answer) == 0 {
|
||||
rrCache.RCode = dns.RcodeNameError
|
||||
}
|
||||
return rrCache
|
||||
}
|
||||
|
||||
func (er *envResolverConn) ReportFailure() {}
|
||||
|
@ -145,3 +149,8 @@ func (er *envResolverConn) IsFailing() bool {
|
|||
}
|
||||
|
||||
func (er *envResolverConn) ResetFailure() {}
|
||||
|
||||
// QueryPortmasterEnv queries the environment resolver directly.
|
||||
func QueryPortmasterEnv(ctx context.Context, q *Query) (*RRCache, error) {
|
||||
return envResolver.Conn.Query(ctx, q)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue