Skip to content

Commit

Permalink
feat(pkg/provider): add opendns
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Jun 17, 2023
1 parent 722367d commit e9d4f48
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/provider/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func All() []Provider {
CloudflareSecurity(),
Google(),
LibreDNS(),
OpenDNS(),
Quad9(),
Quad9Secured(),
Quad9Unsecured(),
Expand Down
6 changes: 5 additions & 1 deletion pkg/provider/list_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package provider

import (
"net/netip"
"testing"

"github.com/stretchr/testify/assert"
)

func Test_All(t *testing.T) {
t.Parallel()

t.Logf("%#v", netip.MustParseAddr("2620:119:35::35").As16())

providers := All()
assert.Len(t, providers, 15)
assert.Len(t, providers, 16)

for _, provider := range providers {
errMessage := "for provider " + provider.DoT.Name
Expand Down
35 changes: 35 additions & 0 deletions pkg/provider/opendns.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package provider

import "net/netip"

func OpenDNS() Provider {
return Provider{
Name: "OpenDNS",
DNS: DNSServer{
IPv4: []netip.Addr{
netip.AddrFrom4([4]byte{208, 67, 222, 222}),
netip.AddrFrom4([4]byte{208, 67, 220, 220}),
},
IPv6: []netip.Addr{
netip.AddrFrom16([16]byte{0x26, 0x20, 0x1, 0x19, 0x0, 0x35, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x35}),
netip.AddrFrom16([16]byte{0x26, 0x20, 0x1, 0x19, 0x0, 0x53, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x53}),
},
},
DoT: DoTServer{
IPv4: []netip.Addr{
netip.AddrFrom4([4]byte{208, 67, 222, 222}),
netip.AddrFrom4([4]byte{208, 67, 220, 220}),
},
IPv6: []netip.Addr{
netip.AddrFrom16([16]byte{0x26, 0x20, 0x1, 0x19, 0x0, 0x35, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x35}),
netip.AddrFrom16([16]byte{0x26, 0x20, 0x1, 0x19, 0x0, 0x53, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x53}),
},
Name: "dns.opendns.com",
Port: defaultDoTPort,
},
// See https://support.opendns.com/hc/en-us/articles/360038086532-Using-DNS-over-HTTPS-DoH-with-OpenDNS
DoH: DoHServer{
URL: "https://dns.opendns.com/dns-query",
},
}
}

0 comments on commit e9d4f48

Please sign in to comment.