Skip to content

Commit

Permalink
Supports DNSSEC field
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Jan 2, 2021
1 parent 3f67721 commit cec773f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 22 deletions.
9 changes: 5 additions & 4 deletions internal/models/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import (

// ProviderData contains information for a DNS provider.
type ProviderData struct {
IPs []net.IP
Host Host
SupportsIPv6 bool
SupportsTLS bool
IPs []net.IP
Host Host
SupportsIPv6 bool
SupportsTLS bool
SupportsDNSSEC bool
}

type Settings struct { //nolint:maligned
Expand Down
3 changes: 2 additions & 1 deletion pkg/unbound/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ func generateUnboundConf(settings models.Settings,
}

for _, provider := range settings.Providers {
if provider == LibreDNS {
data, _ := GetProviderData(provider)
if !data.SupportsDNSSEC {
delete(serverSection, "trust-anchor-file")
}
}
Expand Down
40 changes: 23 additions & 17 deletions pkg/unbound/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ func GetProviderData(provider string) (data models.ProviderData, ok bool) {
{0x26, 0x6, 0x47, 0x0, 0x47, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x11},
{0x26, 0x6, 0x47, 0x0, 0x47, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x01},
},
SupportsTLS: true,
SupportsIPv6: true,
Host: models.Host("cloudflare-dns.com"),
SupportsTLS: true,
SupportsDNSSEC: true,
SupportsIPv6: true,
Host: models.Host("cloudflare-dns.com"),
},
Google: {
IPs: []net.IP{
Expand All @@ -55,9 +56,10 @@ func GetProviderData(provider string) (data models.ProviderData, ok bool) {
{0x20, 0x1, 0x48, 0x60, 0x48, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x88, 0x88},
{0x20, 0x1, 0x48, 0x60, 0x48, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x88, 0x44},
},
SupportsTLS: true,
SupportsIPv6: true,
Host: models.Host("dns.google"),
SupportsTLS: true,
SupportsDNSSEC: true,
SupportsIPv6: true,
Host: models.Host("dns.google"),
},
Quad9: {
IPs: []net.IP{
Expand All @@ -66,18 +68,20 @@ func GetProviderData(provider string) (data models.ProviderData, ok bool) {
{0x26, 0x20, 0x0, 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfe},
{0x26, 0x20, 0x0, 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9},
},
SupportsTLS: true,
SupportsIPv6: true,
Host: models.Host("dns.quad9.net"),
SupportsTLS: true,
SupportsDNSSEC: true,
SupportsIPv6: true,
Host: models.Host("dns.quad9.net"),
},
Quadrant: {
IPs: []net.IP{
{12, 159, 2, 159},
{0x20, 0x1, 0x18, 0x90, 0x14, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x59},
},
SupportsTLS: true,
SupportsIPv6: true,
Host: models.Host("dns-tls.qis.io"),
SupportsTLS: true,
SupportsDNSSEC: true,
SupportsIPv6: true,
Host: models.Host("dns-tls.qis.io"),
},
CleanBrowsing: {
IPs: []net.IP{
Expand All @@ -86,9 +90,10 @@ func GetProviderData(provider string) (data models.ProviderData, ok bool) {
{0x2a, 0xd, 0x2a, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2},
{0x2a, 0xd, 0x2a, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2},
},
SupportsTLS: true,
SupportsIPv6: true,
Host: models.Host("security-filter-dns.cleanbrowsing.org"),
SupportsTLS: true,
SupportsDNSSEC: true,
SupportsIPv6: true,
Host: models.Host("security-filter-dns.cleanbrowsing.org"),
},
LibreDNS: {
IPs: []net.IP{{116, 202, 176, 26}},
Expand All @@ -102,8 +107,9 @@ func GetProviderData(provider string) (data models.ProviderData, ok bool) {
{0x26, 0x20, 0x1, 0xa, 0x80, 0xbb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20},
{0x26, 0x20, 0x1, 0xa, 0x80, 0xbc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20},
},
SupportsTLS: true,
Host: models.Host("protected.canadianshield.cira.ca"),
SupportsTLS: true,
SupportsDNSSEC: true,
Host: models.Host("protected.canadianshield.cira.ca"),
},
}
data, ok = mapping[provider]
Expand Down

0 comments on commit cec773f

Please sign in to comment.