Files
routedns/blocklistdb.go
Frank Olbricht acc8842fad Support naming blocklists to help with logging (#201)
* Support naming blocklists to help with logging

* Support naming of lists in response blocklists too

* Add list name to client-blocklist as well
2022-01-09 07:44:53 -07:00

29 lines
733 B
Go

package rdns
import (
"fmt"
"net"
"github.com/miekg/dns"
)
type BlocklistDB interface {
// Reload initializes a new instance of the same database but with
// a new ruleset loaded.
Reload() (BlocklistDB, error)
// Returns true if the question matches a rule. If the IP is not nil,
// respond with the given IP. NXDOMAIN otherwise.
Match(q dns.Question) (net.IP, string, *BlocklistMatch, bool)
fmt.Stringer
}
// BlocklistMatch is returned by blocklists when a match is found. It contains
// information about what rule matched, what list it was from etc. Used mostly
// for logging.
type BlocklistMatch struct {
List string // Identifier or name of the blocklist
Rule string // Identifier for the rule that matched
}