mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Small changes based on review comments
This commit is contained in:
parent
9deb1623d6
commit
42ccb3e39a
3 changed files with 14 additions and 1 deletions
|
@ -273,6 +273,8 @@ func (e *Entity) getDomainLists() {
|
||||||
domains = domainsToInspect
|
domains = domainsToInspect
|
||||||
}
|
}
|
||||||
|
|
||||||
|
domains = makeDistinct(domains)
|
||||||
|
|
||||||
for _, d := range domains {
|
for _, d := range domains {
|
||||||
log.Tracef("intel: loading domain list for %s", d)
|
log.Tracef("intel: loading domain list for %s", d)
|
||||||
list, err := filterlists.LookupDomain(d)
|
list, err := filterlists.LookupDomain(d)
|
||||||
|
@ -441,3 +443,12 @@ func buildLookupMap(l []string) filterlists.LookupMap {
|
||||||
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func makeDistinct(slice []string) []string {
|
||||||
|
lm := buildLookupMap(slice)
|
||||||
|
result := make([]string, 0, len(lm))
|
||||||
|
for key := range lm {
|
||||||
|
result = append(result, key)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package nameserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -247,7 +248,7 @@ func handleRequest(ctx context.Context, w dns.ResponseWriter, query *dns.Msg) er
|
||||||
// TODO: analyze nxdomain requests, malware could be trying DGA-domains
|
// TODO: analyze nxdomain requests, malware could be trying DGA-domains
|
||||||
tracer.Warningf("nameserver: %s requested %s%s: %s", conn.Process(), q.FQDN, q.QType, err)
|
tracer.Warningf("nameserver: %s requested %s%s: %s", conn.Process(), q.FQDN, q.QType, err)
|
||||||
|
|
||||||
if _, ok := err.(*resolver.BlockedUpstreamError); ok {
|
if errors.Is(err, &resolver.BlockedUpstreamError{}) {
|
||||||
conn.Block(err.Error())
|
conn.Block(err.Error())
|
||||||
} else {
|
} else {
|
||||||
conn.Failed("failed to resolve: " + err.Error())
|
conn.Failed("failed to resolve: " + err.Error())
|
||||||
|
|
|
@ -192,6 +192,7 @@ Examples:
|
||||||
ExternalOptType: "security level",
|
ExternalOptType: "security level",
|
||||||
DefaultValue: status.SecurityLevelsAll,
|
DefaultValue: status.SecurityLevelsAll,
|
||||||
ValidationRegex: "^(7|6|4)$",
|
ValidationRegex: "^(7|6|4)$",
|
||||||
|
ExpertiseLevel: config.ExpertiseLevelExpert,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Add table
Reference in a new issue