From efd81c917ca0799e5c327096a867d6bdfcd189f9 Mon Sep 17 00:00:00 2001 From: Dennis Date: Thu, 8 Dec 2016 01:36:02 +0900 Subject: [PATCH 1/2] add support for an additional EDNS client subnet for AAAA queries --- gdns.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gdns.go b/gdns.go index 16b8508..aa6d4c5 100644 --- a/gdns.go +++ b/gdns.go @@ -23,6 +23,7 @@ type Gdns struct { sni *string host *string edns *string + edns6 *string nopad *bool } @@ -40,6 +41,8 @@ func (r *Gdns) Init() { "Google DNS: HTTP 'Host' header (real FQDN, encrypted in TLS)") r.edns = flag.String("gdns:edns", "", "Google DNS: EDNS client subnet (set 0.0.0.0/0 to disable)") + r.edns6 = flag.String("gdns:edns6", "", + "Google DNS: Optional IPv6 EDNS client subnet for AAAA queries") r.nopad = flag.Bool("gdns:nopad", false, "Google DNS: disable random padding") } @@ -76,9 +79,13 @@ func (R *Gdns) resolve(https *Https, server string, qname string, qtype int) *Re /* prepare */ v.Set("name", qname) v.Set("type", fmt.Sprintf("%d", qtype)) - if len(*R.edns) > 0 { + + if (qtype == 28 && len(*R.edns6) > 0) { + v.Set("edns_client_subnet", *R.edns6) + } else if (len(*R.edns) > 0) { v.Set("edns_client_subnet", *R.edns) } + if !*R.nopad { v.Set("random_padding", strings.Repeat(string(65+rand.Intn(26)), rand.Intn(500))) } From c66b570b8eacd15f48c05462eacc11295e6b12b7 Mon Sep 17 00:00:00 2001 From: Dennis Date: Thu, 8 Dec 2016 01:38:00 +0900 Subject: [PATCH 2/2] update Readme for edns6 support --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f945500..b6dc1d1 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,8 @@ Usage of dingo-linux-amd64: Google DNS: try to lookup the closest IPv4 server -gdns:edns string Google DNS: EDNS client subnet (set 0.0.0.0/0 to disable) + -gdns:edns6 string + Google DNS: Optional IPv6 EDNS client subnet for AAAA queries -gdns:host string Google DNS: HTTP 'Host' header (real FQDN, encrypted in TLS) (default "dns.google.com") -gdns:nopad