Compare commits

..

3 Commits

Author SHA1 Message Date
Adam Veldhousen 2167651569
chore: update package-lock.json 2021-06-10 10:55:05 -05:00
Adam Veldhousen 4b0589ddb0
feat: add upstream default upstream dns server as CLI flag 2021-06-10 10:51:09 -05:00
Adam Veldhousen 9320c2675a
bugfix: better parsing of client IP for query log 2021-06-10 10:50:35 -05:00
3 changed files with 565 additions and 297 deletions

850
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,10 +20,11 @@ func (dm *DomainManager) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {
start := time.Now() start := time.Now()
q := r.Question[0] q := r.Question[0]
responseMessage := new(dns.Msg) responseMessage := new(dns.Msg)
ql := QueryLog{ ql := QueryLog{
Started: start.UTC(), Started: start.UTC(),
Protocol: w.RemoteAddr().Network(), Protocol: w.RemoteAddr().Network(),
ClientIP: strings.Split(w.RemoteAddr().String(), ":")[0], ClientIP: w.RemoteAddr().String()[:strings.LastIndex(w.RemoteAddr().String(), ":")],
Domain: q.Name, Domain: q.Name,
Status: NoAnswer, Status: NoAnswer,
} }

View File

@ -13,9 +13,10 @@ import (
) )
var ( var (
dbPath = flag.String("db-path", ".", "Directory to write database files to") dbPath = flag.String("db-path", ".", "Directory to write database files to")
httpAddr = flag.String("http-address", ":80", "Bind address for http server") httpAddr = flag.String("http-address", ":80", "Bind address for http server")
dnsAddr = flag.String("dns-address", ":53", "Bind address for dns server") dnsAddr = flag.String("dns-address", ":53", "Bind address for dns server")
defaultUpstream = flag.String("upstream", "1.1.1.1:53", "default upstream DNS server when no others are specified")
) )
func main() { func main() {
@ -57,7 +58,7 @@ func main() {
Storage: store, Storage: store,
RuleEvaluator: re, RuleEvaluator: re,
Recursors: internal.Recursor{ Recursors: internal.Recursor{
Upstreams: []string{"1.1.1.1:53"}, Upstreams: []string{*defaultUpstream},
Client: dnsClient, Client: dnsClient,
}, },
} }