Update Go, deps and linter

This commit is contained in:
Daniel
2022-08-30 16:13:26 +02:00
parent 44b5375bb4
commit 8cf882f4d4
22 changed files with 87 additions and 88 deletions

View File

@@ -1,22 +1,22 @@
/*
Package resolver is responsible for querying DNS.
DNS Servers
# DNS Servers
Internal lists of resolvers to use are built on start and rebuilt on every config or network change.
Configured DNS servers are prioritized over servers assigned by dhcp. Domain and search options (here referred to as "search scopes") are being considered.
Security
# Security
Usage of DNS Servers can be regulated using the configuration:
DoNotUseAssignedDNS // Do not use DNS servers assigned by DHCP
DoNotUseMDNS // Do not use mDNS
DoNotForwardSpecialDomains // Do not forward special domains to local resolvers, except if they have a search scope for it
DoNotUseAssignedDNS // Do not use DNS servers assigned by DHCP
DoNotUseMDNS // Do not use mDNS
DoNotForwardSpecialDomains // Do not forward special domains to local resolvers, except if they have a search scope for it
Note: The DHCP options "domain" and "search" are ignored for servers assigned by DHCP that do not reside within local address space.
Resolving DNS
# Resolving DNS
Various different queries require the resolver to behave in different manner:
@@ -24,6 +24,5 @@ Queries for "localhost." are immediately responded with 127.0.0.1 and ::1, for A
Reverse lookups on local address ranges (10/8, 172.16/12, 192.168/16, fe80::/7) will be tried against every local resolver and finally mDNS until a successful, non-NXDomain answer is received.
Special domains ("example.", "example.com.", "example.net.", "example.org.", "invalid.", "test.", "onion.") are resolved using search scopes and local resolvers.
All other domains are resolved using search scopes and all available resolvers.
*/
package resolver

View File

@@ -90,7 +90,9 @@ func (hr *HTTPSResolver) Query(ctx context.Context, q *Query) (*RRCache, error)
if err != nil {
return nil, err
}
defer resp.Body.Close()
defer func() {
_ = resp.Body.Close()
}()
// Try to read the result
body, err := ioutil.ReadAll(resp.Body)

View File

@@ -30,7 +30,7 @@ const (
ServerSourceEnv = "env"
)
// DNS Resolver alias
// DNS resolver scheme aliases.
const (
HTTPSProtocol = "https"
TLSProtocol = "tls"
@@ -117,14 +117,14 @@ func (info *ResolverInfo) ID() string {
case ServerTypeEnv:
info.id = ServerTypeEnv
case ServerTypeDoH:
info.id = fmt.Sprintf(
info.id = fmt.Sprintf( //nolint:nosprintfhostport // Not used as URL.
"https://%s:%d#%s",
info.Domain,
info.Port,
info.Source,
)
case ServerTypeDoT:
info.id = fmt.Sprintf(
info.id = fmt.Sprintf( //nolint:nosprintfhostport // Not used as URL.
"dot://%s:%d#%s",
info.Domain,
info.Port,

View File

@@ -10,9 +10,9 @@ import (
"strings"
"sync"
"github.com/miekg/dns"
"golang.org/x/net/publicsuffix"
"github.com/miekg/dns"
"github.com/safing/portbase/log"
"github.com/safing/portbase/utils"
"github.com/safing/portmaster/netenv"

View File

@@ -16,7 +16,8 @@ import (
// RRCache is a single-use structure to hold a DNS response.
// Persistence is handled through NameRecords because of a limitation of the
// underlying dns library.
//nolint:maligned // TODO
//
//nolint:maligned
type RRCache struct {
// Respnse Header
Domain string