+ dnsforward: match CNAME with filtering rules

+ GET /control/querylog: add "cname_match" field

* querylog: Add() now receives an object with parameters
This commit is contained in:
Simon Zolin
2019-11-21 16:13:19 +03:00
parent acd8da6f0a
commit e7727e9f63
7 changed files with 297 additions and 33 deletions

View File

@@ -22,7 +22,7 @@ type QueryLog interface {
Close()
// Add a log entry
Add(question *dns.Msg, answer *dns.Msg, result *dnsfilter.Result, elapsed time.Duration, ip net.IP, upstream string)
Add(params AddParams)
// WriteDiskConfig - write configuration
WriteDiskConfig(dc *DiskConfig)
@@ -42,6 +42,17 @@ type Config struct {
HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request))
}
// AddParams - parameters for Add()
type AddParams struct {
Question *dns.Msg
Answer *dns.Msg // The response we sent to the client (optional)
OrigAnswer *dns.Msg // The response from an upstream server (optional)
Result *dnsfilter.Result // Filtering result (optional)
Elapsed time.Duration // Time spent for processing the request
ClientIP net.IP
Upstream string
}
// New - create a new instance of the query log
func New(conf Config) QueryLog {
return newQueryLog(conf)