Skip to content

Commit cec773f

Browse files
committed
Supports DNSSEC field
1 parent 3f67721 commit cec773f

File tree

3 files changed

+30
-22
lines changed

3 files changed

+30
-22
lines changed

internal/models/dns.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import (
1212

1313
// ProviderData contains information for a DNS provider.
1414
type ProviderData struct {
15-
IPs []net.IP
16-
Host Host
17-
SupportsIPv6 bool
18-
SupportsTLS bool
15+
IPs []net.IP
16+
Host Host
17+
SupportsIPv6 bool
18+
SupportsTLS bool
19+
SupportsDNSSEC bool
1920
}
2021

2122
type Settings struct { //nolint:maligned

pkg/unbound/conf.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ func generateUnboundConf(settings models.Settings,
9191
}
9292

9393
for _, provider := range settings.Providers {
94-
if provider == LibreDNS {
94+
data, _ := GetProviderData(provider)
95+
if !data.SupportsDNSSEC {
9596
delete(serverSection, "trust-anchor-file")
9697
}
9798
}

pkg/unbound/constants.go

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ func GetProviderData(provider string) (data models.ProviderData, ok bool) {
4444
{0x26, 0x6, 0x47, 0x0, 0x47, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x11},
4545
{0x26, 0x6, 0x47, 0x0, 0x47, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x01},
4646
},
47-
SupportsTLS: true,
48-
SupportsIPv6: true,
49-
Host: models.Host("cloudflare-dns.com"),
47+
SupportsTLS: true,
48+
SupportsDNSSEC: true,
49+
SupportsIPv6: true,
50+
Host: models.Host("cloudflare-dns.com"),
5051
},
5152
Google: {
5253
IPs: []net.IP{
@@ -55,9 +56,10 @@ func GetProviderData(provider string) (data models.ProviderData, ok bool) {
5556
{0x20, 0x1, 0x48, 0x60, 0x48, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x88, 0x88},
5657
{0x20, 0x1, 0x48, 0x60, 0x48, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x88, 0x44},
5758
},
58-
SupportsTLS: true,
59-
SupportsIPv6: true,
60-
Host: models.Host("dns.google"),
59+
SupportsTLS: true,
60+
SupportsDNSSEC: true,
61+
SupportsIPv6: true,
62+
Host: models.Host("dns.google"),
6163
},
6264
Quad9: {
6365
IPs: []net.IP{
@@ -66,18 +68,20 @@ func GetProviderData(provider string) (data models.ProviderData, ok bool) {
6668
{0x26, 0x20, 0x0, 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfe},
6769
{0x26, 0x20, 0x0, 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9},
6870
},
69-
SupportsTLS: true,
70-
SupportsIPv6: true,
71-
Host: models.Host("dns.quad9.net"),
71+
SupportsTLS: true,
72+
SupportsDNSSEC: true,
73+
SupportsIPv6: true,
74+
Host: models.Host("dns.quad9.net"),
7275
},
7376
Quadrant: {
7477
IPs: []net.IP{
7578
{12, 159, 2, 159},
7679
{0x20, 0x1, 0x18, 0x90, 0x14, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x59},
7780
},
78-
SupportsTLS: true,
79-
SupportsIPv6: true,
80-
Host: models.Host("dns-tls.qis.io"),
81+
SupportsTLS: true,
82+
SupportsDNSSEC: true,
83+
SupportsIPv6: true,
84+
Host: models.Host("dns-tls.qis.io"),
8185
},
8286
CleanBrowsing: {
8387
IPs: []net.IP{
@@ -86,9 +90,10 @@ func GetProviderData(provider string) (data models.ProviderData, ok bool) {
8690
{0x2a, 0xd, 0x2a, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2},
8791
{0x2a, 0xd, 0x2a, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2},
8892
},
89-
SupportsTLS: true,
90-
SupportsIPv6: true,
91-
Host: models.Host("security-filter-dns.cleanbrowsing.org"),
93+
SupportsTLS: true,
94+
SupportsDNSSEC: true,
95+
SupportsIPv6: true,
96+
Host: models.Host("security-filter-dns.cleanbrowsing.org"),
9297
},
9398
LibreDNS: {
9499
IPs: []net.IP{{116, 202, 176, 26}},
@@ -102,8 +107,9 @@ func GetProviderData(provider string) (data models.ProviderData, ok bool) {
102107
{0x26, 0x20, 0x1, 0xa, 0x80, 0xbb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20},
103108
{0x26, 0x20, 0x1, 0xa, 0x80, 0xbc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20},
104109
},
105-
SupportsTLS: true,
106-
Host: models.Host("protected.canadianshield.cira.ca"),
110+
SupportsTLS: true,
111+
SupportsDNSSEC: true,
112+
Host: models.Host("protected.canadianshield.cira.ca"),
107113
},
108114
}
109115
data, ok = mapping[provider]

0 commit comments

Comments
 (0)