"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "internal/dnsforward/dnsforward_test.go" between
AdGuardHome-0.104.1.tar.gz and AdGuardHome-0.104.3.tar.gz

About: AdGuard Home is a network-wide ads & trackers blocking DNS server. It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers.

dnsforward_test.go  (AdGuardHome-0.104.1):dnsforward_test.go  (AdGuardHome-0.104.3)
skipping to change at line 21 skipping to change at line 21
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"math/big" "math/big"
"net" "net"
"os" "os"
"sort" "sort"
"sync" "sync"
"testing" "testing"
"time" "time"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/AdGuardHome/internal/util" "github.com/AdguardTeam/AdGuardHome/internal/util"
"github.com/AdguardTeam/AdGuardHome/internal/dhcpd" "github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter"
"github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/dnsproxy/proxy"
"github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/dnsproxy/upstream"
"github.com/miekg/dns" "github.com/miekg/dns"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func TestMain(m *testing.M) {
testutil.DiscardLogOutput(m)
}
const ( const (
tlsServerName = "testdns.adguard.com" tlsServerName = "testdns.adguard.com"
testMessagesCount = 10 testMessagesCount = 10
) )
func TestServer(t *testing.T) { func TestServer(t *testing.T) {
s := createTestServer(t) s := createTestServer(t)
err := s.Start() err := s.Start()
if err != nil { if err != nil {
t.Fatalf("Failed to start server: %s", err) t.Fatalf("Failed to start server: %s", err)
skipping to change at line 754 skipping to change at line 759
}} }}
c := dnsfilter.Config{} c := dnsfilter.Config{}
c.SafeBrowsingEnabled = true c.SafeBrowsingEnabled = true
c.SafeBrowsingCacheSize = 1000 c.SafeBrowsingCacheSize = 1000
c.SafeSearchEnabled = true c.SafeSearchEnabled = true
c.SafeSearchCacheSize = 1000 c.SafeSearchCacheSize = 1000
c.ParentalCacheSize = 1000 c.ParentalCacheSize = 1000
c.CacheTime = 30 c.CacheTime = 30
f := dnsfilter.New(&c, filters) f := dnsfilter.New(&c, filters)
s := NewServer(DNSCreateParams{DNSFilter: f}) s := NewServer(DNSCreateParams{DNSFilter: f})
s.conf.UDPListenAddr = &net.UDPAddr{Port: 0} s.conf.UDPListenAddr = &net.UDPAddr{Port: 0}
s.conf.TCPListenAddr = &net.TCPAddr{Port: 0} s.conf.TCPListenAddr = &net.TCPAddr{Port: 0}
s.conf.UpstreamDNS = []string{"8.8.8.8:53", "8.8.4.4:53"} s.conf.UpstreamDNS = []string{"8.8.8.8:53", "8.8.4.4:53"}
s.conf.FilteringConfig.ProtectionEnabled = true s.conf.FilteringConfig.ProtectionEnabled = true
s.conf.ConfigModified = func() {}
err := s.Prepare(nil) err := s.Prepare(nil)
assert.True(t, err == nil) assert.True(t, err == nil)
return s return s
} }
func createServerTLSConfig(t *testing.T) (*tls.Config, []byte, []byte) { func createServerTLSConfig(t *testing.T) (*tls.Config, []byte, []byte) {
privateKey, err := rsa.GenerateKey(rand.Reader, 2048) privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
if err != nil { if err != nil {
t.Fatalf("cannot generate RSA key: %s", err) t.Fatalf("cannot generate RSA key: %s", err)
} }
 End of changes. 4 change blocks. 
0 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)