docstring_tokens stringlengths 18 16.9k | code_tokens stringlengths 75 1.81M | html_url stringlengths 74 116 | file_name stringlengths 3 311 |
|---|---|---|---|
keep keep keep keep replace replace keep keep keep keep keep | <mask> github.com/AdguardTeam/dnsproxy v0.46.2 h1:ZUKM713Ts5meYQqk6cJkUBMCFSWqFPXTgjXkN4RI1Vo=
<mask> github.com/AdguardTeam/dnsproxy v0.46.2/go.mod h1:PAmRzFqls0E92XTglyY2ESAqMAzZJhHKErG1ZpRnpjA=
<mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.10.4/go.mod h1:rSfQRGHIdgfxriDDNgNJ7HmE5zRoURq8R+VdR81Zuzw=
<mask> github.com/AdguardTeam/golibs v0.11.0 h1:fWp5bRLL7N806HWeNiRM7vHJH+wwWQ3Z6kpGPeu2onM=
<mask> github.com/AdguardTeam/golibs v0.11.0/go.mod h1:87bN2x4VsTritptE3XZg9l8T6gznWsIxHBcQ1DeRIXA=
<mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU=
<mask> github.com/AdguardTeam/urlfilter v0.16.0 h1:IO29m+ZyQuuOnPLTzHuXj35V1DZOp1Dcryl576P2syg=
<mask> github.com/AdguardTeam/urlfilter v0.16.0/go.mod h1:46YZDOV1+qtdRDuhZKVPSSp7JWWes0KayqHrKAFBdEI=
<mask> github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
<mask> github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove github.com/AdguardTeam/golibs v0.11.0
</s> add github.com/AdguardTeam/golibs v0.11.2 </s> add log.Debug("dnsforward: added %d a and ptr entries from dhcp", len(ipToHost)) </s> remove log.Debug("dns: %q requests an internal ip", pctx.Addr)
</s> add log.Debug("dnsforward: %q requests an internal ip", pctx.Addr) </s> remove log.Debug("dns: addr %s is not from locally-served network", ip)
</s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> remove log.Debug("dns: request is for a service domain")
</s> add log.Debug("dnsforward: request is for a service domain") </s> remove log.Debug("dns: validating service domain: %s", err)
</s> add log.Debug("dnsforward: validating service domain: %s", err) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | go.sum |
keep add keep keep keep keep keep keep | <mask>
<mask> // DiscardLogOutput runs tests with discarded logger output.
<mask> func DiscardLogOutput(m *testing.M) {
<mask> // TODO(e.burkov): Refactor code and tests to not use the global mutable
<mask> // logger.
<mask> log.SetOutput(io.Discard)
<mask>
<mask> os.Exit(m.Run())
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove aghtest.DiscardLogOutput(m)
</s> add testutil.DiscardLogOutput(m) </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) {
</s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) { </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
</s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove log.Debug("dns: no dhcp record for %q", reqHost)
</s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove // hostToIPTable is an alias for the type of Server.tableHostToIP.
type hostToIPTable = map[string]net.IP
</s> add // hostToIPTable is a convenient type alias for tables of host names to an IP
// address.
type hostToIPTable = map[string]netip.Addr
// ipToHostTable is a convenient type alias for tables of IP addresses to their
// host names. For example, for use with PTR queries.
type ipToHostTable = map[netip.Addr]string </s> remove log.Debug("dns: addr %s is not from locally-served network", ip)
</s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/aghtest/aghtest.go |
keep add keep keep keep keep | <mask> "encoding/binary"
<mask> "net"
<mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> add "net/netip" </s> add "net/netip" </s> remove ptr, ok := resp.Answer[0].(*dns.PTR)
require.True(t, ok)
</s> add </s> add log.Debug("dnsforward: added %d a and ptr entries from dhcp", len(ipToHost)) </s> remove log.Debug("dns: addr %s is not from locally-served network", ip)
</s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> remove log.Debug("dns: request is for a service domain")
</s> add log.Debug("dnsforward: request is for a service domain") | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep replace keep keep replace replace keep keep keep | <mask> "github.com/AdguardTeam/golibs/stringutil"
<mask> "github.com/miekg/dns"
<mask> "golang.org/x/exp/slices"
<mask> )
<mask>
<mask> //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap].
<mask>
<mask> // To transfer information between modules
<mask> type dnsContext struct {
<mask> proxyCtx *proxy.DNSContext
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap].
</s> add </s> add "github.com/AdguardTeam/golibs/testutil" </s> add //
// TODO(a.garipov): Replace with testutil. </s> remove // hostToIPTable is an alias for the type of Server.tableHostToIP.
type hostToIPTable = map[string]net.IP
</s> add // hostToIPTable is a convenient type alias for tables of host names to an IP
// address.
type hostToIPTable = map[string]netip.Addr
// ipToHostTable is a convenient type alias for tables of IP addresses to their
// host names. For example, for use with PTR queries.
type ipToHostTable = map[netip.Addr]string </s> remove aghtest.DiscardLogOutput(m)
</s> add testutil.DiscardLogOutput(m) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> s.tableHostToIP = t
<mask> }
<mask>
<mask> func (s *Server) setTableIPToHost(t *netutil.IPMap) {
<mask> s.tableIPToHostLock.Lock()
<mask> defer s.tableIPToHostLock.Unlock()
<mask>
<mask> s.tableIPToHost = t
<mask> }
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove var err error
add := true
</s> add </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) {
</s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { </s> remove if s.tableIPToHost == nil {
return "", false
}
var v any
v, ok = s.tableIPToHost.Get(ip)
if !ok {
return "", false
}
if host, ok = v.(string); !ok {
log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)
return "", false
}
</s> add host, ok = s.tableIPToHost[ip] </s> remove if s.tableHostToIP == nil {
return nil, false
}
</s> add ip, ok = s.tableHostToIP[host] </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) {
</s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) { </s> remove return host, true
</s> add return host, ok | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace replace replace keep keep keep keep keep | <mask> s.tableIPToHost = t
<mask> }
<mask>
<mask> func (s *Server) onDHCPLeaseChanged(flags int) {
<mask> var err error
<mask>
<mask> add := true
<mask> switch flags {
<mask> case dhcpd.LeaseChangedAdded,
<mask> dhcpd.LeaseChangedAddedStatic,
<mask> dhcpd.LeaseChangedRemovedStatic:
<mask> // Go on.
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove add = false
</s> add s.setTableHostToIP(nil)
s.setTableIPToHost(nil)
return </s> remove func (s *Server) setTableIPToHost(t *netutil.IPMap) {
</s> add func (s *Server) setTableIPToHost(t ipToHostTable) { </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) {
</s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { </s> remove if s.tableIPToHost == nil {
return "", false
}
var v any
v, ok = s.tableIPToHost.Get(ip)
if !ok {
return "", false
}
if host, ok = v.(string); !ok {
log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)
return "", false
}
</s> add host, ok = s.tableIPToHost[ip] </s> remove if s.tableHostToIP == nil {
return nil, false
}
</s> add ip, ok = s.tableHostToIP[host] </s> remove return host, true
</s> add return host, ok | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep replace replace replace replace keep keep keep | <mask> dhcpd.LeaseChangedAddedStatic,
<mask> dhcpd.LeaseChangedRemovedStatic:
<mask> // Go on.
<mask> case dhcpd.LeaseChangedRemovedAll:
<mask> add = false
<mask> default:
<mask> return
<mask> }
<mask>
<mask> var hostToIP hostToIPTable
<mask> var ipToHost *netutil.IPMap
<mask> if add {
<mask> ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
<mask>
<mask> hostToIP = make(hostToIPTable, len(ll))
<mask> ipToHost = netutil.NewIPMap(len(ll))
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove hostToIP = make(hostToIPTable, len(ll))
ipToHost = netutil.NewIPMap(len(ll))
</s> add continue
} </s> remove var err error
add := true
</s> add </s> remove for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err = netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug(
"dns: skipping invalid hostname %q from dhcp: %s",
l.Hostname,
err,
)
}
</s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) </s> remove if s.tableHostToIP == nil {
return nil, false
}
</s> add ip, ok = s.tableHostToIP[host] </s> remove var ipFromTable net.IP
ipFromTable, ok = s.tableHostToIP[host]
if !ok {
return nil, false
}
ip = make(net.IP, len(ipFromTable))
copy(ip, ipFromTable)
return ip, true
</s> add return ip, ok | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> var ipToHost *netutil.IPMap
<mask> if add {
<mask> ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
<mask>
<mask> hostToIP = make(hostToIPTable, len(ll))
<mask> ipToHost = netutil.NewIPMap(len(ll))
<mask>
<mask> for _, l := range ll {
<mask> // TODO(a.garipov): Remove this after we're finished with the client
<mask> // hostname validations in the DHCP server code.
<mask> err = netutil.ValidateDomainName(l.Hostname)
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove var hostToIP hostToIPTable
var ipToHost *netutil.IPMap
if add {
ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
</s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
hostToIP := make(hostToIPTable, len(ll))
ipToHost := make(ipToHostTable, len(ll))
for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err := netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) </s> remove for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err = netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug(
"dns: skipping invalid hostname %q from dhcp: %s",
l.Hostname,
err,
)
}
</s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
</s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove var err error
add := true
</s> add </s> remove add = false
</s> add s.setTableHostToIP(nil)
s.setTableIPToHost(nil)
return </s> remove var ipFromTable net.IP
ipFromTable, ok = s.tableHostToIP[host]
if !ok {
return nil, false
}
ip = make(net.IP, len(ipFromTable))
copy(ip, ipFromTable)
return ip, true
</s> add return ip, ok | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep replace replace | <mask>
<mask> hostToIP = make(hostToIPTable, len(ll))
<mask> ipToHost = netutil.NewIPMap(len(ll))
<mask>
<mask> for _, l := range ll {
<mask> // TODO(a.garipov): Remove this after we're finished with the client
<mask> // hostname validations in the DHCP server code.
<mask> err = netutil.ValidateDomainName(l.Hostname)
<mask> if err != nil {
<mask> log.Debug(
<mask> "dns: skipping invalid hostname %q from dhcp: %s",
<mask> l.Hostname,
<mask> err,
<mask> )
<mask> }
<mask>
<mask> lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix)
<mask> ip := slices.Clone(l.IP)
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove var hostToIP hostToIPTable
var ipToHost *netutil.IPMap
if add {
ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
</s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
hostToIP := make(hostToIPTable, len(ll))
ipToHost := make(ipToHostTable, len(ll))
for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err := netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) </s> remove hostToIP = make(hostToIPTable, len(ll))
ipToHost = netutil.NewIPMap(len(ll))
</s> add continue
} </s> remove ipToHost.Set(ip, lowhost)
hostToIP[lowhost] = ip
</s> add continue </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Error("dns: getting custom upstreams for client %s: %s", id, err)
</s> add log.Error("dnsforward: getting custom upstreams for client %s: %s", id, err) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep replace replace keep keep replace | <mask> lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix)
<mask> ip := slices.Clone(l.IP)
<mask>
<mask> ipToHost.Set(ip, lowhost)
<mask> hostToIP[lowhost] = ip
<mask> }
<mask>
<mask> log.Debug("dns: added %d A/PTR entries from DHCP", ipToHost.Len())
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix)
ip := slices.Clone(l.IP)
</s> add // Assume that we only process IPv4 now.
//
// TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4)
if err != nil {
log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err) </s> remove for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err = netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug(
"dns: skipping invalid hostname %q from dhcp: %s",
l.Hostname,
err,
)
}
</s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) </s> add log.Debug("dnsforward: added %d a and ptr entries from dhcp", len(ipToHost)) </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove knownIP := net.IP{1, 2, 3, 4}
</s> add knownIP := netip.MustParseAddr("1.2.3.4") | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep add keep keep keep keep keep | <mask> }
<mask>
<mask> s.setTableHostToIP(hostToIP)
<mask> s.setTableIPToHost(ipToHost)
<mask> }
<mask>
<mask> // processDDRQuery responds to Discovery of Designated Resolvers (DDR) SVCB
<mask> // queries. The response contains different types of encryption supported by
<mask> // current user configuration.
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: added %d A/PTR entries from DHCP", ipToHost.Len())
</s> add ipToHost[ip] = lowhost
hostToIP[lowhost] = ip </s> remove // hostToIPTable is an alias for the type of Server.tableHostToIP.
type hostToIPTable = map[string]net.IP
</s> add // hostToIPTable is a convenient type alias for tables of host names to an IP
// address.
type hostToIPTable = map[string]netip.Addr
// ipToHostTable is a convenient type alias for tables of IP addresses to their
// host names. For example, for use with PTR queries.
type ipToHostTable = map[netip.Addr]string </s> remove return host, true
</s> add return host, ok </s> remove log.Debug("dns: parsing reversed addr: %s", err)
</s> add log.Debug("dnsforward: parsing reversed addr: %s", err) </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap].
</s> add </s> remove if s.tableIPToHost == nil {
return "", false
}
var v any
v, ok = s.tableIPToHost.Get(ip)
if !ok {
return "", false
}
if host, ok = v.(string); !ok {
log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)
return "", false
}
</s> add host, ok = s.tableIPToHost[ip] | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep replace keep keep keep replace replace replace keep keep keep | <mask> // dhcpHostToIP tries to get an IP leased by DHCP and returns the copy of
<mask> // address since the data inside the internal table may be changed while request
<mask> // processing. It's safe for concurrent use.
<mask> func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) {
<mask> s.tableHostToIPLock.Lock()
<mask> defer s.tableHostToIPLock.Unlock()
<mask>
<mask> if s.tableHostToIP == nil {
<mask> return nil, false
<mask> }
<mask>
<mask> var ipFromTable net.IP
<mask> ipFromTable, ok = s.tableHostToIP[host]
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) {
</s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { </s> remove var ipFromTable net.IP
ipFromTable, ok = s.tableHostToIP[host]
if !ok {
return nil, false
}
ip = make(net.IP, len(ipFromTable))
copy(ip, ipFromTable)
return ip, true
</s> add return ip, ok </s> remove if s.tableIPToHost == nil {
return "", false
}
var v any
v, ok = s.tableIPToHost.Get(ip)
if !ok {
return "", false
}
if host, ok = v.(string); !ok {
log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)
return "", false
}
</s> add host, ok = s.tableIPToHost[ip] </s> remove return host, true
</s> add return host, ok </s> remove func (s *Server) setTableIPToHost(t *netutil.IPMap) {
</s> add func (s *Server) setTableIPToHost(t ipToHostTable) { | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep | <mask> if s.tableHostToIP == nil {
<mask> return nil, false
<mask> }
<mask>
<mask> var ipFromTable net.IP
<mask> ipFromTable, ok = s.tableHostToIP[host]
<mask> if !ok {
<mask> return nil, false
<mask> }
<mask>
<mask> ip = make(net.IP, len(ipFromTable))
<mask> copy(ip, ipFromTable)
<mask>
<mask> return ip, true
<mask> }
<mask>
<mask> // processDHCPHosts respond to A requests if the target hostname is known to
<mask> // the server.
<mask> //
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove if s.tableHostToIP == nil {
return nil, false
}
</s> add ip, ok = s.tableHostToIP[host] </s> remove if s.tableIPToHost == nil {
return "", false
}
var v any
v, ok = s.tableIPToHost.Get(ip)
if !ok {
return "", false
}
if host, ok = v.(string); !ok {
log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)
return "", false
}
</s> add host, ok = s.tableIPToHost[ip] </s> remove return host, true
</s> add return host, ok </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) {
</s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) { </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) {
</s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return resultCodeSuccess
<mask> }
<mask>
<mask> if !dctx.isLocalClient {
<mask> log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost)
<mask> pctx.Res = s.genNXDomain(req)
<mask>
<mask> // Do not even put into query log.
<mask> return resultCodeFinish
<mask> }
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: %q requests an internal ip", pctx.Addr)
</s> add log.Debug("dnsforward: %q requests an internal ip", pctx.Addr) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
</s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove log.Debug("dns: no dhcp record for %q", reqHost)
</s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove log.Debug("dns: dhcp reverse record for %s is %q", ip, host)
</s> add log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host) </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip)
</s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> ip, ok := s.dhcpHostToIP(reqHost)
<mask> if !ok {
<mask> // Go on and process them with filters, including dnsrewrite ones, and
<mask> // possibly route them to a domain-specific upstream.
<mask> log.Debug("dns: no dhcp record for %q", reqHost)
<mask>
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> log.Debug("dns: dhcp record for %q is %s", reqHost, ip)
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip)
</s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove log.Debug("dns: dhcp reverse record for %s is %q", ip, host)
</s> add log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host) </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost)
</s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
</s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove log.Debug("dns: validating service domain: %s", err)
</s> add log.Debug("dnsforward: validating service domain: %s", err) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> log.Debug("dns: dhcp record for %q is %s", reqHost, ip)
<mask>
<mask> resp := s.makeResponse(req)
<mask> if q.Qtype == dns.TypeA {
<mask> a := &dns.A{
<mask> Hdr: s.hdr(req, dns.TypeA),
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove A: ip,
</s> add A: ip.AsSlice(), </s> remove log.Debug("dns: dhcp reverse record for %s is %q", ip, host)
</s> add log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host) </s> remove log.Debug("dns: no dhcp record for %q", reqHost)
</s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost)
</s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
</s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> resp := s.makeResponse(req)
<mask> if q.Qtype == dns.TypeA {
<mask> a := &dns.A{
<mask> Hdr: s.hdr(req, dns.TypeA),
<mask> A: ip,
<mask> }
<mask> resp.Answer = append(resp.Answer, a)
<mask> }
<mask> dctx.proxyCtx.Res = resp
<mask>
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip)
</s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove log.Debug("dns: dhcp reverse record for %s is %q", ip, host)
</s> add log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host) </s> remove var ipFromTable net.IP
ipFromTable, ok = s.tableHostToIP[host]
if !ok {
return nil, false
}
ip = make(net.IP, len(ipFromTable))
copy(ip, ipFromTable)
return ip, true
</s> add return ip, ok </s> remove if tc.wantIP == nil {
</s> add if tc.wantIP == (netip.Addr{}) { </s> remove } else if tc.wantIP == nil {
</s> add } else if tc.wantIP == (netip.Addr{}) { </s> remove if s.tableHostToIP == nil {
return nil, false
}
</s> add ip, ok = s.tableHostToIP[host] | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> ip, err := netutil.IPFromReversedAddr(q.Name)
<mask> if err != nil {
<mask> log.Debug("dns: parsing reversed addr: %s", err)
<mask>
<mask> // DNS-Based Service Discovery uses PTR records having not an ARPA
<mask> // format of the domain name in question. Those shouldn't be
<mask> // invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
<mask> // RFC 2782.
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: validating service domain: %s", err)
</s> add log.Debug("dnsforward: validating service domain: %s", err) </s> remove log.Error("dns: getting custom upstreams for client %s: %s", id, err)
</s> add log.Error("dnsforward: getting custom upstreams for client %s: %s", id, err) </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix)
ip := slices.Clone(l.IP)
</s> add // Assume that we only process IPv4 now.
//
// TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4)
if err != nil {
log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
</s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove var hostToIP hostToIPTable
var ipToHost *netutil.IPMap
if add {
ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
</s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
hostToIP := make(hostToIPTable, len(ll))
ipToHost := make(ipToHostTable, len(ll))
for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err := netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
<mask> // RFC 2782.
<mask> name := strings.TrimSuffix(q.Name, ".")
<mask> if err = netutil.ValidateSRVDomainName(name); err != nil {
<mask> log.Debug("dns: validating service domain: %s", err)
<mask>
<mask> return resultCodeError
<mask> }
<mask>
<mask> log.Debug("dns: request is for a service domain")
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: request is for a service domain")
</s> add log.Debug("dnsforward: request is for a service domain") </s> remove log.Debug("dns: parsing reversed addr: %s", err)
</s> add log.Debug("dnsforward: parsing reversed addr: %s", err) </s> remove log.Error("dns: getting custom upstreams for client %s: %s", id, err)
</s> add log.Error("dnsforward: getting custom upstreams for client %s: %s", id, err) </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Debug("dns: using custom upstreams for client %s", id)
</s> add log.Debug("dnsforward: using custom upstreams for client %s", id) </s> remove log.Debug("dns: no dhcp record for %q", reqHost)
</s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> return resultCodeError
<mask> }
<mask>
<mask> log.Debug("dns: request is for a service domain")
<mask>
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> // Restrict an access to local addresses for external clients. We also
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: addr %s is not from locally-served network", ip)
</s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> remove log.Debug("dns: validating service domain: %s", err)
</s> add log.Debug("dnsforward: validating service domain: %s", err) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
</s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip)
</s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove log.Debug("dns: no dhcp record for %q", reqHost)
</s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove log.Debug("dns: %q requests an internal ip", pctx.Addr)
</s> add log.Debug("dnsforward: %q requests an internal ip", pctx.Addr) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // Restrict an access to local addresses for external clients. We also
<mask> // assume that all the DHCP leases we give are locally-served or at least
<mask> // don't need to be accessible externally.
<mask> if !s.privateNets.Contains(ip) {
<mask> log.Debug("dns: addr %s is not from locally-served network", ip)
<mask>
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> if !dctx.isLocalClient {
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: request is for a service domain")
</s> add log.Debug("dnsforward: request is for a service domain") </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Debug("dns: %q requests an internal ip", pctx.Addr)
</s> add log.Debug("dnsforward: %q requests an internal ip", pctx.Addr) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
</s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove log.Debug("dns: dhcp reverse record for %s is %q", ip, host)
</s> add log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host) </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost)
</s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return resultCodeSuccess
<mask> }
<mask>
<mask> if !dctx.isLocalClient {
<mask> log.Debug("dns: %q requests an internal ip", pctx.Addr)
<mask> pctx.Res = s.genNXDomain(req)
<mask>
<mask> // Do not even put into query log.
<mask> return resultCodeFinish
<mask> }
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost)
</s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
</s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove log.Debug("dns: addr %s is not from locally-served network", ip)
</s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip)
</s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove log.Debug("dns: request is for a service domain")
</s> add log.Debug("dnsforward: request is for a service domain") </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep replace keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep | <mask>
<mask> // ipToDHCPHost tries to get a hostname leased by DHCP. It's safe for
<mask> // concurrent use.
<mask> func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) {
<mask> s.tableIPToHostLock.Lock()
<mask> defer s.tableIPToHostLock.Unlock()
<mask>
<mask> if s.tableIPToHost == nil {
<mask> return "", false
<mask> }
<mask>
<mask> var v any
<mask> v, ok = s.tableIPToHost.Get(ip)
<mask> if !ok {
<mask> return "", false
<mask> }
<mask>
<mask> if host, ok = v.(string); !ok {
<mask> log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)
<mask>
<mask> return "", false
<mask> }
<mask>
<mask> return host, true
<mask> }
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove return host, true
</s> add return host, ok </s> remove if s.tableHostToIP == nil {
return nil, false
}
</s> add ip, ok = s.tableHostToIP[host] </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) {
</s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) { </s> remove var ipFromTable net.IP
ipFromTable, ok = s.tableHostToIP[host]
if !ok {
return nil, false
}
ip = make(net.IP, len(ipFromTable))
copy(ip, ipFromTable)
return ip, true
</s> add return ip, ok </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> return "", false
<mask> }
<mask>
<mask> return host, true
<mask> }
<mask>
<mask> // processDHCPAddrs responds to PTR requests if the target IP is leased by the
<mask> // DHCP server.
<mask> func (s *Server) processDHCPAddrs(dctx *dnsContext) (rc resultCode) {
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove if s.tableIPToHost == nil {
return "", false
}
var v any
v, ok = s.tableIPToHost.Get(ip)
if !ok {
return "", false
}
if host, ok = v.(string); !ok {
log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)
return "", false
}
</s> add host, ok = s.tableIPToHost[ip] </s> remove var ipFromTable net.IP
ipFromTable, ok = s.tableHostToIP[host]
if !ok {
return nil, false
}
ip = make(net.IP, len(ipFromTable))
copy(ip, ipFromTable)
return ip, true
</s> add return ip, ok </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) {
</s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) {
</s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) { </s> remove if s.tableHostToIP == nil {
return nil, false
}
</s> add ip, ok = s.tableHostToIP[host] </s> remove func (s *Server) setTableIPToHost(t *netutil.IPMap) {
</s> add func (s *Server) setTableIPToHost(t ipToHostTable) { | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep replace keep keep keep keep replace keep keep keep keep | <mask> return resultCodeSuccess
<mask> }
<mask>
<mask> host, ok := s.ipToDHCPHost(ip)
<mask> if !ok {
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> log.Debug("dns: dhcp reverse record for %s is %q", ip, host)
<mask>
<mask> req := pctx.Req
<mask> resp := s.makeResponse(req)
<mask> ptr := &dns.PTR{
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip)
</s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove log.Debug("dns: no dhcp record for %q", reqHost)
</s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost)
</s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> remove A: ip,
</s> add A: ip.AsSlice(), </s> remove if s.tableIPToHost == nil {
return "", false
}
var v any
v, ok = s.tableIPToHost.Get(ip)
if !ok {
return "", false
}
if host, ok = v.(string); !ok {
log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)
return "", false
}
</s> add host, ok = s.tableIPToHost[ip] | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // Respond with an NXDOMAIN.
<mask> //
<mask> // TODO(a.garipov): Route such queries to a custom upstream for the
<mask> // local domain name if there is one.
<mask> log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
<mask> pctx.Res = s.genNXDomain(req)
<mask>
<mask> return resultCodeFinish
<mask> }
<mask>
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost)
</s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> remove log.Debug("dns: %q requests an internal ip", pctx.Addr)
</s> add log.Debug("dnsforward: %q requests an internal ip", pctx.Addr) </s> remove log.Debug("dns: no dhcp record for %q", reqHost)
</s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove log.Debug("dns: request is for a service domain")
</s> add log.Debug("dnsforward: request is for a service domain") </s> remove log.Debug("dns: using custom upstreams for client %s", id)
</s> add log.Debug("dnsforward: using custom upstreams for client %s", id) </s> remove log.Debug("dns: addr %s is not from locally-served network", ip)
</s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // Use the ClientID first, since it has a higher priority.
<mask> id := stringutil.Coalesce(clientID, ipStringFromAddr(pctx.Addr))
<mask> upsConf, err := customUpsByClient(id)
<mask> if err != nil {
<mask> log.Error("dns: getting custom upstreams for client %s: %s", id, err)
<mask>
<mask> return
<mask> }
<mask>
<mask> if upsConf != nil {
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: using custom upstreams for client %s", id)
</s> add log.Debug("dnsforward: using custom upstreams for client %s", id) </s> remove log.Debug("dns: validating service domain: %s", err)
</s> add log.Debug("dnsforward: validating service domain: %s", err) </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove var hostToIP hostToIPTable
var ipToHost *netutil.IPMap
if add {
ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
</s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
hostToIP := make(hostToIPTable, len(ll))
ipToHost := make(ipToHostTable, len(ll))
for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err := netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) </s> remove log.Debug("dns: parsing reversed addr: %s", err)
</s> add log.Debug("dnsforward: parsing reversed addr: %s", err) </s> remove for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err = netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug(
"dns: skipping invalid hostname %q from dhcp: %s",
l.Hostname,
err,
)
}
</s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return
<mask> }
<mask>
<mask> if upsConf != nil {
<mask> log.Debug("dns: using custom upstreams for client %s", id)
<mask> }
<mask>
<mask> pctx.CustomUpstreamConfig = upsConf
<mask> }
<mask>
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Error("dns: getting custom upstreams for client %s: %s", id, err)
</s> add log.Error("dnsforward: getting custom upstreams for client %s: %s", id, err) </s> remove log.Debug("dns: validating service domain: %s", err)
</s> add log.Debug("dnsforward: validating service domain: %s", err) </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
</s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove if s.tableIPToHost == nil {
return "", false
}
var v any
v, ok = s.tableIPToHost.Get(ip)
if !ok {
return "", false
}
if host, ok = v.(string); !ok {
log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)
return "", false
}
</s> add host, ok = s.tableIPToHost[ip] </s> remove var hostToIP hostToIPTable
var ipToHost *netutil.IPMap
if add {
ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
</s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
hostToIP := make(hostToIPTable, len(ll))
ipToHost := make(ipToHostTable, len(ll))
for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err := netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns.go |
keep add keep keep keep keep keep | <mask> import (
<mask> "net"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> add "github.com/AdguardTeam/golibs/testutil" </s> add "net/netip" </s> add "net/netip" </s> remove aghtest.DiscardLogOutput(m)
</s> add testutil.DiscardLogOutput(m) </s> remove github.com/AdguardTeam/golibs v0.11.0
</s> add github.com/AdguardTeam/golibs v0.11.2 </s> remove log.Debug("dns: no dhcp record for %q", reqHost)
</s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep add keep keep keep keep keep keep | <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/dnsproxy/upstream"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> "github.com/miekg/dns"
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> const (
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> add "net/netip" </s> remove aghtest.DiscardLogOutput(m)
</s> add testutil.DiscardLogOutput(m) </s> remove "golang.org/x/exp/slices"
</s> add </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap].
</s> add </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap].
</s> add </s> add "net/netip" | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep replace replace keep keep keep replace keep | <mask> }
<mask>
<mask> func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) {
<mask> knownIP := net.IP{1, 2, 3, 4}
<mask>
<mask> testCases := []struct {
<mask> name string
<mask> host string
<mask> wantIP net.IP
<mask> wantRes resultCode
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove knownIP := net.IP{1, 2, 3, 4}
</s> add knownIP := netip.MustParseAddr("1.2.3.4") </s> remove wantIP net.IP
</s> add wantIP netip.Addr </s> remove ptr, ok := resp.Answer[0].(*dns.PTR)
require.True(t, ok)
</s> add </s> remove if s.tableHostToIP == nil {
return nil, false
}
</s> add ip, ok = s.tableHostToIP[host] </s> remove func (s *Server) setTableIPToHost(t *netutil.IPMap) {
</s> add func (s *Server) setTableIPToHost(t ipToHostTable) { | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> isLocalCli: true,
<mask> }, {
<mask> name: "local_client_unknown_host",
<mask> host: "wronghost.lan",
<mask> wantIP: nil,
<mask> wantRes: resultCodeSuccess,
<mask> isLocalCli: true,
<mask> }, {
<mask> name: "external_client_known_host",
<mask> host: "example.lan",
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> isLocalCli: true,
<mask> }, {
<mask> name: "external_client_known_host",
<mask> host: "example.lan",
<mask> wantIP: nil,
<mask> wantRes: resultCodeFinish,
<mask> isLocalCli: false,
<mask> }, {
<mask> name: "external_client_unknown_host",
<mask> host: "wronghost.lan",
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> isLocalCli: false,
<mask> }, {
<mask> name: "external_client_unknown_host",
<mask> host: "wronghost.lan",
<mask> wantIP: nil,
<mask> wantRes: resultCodeFinish,
<mask> isLocalCli: false,
<mask> }}
<mask>
<mask> for _, tc := range testCases {
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> return
<mask> }
<mask>
<mask> if tc.wantIP == nil {
<mask> assert.Nil(t, pctx.Res)
<mask> } else {
<mask> require.NotNil(t, pctx.Res)
<mask>
<mask> ans := pctx.Res.Answer
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove } else if tc.wantIP == nil {
</s> add } else if tc.wantIP == (netip.Addr{}) { </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0])
ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4)
require.NoError(t, err)
assert.Equal(t, tc.wantIP, ip) </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0])
ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4)
require.NoError(t, err)
assert.Equal(t, tc.wantIP, ip) </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove var ipFromTable net.IP
ipFromTable, ok = s.tableHostToIP[host]
if !ok {
return nil, false
}
ip = make(net.IP, len(ipFromTable))
copy(ip, ipFromTable)
return ip, true
</s> add return ip, ok </s> remove if s.tableHostToIP == nil {
return nil, false
}
</s> add ip, ok = s.tableHostToIP[host] | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> ans := pctx.Res.Answer
<mask> require.Len(t, ans, 1)
<mask>
<mask> assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A)
<mask> }
<mask> })
<mask> }
<mask> }
<mask>
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0])
ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4)
require.NoError(t, err)
assert.Equal(t, tc.wantIP, ip) </s> remove } else if tc.wantIP == nil {
</s> add } else if tc.wantIP == (netip.Addr{}) { </s> remove assert.Equal(t, dns.TypePTR, resp.Answer[0].Header().Rrtype)
assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name)
</s> add ans := resp.Answer[0]
assert.Equal(t, dns.TypePTR, ans.Header().Rrtype)
assert.Equal(t, "34.12.168.192.in-addr.arpa.", ans.Header().Name)
ptr := testutil.RequireTypeAssert[*dns.PTR](t, ans) </s> remove if tc.wantIP == nil {
</s> add if tc.wantIP == (netip.Addr{}) { </s> remove ptr, ok := resp.Answer[0].(*dns.PTR)
require.True(t, ok)
</s> add </s> remove log.Debug("dns: added %d A/PTR entries from DHCP", ipToHost.Len())
</s> add ipToHost[ip] = lowhost
hostToIP[lowhost] = ip | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep replace keep keep keep keep replace | <mask> examplelan = "example." + defaultLocalDomainSuffix
<mask> )
<mask>
<mask> knownIP := net.IP{1, 2, 3, 4}
<mask> testCases := []struct {
<mask> name string
<mask> host string
<mask> suffix string
<mask> wantIP net.IP
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove knownIP := net.IP{1, 2, 3, 4}
</s> add knownIP := netip.MustParseAddr("1.2.3.4") </s> remove wantIP net.IP
</s> add wantIP netip.Addr </s> remove for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err = netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug(
"dns: skipping invalid hostname %q from dhcp: %s",
l.Hostname,
err,
)
}
</s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) </s> remove lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix)
ip := slices.Clone(l.IP)
</s> add // Assume that we only process IPv4 now.
//
// TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4)
if err != nil {
log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err) </s> remove ipToHost.Set(ip, lowhost)
hostToIP[lowhost] = ip
</s> add continue | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }{{
<mask> name: "success_external",
<mask> host: examplecom,
<mask> suffix: defaultLocalDomainSuffix,
<mask> wantIP: nil,
<mask> wantRes: resultCodeSuccess,
<mask> qtyp: dns.TypeA,
<mask> }, {
<mask> name: "success_external_non_a",
<mask> host: examplecom,
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP net.IP
</s> add wantIP netip.Addr | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }, {
<mask> name: "success_external_non_a",
<mask> host: examplecom,
<mask> suffix: defaultLocalDomainSuffix,
<mask> wantIP: nil,
<mask> wantRes: resultCodeSuccess,
<mask> qtyp: dns.TypeCNAME,
<mask> }, {
<mask> name: "success_internal",
<mask> host: examplelan,
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }, {
<mask> name: "success_internal_unknown",
<mask> host: "example-new.lan",
<mask> suffix: defaultLocalDomainSuffix,
<mask> wantIP: nil,
<mask> wantRes: resultCodeSuccess,
<mask> qtyp: dns.TypeA,
<mask> }, {
<mask> name: "success_internal_aaaa",
<mask> host: examplelan,
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }, {
<mask> name: "success_internal_aaaa",
<mask> host: examplelan,
<mask> suffix: defaultLocalDomainSuffix,
<mask> wantIP: nil,
<mask> wantRes: resultCodeSuccess,
<mask> qtyp: dns.TypeAAAA,
<mask> }, {
<mask> name: "success_custom_suffix",
<mask> host: "example.custom",
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, </s> remove wantIP: nil,
</s> add wantIP: netip.Addr{}, | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> require.NotNil(t, pctx.Res)
<mask>
<mask> ans := pctx.Res.Answer
<mask> require.Len(t, ans, 0)
<mask> } else if tc.wantIP == nil {
<mask> assert.Nil(t, pctx.Res)
<mask> } else {
<mask> require.NotNil(t, pctx.Res)
<mask>
<mask> ans := pctx.Res.Answer
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove if tc.wantIP == nil {
</s> add if tc.wantIP == (netip.Addr{}) { </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0])
ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4)
require.NoError(t, err)
assert.Equal(t, tc.wantIP, ip) </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0])
ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4)
require.NoError(t, err)
assert.Equal(t, tc.wantIP, ip) </s> remove assert.Equal(t, dns.TypePTR, resp.Answer[0].Header().Rrtype)
assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name)
</s> add ans := resp.Answer[0]
assert.Equal(t, dns.TypePTR, ans.Header().Rrtype)
assert.Equal(t, "34.12.168.192.in-addr.arpa.", ans.Header().Name)
ptr := testutil.RequireTypeAssert[*dns.PTR](t, ans) </s> remove host, ok := s.ipToDHCPHost(ip)
</s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ipAddr, err := netutil.IPToAddrNoMapped(ip)
if err != nil {
log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err)
return resultCodeSuccess
}
host, ok := s.ipToDHCPHost(ipAddr) </s> remove A: ip,
</s> add A: ip.AsSlice(), | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> ans := pctx.Res.Answer
<mask> require.Len(t, ans, 1)
<mask>
<mask> assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A)
<mask> }
<mask> })
<mask> }
<mask> }
<mask>
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dns_test.go |
keep keep keep add keep keep keep keep keep keep | <mask> import (
<mask> "fmt"
<mask> "net"
<mask> "net/http"
<mask> "runtime"
<mask> "strings"
<mask> "sync"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghalg"
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> add "net/netip" </s> add "net/netip" </s> add "github.com/AdguardTeam/golibs/testutil" </s> remove aghtest.DiscardLogOutput(m)
</s> add testutil.DiscardLogOutput(m) </s> remove github.com/AdguardTeam/golibs v0.11.0
</s> add github.com/AdguardTeam/golibs v0.11.2 </s> remove log.Debug("dns: no dhcp record for %q", reqHost)
</s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dnsforward.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> "github.com/AdguardTeam/golibs/stringutil"
<mask> "github.com/miekg/dns"
<mask> )
<mask>
<mask> //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap].
<mask>
<mask> // DefaultTimeout is the default upstream timeout
<mask> const DefaultTimeout = 10 * time.Second
<mask>
<mask> // defaultClientIDCacheCount is the default count of items in the LRU ClientID
<mask> // cache. The assumption here is that there won't be more than this many
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove "golang.org/x/exp/slices"
</s> add </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap].
</s> add </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost)
</s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove // hostToIPTable is an alias for the type of Server.tableHostToIP.
type hostToIPTable = map[string]net.IP
</s> add // hostToIPTable is a convenient type alias for tables of host names to an IP
// address.
type hostToIPTable = map[string]netip.Addr
// ipToHostTable is a convenient type alias for tables of IP addresses to their
// host names. For example, for use with PTR queries.
type ipToHostTable = map[netip.Addr]string </s> remove aghtest.DiscardLogOutput(m)
</s> add testutil.DiscardLogOutput(m) </s> remove log.Debug("dns: addr %s is not from locally-served network", ip)
</s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dnsforward.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> var defaultBlockedHosts = []string{"version.bind", "id.server", "hostname.bind"}
<mask>
<mask> var webRegistered bool
<mask>
<mask> // hostToIPTable is an alias for the type of Server.tableHostToIP.
<mask> type hostToIPTable = map[string]net.IP
<mask>
<mask> // Server is the main way to start a DNS server.
<mask> //
<mask> // Example:
<mask> //
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove var ipFromTable net.IP
ipFromTable, ok = s.tableHostToIP[host]
if !ok {
return nil, false
}
ip = make(net.IP, len(ipFromTable))
copy(ip, ipFromTable)
return ip, true
</s> add return ip, ok </s> remove add = false
</s> add s.setTableHostToIP(nil)
s.setTableIPToHost(nil)
return </s> remove if s.tableIPToHost == nil {
return "", false
}
var v any
v, ok = s.tableIPToHost.Get(ip)
if !ok {
return "", false
}
if host, ok = v.(string); !ok {
log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)
return "", false
}
</s> add host, ok = s.tableIPToHost[ip] </s> remove // TODO(e.burkov): Use map[netip.Addr]struct{} instead.
tableIPToHost *netutil.IPMap
</s> add tableIPToHost ipToHostTable </s> remove var hostToIP hostToIPTable
var ipToHost *netutil.IPMap
if add {
ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
</s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
hostToIP := make(hostToIPTable, len(ll))
ipToHost := make(ipToHostTable, len(ll))
for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err := netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap].
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dnsforward.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask>
<mask> tableHostToIP hostToIPTable
<mask> tableHostToIPLock sync.Mutex
<mask>
<mask> // TODO(e.burkov): Use map[netip.Addr]struct{} instead.
<mask> tableIPToHost *netutil.IPMap
<mask> tableIPToHostLock sync.Mutex
<mask>
<mask> // clientIDCache is a temporary storage for ClientIDs that were extracted
<mask> // during the BeforeRequestHandler stage.
<mask> clientIDCache cache.Cache
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove // hostToIPTable is an alias for the type of Server.tableHostToIP.
type hostToIPTable = map[string]net.IP
</s> add // hostToIPTable is a convenient type alias for tables of host names to an IP
// address.
type hostToIPTable = map[string]netip.Addr
// ipToHostTable is a convenient type alias for tables of IP addresses to their
// host names. For example, for use with PTR queries.
type ipToHostTable = map[netip.Addr]string </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap].
</s> add </s> remove log.Error("dns: getting custom upstreams for client %s: %s", id, err)
</s> add log.Error("dnsforward: getting custom upstreams for client %s: %s", id, err) </s> remove var hostToIP hostToIPTable
var ipToHost *netutil.IPMap
if add {
ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
</s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
hostToIP := make(hostToIPTable, len(ll))
ipToHost := make(ipToHostTable, len(ll))
for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished with the client
// hostname validations in the DHCP server code.
err := netutil.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) </s> remove log.Debug("dns: request is for a service domain")
</s> add log.Debug("dnsforward: request is for a service domain") </s> remove log.Debug("dns: addr %s is not from locally-served network", ip)
</s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip) | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dnsforward.go |
keep keep keep keep replace keep keep keep keep keep | <mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> func TestMain(m *testing.M) {
<mask> aghtest.DiscardLogOutput(m)
<mask> }
<mask>
<mask> const (
<mask> tlsServerName = "testdns.adguard.com"
<mask> testMessagesCount = 10
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> add "github.com/AdguardTeam/golibs/testutil" </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap].
</s> add </s> remove func (s *Server) setTableIPToHost(t *netutil.IPMap) {
</s> add func (s *Server) setTableIPToHost(t ipToHostTable) { </s> add //
// TODO(a.garipov): Replace with testutil. </s> remove var err error
add := true
</s> add </s> remove if s.tableHostToIP == nil {
return nil, false
}
</s> add ip, ok = s.tableHostToIP[host] | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> require.NoErrorf(t, err, "%s", addr)
<mask>
<mask> require.Len(t, resp.Answer, 1)
<mask>
<mask> assert.Equal(t, dns.TypePTR, resp.Answer[0].Header().Rrtype)
<mask> assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name)
<mask>
<mask> ptr, ok := resp.Answer[0].(*dns.PTR)
<mask> require.True(t, ok)
<mask> assert.Equal(t, dns.Fqdn("myhost."+localDomain), ptr.Ptr)
<mask> }
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove ptr, ok := resp.Answer[0].(*dns.PTR)
require.True(t, ok)
</s> add </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0])
ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4)
require.NoError(t, err)
assert.Equal(t, tc.wantIP, ip) </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0])
ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4)
require.NoError(t, err)
assert.Equal(t, tc.wantIP, ip) </s> remove } else if tc.wantIP == nil {
</s> add } else if tc.wantIP == (netip.Addr{}) { </s> remove lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix)
ip := slices.Clone(l.IP)
</s> add // Assume that we only process IPv4 now.
//
// TODO(a.garipov): Remove once we switch to netip.Addr more fully.
ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4)
if err != nil {
log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err) </s> remove if s.tableIPToHost == nil {
return "", false
}
var v any
v, ok = s.tableIPToHost.Get(ip)
if !ok {
return "", false
}
if host, ok = v.(string); !ok {
log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)
return "", false
}
</s> add host, ok = s.tableIPToHost[ip] | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask>
<mask> assert.Equal(t, dns.TypePTR, resp.Answer[0].Header().Rrtype)
<mask> assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name)
<mask>
<mask> ptr, ok := resp.Answer[0].(*dns.PTR)
<mask> require.True(t, ok)
<mask> assert.Equal(t, dns.Fqdn("myhost."+localDomain), ptr.Ptr)
<mask> }
<mask>
<mask> func TestPTRResponseFromHosts(t *testing.T) {
<mask> // Prepare test hosts file.
</s> Pull request: 5035-dhcp-hosts-netip-addr
Updates #5035.
Squashed commit of the following:
commit 3a272842f738da322abb2bc5306aed94da79304b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 20:34:49 2022 +0300
dnsforward: imp docs, tests
commit b442ca9b57d730be3af14c68759c706f1742e4c4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 19:51:21 2022 +0300
dnsforward: imp code, tests
commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Oct 26 16:38:27 2022 +0300
dnsforward: mv dhcp hosts to netip.Addr </s> remove assert.Equal(t, dns.TypePTR, resp.Answer[0].Header().Rrtype)
assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name)
</s> add ans := resp.Answer[0]
assert.Equal(t, dns.TypePTR, ans.Header().Rrtype)
assert.Equal(t, "34.12.168.192.in-addr.arpa.", ans.Header().Name)
ptr := testutil.RequireTypeAssert[*dns.PTR](t, ans) </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0])
ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4)
require.NoError(t, err)
assert.Equal(t, tc.wantIP, ip) </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0])
ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4)
require.NoError(t, err)
assert.Equal(t, tc.wantIP, ip) </s> remove knownIP := net.IP{1, 2, 3, 4}
</s> add knownIP := netip.MustParseAddr("1.2.3.4") </s> remove if s.tableHostToIP == nil {
return nil, false
}
</s> add ip, ok = s.tableHostToIP[host] </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) {
</s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { | https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> go 1.14
<mask>
<mask> require (
<mask> github.com/AdguardTeam/dnsproxy v0.33.2
<mask> github.com/AdguardTeam/golibs v0.4.2
<mask> github.com/AdguardTeam/urlfilter v0.12.3
<mask> github.com/NYTimes/gziphandler v1.1.1
<mask> github.com/beefsack/go-rate v0.0.0-20200827232406-6cde80facd47 // indirect
<mask> github.com/fsnotify/fsnotify v1.4.9
<mask> github.com/gobuffalo/packr v1.30.1
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add github.com/AdguardTeam/golibs v0.4.3 h1:nXTLLLlIyU4BSRF0An5azS0uimSK/YpIMOBAO0/v1RY=
github.com/AdguardTeam/golibs v0.4.3/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= </s> remove github.com/AdguardTeam/dnsproxy v0.33.1 h1:rEAS1fBEQ3JslzsfkcyMRV96OeBWFnKzXvksduI0ous=
github.com/AdguardTeam/dnsproxy v0.33.1/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA=
</s> add </s> add "github.com/miekg/dns" </s> add "io" </s> add "bytes"
"strings" </s> add "strings" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | go.mod |
keep keep keep keep replace replace keep keep keep keep keep | <mask> dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU=
<mask> dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
<mask> dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
<mask> git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
<mask> github.com/AdguardTeam/dnsproxy v0.33.1 h1:rEAS1fBEQ3JslzsfkcyMRV96OeBWFnKzXvksduI0ous=
<mask> github.com/AdguardTeam/dnsproxy v0.33.1/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA=
<mask> github.com/AdguardTeam/dnsproxy v0.33.2 h1:k5aMcsw3TA/G2DR8EjIkwutDPuuRkKh8xij4cFWC6Fk=
<mask> github.com/AdguardTeam/dnsproxy v0.33.2/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA=
<mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.4.2 h1:7M28oTZFoFwNmp8eGPb3ImmYbxGaJLyQXeIFVHjME0o=
<mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add github.com/AdguardTeam/golibs v0.4.3 h1:nXTLLLlIyU4BSRF0An5azS0uimSK/YpIMOBAO0/v1RY=
github.com/AdguardTeam/golibs v0.4.3/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= </s> remove github.com/AdguardTeam/golibs v0.4.2
</s> add github.com/AdguardTeam/golibs v0.4.3 </s> remove Question: &q,
Answer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream",
</s> add Question: &q,
Answer: &a,
OrigAnswer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream", </s> remove golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 h1:42cLlJJdEh+ySyeUUbEQ5bsTiq8voBeTuweGVkY6Puw=
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
</s> add </s> remove golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf h1:kt3wY1Lu5MJAnKTfoMR52Cu4gwvna4VTzNOiT8tY73s=
golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
</s> add </s> add "bytes" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | go.sum |
keep keep keep add keep keep keep keep keep keep | <mask> github.com/AdguardTeam/dnsproxy v0.33.2/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA=
<mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.4.2 h1:7M28oTZFoFwNmp8eGPb3ImmYbxGaJLyQXeIFVHjME0o=
<mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU=
<mask> github.com/AdguardTeam/urlfilter v0.12.3 h1:FMjQG0eTgrr8xA3z2zaLVcCgGdpzoECPGWwgPjtwPNs=
<mask> github.com/AdguardTeam/urlfilter v0.12.3/go.mod h1:1fcCQx5TGJANrQN6sHNNM9KPBl7qx7BJml45ko6vru0=
<mask> github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
<mask> github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
<mask> github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> remove github.com/AdguardTeam/dnsproxy v0.33.1 h1:rEAS1fBEQ3JslzsfkcyMRV96OeBWFnKzXvksduI0ous=
github.com/AdguardTeam/dnsproxy v0.33.1/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA=
</s> add </s> remove github.com/AdguardTeam/golibs v0.4.2
</s> add github.com/AdguardTeam/golibs v0.4.3 </s> remove Question: &q,
Answer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream",
</s> add Question: &q,
Answer: &a,
OrigAnswer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream", </s> remove golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 h1:42cLlJJdEh+ySyeUUbEQ5bsTiq8voBeTuweGVkY6Puw=
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
</s> add </s> remove golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf h1:kt3wY1Lu5MJAnKTfoMR52Cu4gwvna4VTzNOiT8tY73s=
golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
</s> add </s> add "bytes" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | go.sum |
keep keep keep keep replace replace keep keep keep keep keep | <mask> golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
<mask> golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
<mask> golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
<mask> golang.org/x/net v0.0.0-20201016165138-7b1cca2348c0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
<mask> golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 h1:42cLlJJdEh+ySyeUUbEQ5bsTiq8voBeTuweGVkY6Puw=
<mask> golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
<mask> golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
<mask> golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
<mask> golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
<mask> golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
<mask> golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add "io" </s> remove Question: &q,
Answer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream",
</s> add Question: &q,
Answer: &a,
OrigAnswer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream", </s> remove github.com/AdguardTeam/dnsproxy v0.33.1 h1:rEAS1fBEQ3JslzsfkcyMRV96OeBWFnKzXvksduI0ous=
github.com/AdguardTeam/dnsproxy v0.33.1/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA=
</s> add </s> add github.com/AdguardTeam/golibs v0.4.3 h1:nXTLLLlIyU4BSRF0An5azS0uimSK/YpIMOBAO0/v1RY=
github.com/AdguardTeam/golibs v0.4.3/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= </s> remove golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf h1:kt3wY1Lu5MJAnKTfoMR52Cu4gwvna4VTzNOiT8tY73s=
golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
</s> add </s> add "bytes" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | go.sum |
keep keep keep keep replace replace keep keep keep keep keep | <mask> golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7NkNAQs+6Q8b9WEB/F4=
<mask> golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf h1:kt3wY1Lu5MJAnKTfoMR52Cu4gwvna4VTzNOiT8tY73s=
<mask> golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20201109165425-215b40eba54c h1:+B+zPA6081G5cEb2triOIJpcvSW4AYzmIyWAqMn2JAc=
<mask> golang.org/x/sys v0.0.0-20201109165425-215b40eba54c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
<mask> golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
<mask> golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add "io" </s> remove Question: &q,
Answer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream",
</s> add Question: &q,
Answer: &a,
OrigAnswer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream", </s> remove github.com/AdguardTeam/dnsproxy v0.33.1 h1:rEAS1fBEQ3JslzsfkcyMRV96OeBWFnKzXvksduI0ous=
github.com/AdguardTeam/dnsproxy v0.33.1/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA=
</s> add </s> add github.com/AdguardTeam/golibs v0.4.3 h1:nXTLLLlIyU4BSRF0An5azS0uimSK/YpIMOBAO0/v1RY=
github.com/AdguardTeam/golibs v0.4.3/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= </s> remove golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 h1:42cLlJJdEh+ySyeUUbEQ5bsTiq8voBeTuweGVkY6Puw=
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
</s> add </s> add "bytes" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | go.sum |
keep keep add keep keep keep keep | <mask> package dnsfilter
<mask>
<mask> import (
<mask> "fmt"
<mask> "net"
<mask> "strings"
<mask> "testing"
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add "strings" </s> add "io" </s> add "bytes"
"strings" </s> add "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log" </s> remove github.com/AdguardTeam/golibs v0.4.2
</s> add github.com/AdguardTeam/golibs v0.4.3 | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/dnsfilter/dnsfilter_test.go |
keep keep keep add keep keep keep keep | <mask> import (
<mask> "bytes"
<mask> "fmt"
<mask> "net"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/testutil"
<mask> "github.com/AdguardTeam/golibs/log"
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add "bytes" </s> add "bytes"
"strings" </s> add "github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log" </s> add "io" </s> add "github.com/AdguardTeam/golibs/log" </s> add "github.com/AdguardTeam/AdGuardHome/internal/agherr" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/dnsfilter/dnsfilter_test.go |
keep add keep keep keep keep | <mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/testutil"
<mask> "github.com/AdguardTeam/urlfilter/rules"
<mask> "github.com/miekg/dns"
<mask> "github.com/stretchr/testify/assert"
<mask> )
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log" </s> add "bytes"
"strings" </s> add "github.com/miekg/dns" </s> add "strings" </s> add "io" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/dnsfilter/dnsfilter_test.go |
keep add keep keep keep keep | <mask>
<mask> func TestSafeBrowsing(t *testing.T) {
<mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
<mask> defer d.Close()
<mask> gctx.stats.Safebrowsing.Requests = 0
<mask> d.checkMatch(t, "wmconvirus.narod.ru")
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add assert.True(t, strings.Contains(logOutput.String(), "SafeBrowsing lookup for wmconvirus.narod.ru"))
</s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add assert.True(t, strings.Contains(logOutput.String(), "Parental lookup for pornhub.com")) </s> add s.conf.ConfigModified = func() {}
</s> add "github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log" </s> add "github.com/miekg/dns" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/dnsfilter/dnsfilter_test.go |
keep keep keep add keep keep keep keep | <mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
<mask> defer d.Close()
<mask> gctx.stats.Safebrowsing.Requests = 0
<mask> d.checkMatch(t, "wmconvirus.narod.ru")
<mask> d.checkMatch(t, "test.wmconvirus.narod.ru")
<mask> d.checkMatchEmpty(t, "yandex.ru")
<mask> d.checkMatchEmpty(t, "pornhub.com")
<mask>
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add assert.True(t, strings.Contains(logOutput.String(), "Parental lookup for pornhub.com")) </s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add s.conf.ConfigModified = func() {}
</s> remove res := dnsfilter.Result{}
</s> add res := dnsfilter.Result{
IsFiltered: true,
Rule: "SomeRule",
Reason: dnsfilter.ReasonRewrite,
ServiceName: "SomeService",
FilterID: 1,
} </s> remove Question: &q,
Answer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream",
</s> add Question: &q,
Answer: &a,
OrigAnswer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream", | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/dnsfilter/dnsfilter_test.go |
keep keep keep add keep keep keep keep keep keep | <mask>
<mask> // PARENTAL
<mask>
<mask> func TestParentalControl(t *testing.T) {
<mask> d := NewForTest(&Config{ParentalEnabled: true}, nil)
<mask> defer d.Close()
<mask> d.checkMatch(t, "pornhub.com")
<mask> assert.True(t, strings.Contains(logOutput.String(), "Parental lookup for pornhub.com"))
<mask> d.checkMatch(t, "www.pornhub.com")
<mask> d.checkMatchEmpty(t, "www.yandex.ru")
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add assert.True(t, strings.Contains(logOutput.String(), "Parental lookup for pornhub.com")) </s> add assert.True(t, strings.Contains(logOutput.String(), "SafeBrowsing lookup for wmconvirus.narod.ru"))
</s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add "github.com/miekg/dns" </s> add s.conf.ConfigModified = func() {}
</s> add "github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/dnsfilter/dnsfilter_test.go |
keep keep keep add keep keep keep keep keep keep | <mask>
<mask> d := NewForTest(&Config{ParentalEnabled: true}, nil)
<mask> defer d.Close()
<mask> d.checkMatch(t, "pornhub.com")
<mask> d.checkMatch(t, "www.pornhub.com")
<mask> d.checkMatchEmpty(t, "www.yandex.ru")
<mask> d.checkMatchEmpty(t, "yandex.ru")
<mask> d.checkMatchEmpty(t, "api.jquery.com")
<mask>
<mask> // test cached result
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add assert.True(t, strings.Contains(logOutput.String(), "SafeBrowsing lookup for wmconvirus.narod.ru"))
</s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add "github.com/miekg/dns" </s> remove github.com/AdguardTeam/golibs v0.4.2
</s> add github.com/AdguardTeam/golibs v0.4.3 </s> add s.conf.ConfigModified = func() {}
| https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/dnsfilter/dnsfilter_test.go |
keep keep keep add keep keep keep keep keep | <mask> "crypto/sha256"
<mask> "strings"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/golibs/cache"
<mask> "github.com/miekg/dns"
<mask> "github.com/stretchr/testify/assert"
<mask> )
<mask>
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add "github.com/miekg/dns" </s> add "bytes"
"strings" </s> add "github.com/AdguardTeam/golibs/log" </s> add "github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log" </s> add "bytes" </s> add "strings" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/dnsfilter/sb_pc_test.go |
keep add keep keep keep keep keep keep | <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr"
<mask> "github.com/AdguardTeam/golibs/cache"
<mask> "github.com/stretchr/testify/assert"
<mask> )
<mask>
<mask> func TestSafeBrowsingHash(t *testing.T) {
<mask> // test hostnameToHashes()
<mask> hashes := hostnameToHashes("1.2.3.sub.host.com")
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log" </s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add assert.True(t, strings.Contains(logOutput.String(), "Parental lookup for pornhub.com")) </s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add "github.com/AdguardTeam/golibs/log" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/dnsfilter/sb_pc_test.go |
keep keep keep add keep keep keep keep keep keep | <mask> s.conf.UDPListenAddr = &net.UDPAddr{Port: 0}
<mask> s.conf.TCPListenAddr = &net.TCPAddr{Port: 0}
<mask> s.conf.UpstreamDNS = []string{"8.8.8.8:53", "8.8.4.4:53"}
<mask> s.conf.FilteringConfig.ProtectionEnabled = true
<mask> err := s.Prepare(nil)
<mask> assert.True(t, err == nil)
<mask> return s
<mask> }
<mask>
<mask> func createServerTLSConfig(t *testing.T) (*tls.Config, []byte, []byte) {
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> remove Question: &q,
Answer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream",
</s> add Question: &q,
Answer: &a,
OrigAnswer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream", </s> remove res := dnsfilter.Result{}
</s> add res := dnsfilter.Result{
IsFiltered: true,
Rule: "SomeRule",
Reason: dnsfilter.ReasonRewrite,
ServiceName: "SomeService",
FilterID: 1,
} </s> add assert.True(t, strings.Contains(logOutput.String(), "SafeBrowsing lookup for wmconvirus.narod.ru"))
</s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add "github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/dnsforward/dnsforward_test.go |
keep add keep keep keep keep keep keep | <mask>
<mask> import (
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/testutil"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/stretchr/testify/assert"
<mask> )
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add "strings" </s> add "github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log" </s> add "github.com/AdguardTeam/golibs/log" </s> add "io" </s> add "bytes" </s> add "github.com/AdguardTeam/AdGuardHome/internal/agherr" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/querylog/decode_test.go |
keep add keep keep keep keep | <mask> "testing"
<mask>
<mask> "github.com/stretchr/testify/assert"
<mask> )
<mask>
<mask> func TestDecode_decodeQueryLog(t *testing.T) {
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add "github.com/miekg/dns" </s> add "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "bytes"
"strings" </s> add "github.com/AdguardTeam/golibs/log" </s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
| https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/querylog/decode_test.go |
keep replace keep replace replace replace replace replace keep | <mask> a.Answer = append(a.Answer, answer)
<mask> res := dnsfilter.Result{}
<mask> params := AddParams{
<mask> Question: &q,
<mask> Answer: &a,
<mask> Result: &res,
<mask> ClientIP: net.ParseIP(client),
<mask> Upstream: "upstream",
<mask> }
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add s.conf.ConfigModified = func() {}
</s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add assert.True(t, strings.Contains(logOutput.String(), "SafeBrowsing lookup for wmconvirus.narod.ru"))
</s> add logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
</s> add "github.com/miekg/dns" | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/querylog/qlog_test.go |
keep keep add keep keep keep keep | <mask> package testutil
<mask>
<mask> import (
<mask> "io/ioutil"
<mask> "os"
<mask> "testing"
<mask>
</s> Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master
Updates #2271.
Squashed commit of the following:
commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 19:23:09 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 18:26:51 2020 +0300
all: clean dependencies sum
commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:46:00 2020 +0300
testutil: improve code quality
commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 16:29:49 2020 +0300
testutil: enhance functionality
commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 15:57:37 2020 +0300
Merge branch 'master' into 2271-cover-with-tests
commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 14:55:15 2020 +0300
querylog: replace fake log with real in tests
commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Nov 16 12:38:59 2020 +0300
dnsfilter: replace thoughtless declaration with idiomatic one
commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 19:00:25 2020 +0300
all: refresh golibs dependencies
commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 18:38:47 2020 +0300
all: remove std log
commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Nov 13 13:46:39 2020 +0300
querylog: improve test logic and readability
commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 19:06:42 2020 +0300
all: improve code quality
commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 18:32:30 2020 +0300
all: cover with tests
commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Nov 12 17:32:01 2020 +0300
all: cover with tests </s> add "bytes" </s> add "bytes"
"strings" </s> add "strings" </s> add "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log" </s> remove github.com/AdguardTeam/golibs v0.4.2
</s> add github.com/AdguardTeam/golibs v0.4.3 | https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b | internal/testutil/testutil.go |
keep keep keep replace keep keep keep keep keep | <mask> package dnsforward
<mask>
<mask> import (
<mask> "errors"
<mask> "net"
<mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> add ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
} </s> remove if s.localResolvers, err = aghnet.NewMultiAddrExchanger(
localAddrs,
bootstraps,
defaultLocalTimeout,
); err != nil {
return err
</s> add var upsConfig proxy.UpstreamConfig
upsConfig, err = proxy.ParseUpstreamsConfig(localAddrs, upstream.Options{
Bootstrap: bootstraps,
Timeout: defaultLocalTimeout,
// TODO(e.burkov): Should we verify server's ceritificates?
})
if err != nil {
return fmt.Errorf("parsing upstreams: %w", err)
}
s.localResolvers = &proxy.Proxy{
Config: proxy.Config{
UpstreamConfig: &upsConfig,
}, </s> remove // TODO(e.burkov): The approach of subtracting sets of strings
// is not really applicable here since in case of listening on
// all network interfaces we should check the whole interface's
// network to cut off all the loopback addresses as well.
</s> add // TODO(e.burkov): The approach of subtracting sets of strings is not
// really applicable here since in case of listening on all network
// interfaces we should check the whole interface's network to cut off
// all the loopback addresses as well. </s> add resp = ctx.Res
</s> remove
resp = ctx.Res
</s> add </s> remove ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dns.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> if !s.subnetDetector.IsLocallyServedNetwork(ip) {
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> req := d.Req
<mask> resp, err := s.localResolvers.Exchange(req)
<mask> if err != nil {
<mask> if errors.Is(err, aghnet.NoUpstreamsErr) {
<mask> d.Res = s.genNXDomain(req)
<mask>
<mask> return resultCodeFinish
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
</s> add </s> remove d.Res = resp
</s> add if d.Res == nil {
d.Res = s.genNXDomain(d.Req)
return resultCodeFinish
} </s> remove ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
}
</s> add </s> remove resp, err = s.localResolvers.Exchange(req)
</s> add err = s.localResolvers.Resolve(ctx) </s> remove
resp = ctx.Res
</s> add </s> add resp = ctx.Res
| https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dns.go |
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep | <mask>
<mask> req := d.Req
<mask> resp, err := s.localResolvers.Exchange(req)
<mask> if err != nil {
<mask> if errors.Is(err, aghnet.NoUpstreamsErr) {
<mask> d.Res = s.genNXDomain(req)
<mask>
<mask> return resultCodeFinish
<mask> }
<mask>
<mask> ctx.err = err
<mask>
<mask> return resultCodeError
<mask> }
<mask>
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove req := d.Req
resp, err := s.localResolvers.Exchange(req)
</s> add err := s.localResolvers.Resolve(d) </s> remove d.Res = resp
</s> add if d.Res == nil {
d.Res = s.genNXDomain(d.Req)
return resultCodeFinish
} </s> remove ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
}
</s> add </s> remove
resp = ctx.Res
</s> add </s> remove resp, err = s.localResolvers.Exchange(req)
</s> add err = s.localResolvers.Resolve(ctx) </s> add resp = ctx.Res
| https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> return resultCodeError
<mask> }
<mask>
<mask> d.Res = resp
<mask>
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> // Apply filtering logic
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
</s> add </s> remove req := d.Req
resp, err := s.localResolvers.Exchange(req)
</s> add err := s.localResolvers.Resolve(d) </s> remove
resp = ctx.Res
</s> add </s> add resp = ctx.Res
</s> remove if s.localResolvers, err = aghnet.NewMultiAddrExchanger(
localAddrs,
bootstraps,
defaultLocalTimeout,
); err != nil {
return err
</s> add var upsConfig proxy.UpstreamConfig
upsConfig, err = proxy.ParseUpstreamsConfig(localAddrs, upstream.Options{
Bootstrap: bootstraps,
Timeout: defaultLocalTimeout,
// TODO(e.burkov): Should we verify server's ceritificates?
})
if err != nil {
return fmt.Errorf("parsing upstreams: %w", err)
}
s.localResolvers = &proxy.Proxy{
Config: proxy.Config{
UpstreamConfig: &upsConfig,
}, </s> remove ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dns.go |
keep keep keep keep replace replace replace replace keep keep keep keep keep | <mask> }
<mask> }
<mask>
<mask> func TestLocalRestriction(t *testing.T) {
<mask> s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
<mask> UDPListenAddrs: []*net.UDPAddr{{}},
<mask> TCPListenAddrs: []*net.TCPAddr{{}},
<mask> })
<mask> ups := &aghtest.TestUpstream{
<mask> Reverse: map[string][]string{
<mask> "251.252.253.254.in-addr.arpa.": {"host1.example.net."},
<mask> "1.1.168.192.in-addr.arpa.": {"some.local-client."},
<mask> },
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s.localResolvers = &aghtest.Exchanger{Ups: ups}
</s> add s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
}, ups) </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dns_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> "251.252.253.254.in-addr.arpa.": {"host1.example.net."},
<mask> "1.1.168.192.in-addr.arpa.": {"some.local-client."},
<mask> },
<mask> }
<mask> s.localResolvers = &aghtest.Exchanger{Ups: ups}
<mask> s.conf.UpstreamConfig.Upstreams = []upstream.Upstream{ups}
<mask> startDeferStop(t, s)
<mask>
<mask> testCases := []struct {
<mask> name string
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
})
</s> add </s> remove dns.localResolvers = &aghtest.Exchanger{
Ups: tc.locUpstream,
</s> add pcfg := proxy.Config{
UpstreamConfig: &proxy.UpstreamConfig{
Upstreams: []upstream.Upstream{tc.locUpstream},
},
}
dns.localResolvers = &proxy.Proxy{
Config: pcfg, </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s.localResolvers = &aghtest.Exchanger{}
</s> add if localUps != nil {
s.localResolvers.Config.UpstreamConfig.Upstreams = []upstream.Upstream{localUps}
} </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dns_test.go |
keep keep keep add keep keep keep keep keep keep | <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/querylog"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/stats"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/miekg/dns"
<mask> )
<mask>
<mask> // DefaultTimeout is the default upstream timeout
<mask> const DefaultTimeout = 10 * time.Second
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove // TODO(e.burkov): The approach of subtracting sets of strings
// is not really applicable here since in case of listening on
// all network interfaces we should check the whole interface's
// network to cut off all the loopback addresses as well.
</s> add // TODO(e.burkov): The approach of subtracting sets of strings is not
// really applicable here since in case of listening on all network
// interfaces we should check the whole interface's network to cut off
// all the loopback addresses as well. </s> remove if s.localResolvers, err = aghnet.NewMultiAddrExchanger(
localAddrs,
bootstraps,
defaultLocalTimeout,
); err != nil {
return err
</s> add var upsConfig proxy.UpstreamConfig
upsConfig, err = proxy.ParseUpstreamsConfig(localAddrs, upstream.Options{
Bootstrap: bootstraps,
Timeout: defaultLocalTimeout,
// TODO(e.burkov): Should we verify server's ceritificates?
})
if err != nil {
return fmt.Errorf("parsing upstreams: %w", err)
}
s.localResolvers = &proxy.Proxy{
Config: proxy.Config{
UpstreamConfig: &upsConfig,
}, </s> remove func createTestServer(t *testing.T, filterConf *dnsfilter.Config, forwardConf ServerConfig) *Server {
</s> add func createTestServer(
t *testing.T,
filterConf *dnsfilter.Config,
forwardConf ServerConfig,
localUps upstream.Upstream,
) (s *Server) { </s> remove d.Res = resp
</s> add if d.Res == nil {
d.Res = s.genNXDomain(d.Req)
return resultCodeFinish
} </s> remove localResolvers aghnet.Exchanger
</s> add localResolvers *proxy.Proxy </s> remove })
</s> add }, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward.go |
keep keep keep keep replace keep keep keep keep keep | <mask> autohostSuffix string
<mask>
<mask> ipset ipsetCtx
<mask> subnetDetector *aghnet.SubnetDetector
<mask> localResolvers aghnet.Exchanger
<mask>
<mask> tableHostToIP map[string]net.IP // "hostname -> IP" table for internal addresses (DHCP)
<mask> tableHostToIPLock sync.Mutex
<mask>
<mask> tablePTR map[string]string // "IP -> hostname" table for reverse lookup
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove // TODO(e.burkov): The approach of subtracting sets of strings
// is not really applicable here since in case of listening on
// all network interfaces we should check the whole interface's
// network to cut off all the loopback addresses as well.
</s> add // TODO(e.burkov): The approach of subtracting sets of strings is not
// really applicable here since in case of listening on all network
// interfaces we should check the whole interface's network to cut off
// all the loopback addresses as well. </s> add resp = ctx.Res
</s> remove dns.localResolvers = &aghtest.Exchanger{
Ups: tc.locUpstream,
</s> add pcfg := proxy.Config{
UpstreamConfig: &proxy.UpstreamConfig{
Upstreams: []upstream.Upstream{tc.locUpstream},
},
}
dns.localResolvers = &proxy.Proxy{
Config: pcfg, </s> remove if s.localResolvers, err = aghnet.NewMultiAddrExchanger(
localAddrs,
bootstraps,
defaultLocalTimeout,
); err != nil {
return err
</s> add var upsConfig proxy.UpstreamConfig
upsConfig, err = proxy.ParseUpstreamsConfig(localAddrs, upstream.Options{
Bootstrap: bootstraps,
Timeout: defaultLocalTimeout,
// TODO(e.burkov): Should we verify server's ceritificates?
})
if err != nil {
return fmt.Errorf("parsing upstreams: %w", err)
}
s.localResolvers = &proxy.Proxy{
Config: proxy.Config{
UpstreamConfig: &upsConfig,
}, </s> remove s.localResolvers = &aghtest.Exchanger{Ups: ups}
</s> add s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
}, ups) </s> add "github.com/AdguardTeam/dnsproxy/upstream" | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward.go |
keep add keep keep keep keep keep | <mask> }},
<mask> }
<mask>
<mask> var resp *dns.Msg
<mask> if s.subnetDetector.IsLocallyServedNetwork(ip) {
<mask> err = s.localResolvers.Resolve(ctx)
<mask> } else {
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove resp, err = s.localResolvers.Exchange(req)
</s> add err = s.localResolvers.Resolve(ctx) </s> remove ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
}
</s> add </s> remove
resp = ctx.Res
</s> add </s> add resp = ctx.Res
</s> remove d.Res = resp
</s> add if d.Res == nil {
d.Res = s.genNXDomain(d.Req)
return resultCodeFinish
} </s> remove if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward.go |
keep keep keep keep replace keep replace replace replace replace replace keep keep | <mask> }
<mask>
<mask> var resp *dns.Msg
<mask> if s.subnetDetector.IsLocallyServedNetwork(ip) {
<mask> resp, err = s.localResolvers.Exchange(req)
<mask> } else {
<mask> ctx := &proxy.DNSContext{
<mask> Proto: "udp",
<mask> Req: req,
<mask> StartTime: time.Now(),
<mask> }
<mask> err = s.internalProxy.Resolve(ctx)
<mask>
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> add ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
} </s> remove
resp = ctx.Res
</s> add </s> remove if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
</s> add </s> remove req := d.Req
resp, err := s.localResolvers.Exchange(req)
</s> add err := s.localResolvers.Resolve(d) </s> add resp = ctx.Res
| https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> Req: req,
<mask> StartTime: time.Now(),
<mask> }
<mask> err = s.internalProxy.Resolve(ctx)
<mask>
<mask> resp = ctx.Res
<mask> }
<mask> if err != nil {
<mask> return "", err
<mask> }
<mask>
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
}
</s> add </s> remove resp, err = s.localResolvers.Exchange(req)
</s> add err = s.localResolvers.Resolve(ctx) </s> add ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
} </s> add resp = ctx.Res
</s> remove if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
</s> add </s> remove req := d.Req
resp, err := s.localResolvers.Exchange(req)
</s> add err := s.localResolvers.Resolve(d) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward.go |
keep keep add keep keep keep keep keep keep | <mask> return "", err
<mask> }
<mask>
<mask> if len(resp.Answer) == 0 {
<mask> return "", fmt.Errorf("lookup for %q: %w", arpa, rDNSEmptyAnswerErr)
<mask> }
<mask>
<mask> ptr, ok := resp.Answer[0].(*dns.PTR)
<mask> if !ok {
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove
resp = ctx.Res
</s> add </s> remove d.Res = resp
</s> add if d.Res == nil {
d.Res = s.genNXDomain(d.Req)
return resultCodeFinish
} </s> remove req := d.Req
resp, err := s.localResolvers.Exchange(req)
</s> add err := s.localResolvers.Resolve(d) </s> remove if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
</s> add </s> remove if s.localResolvers, err = aghnet.NewMultiAddrExchanger(
localAddrs,
bootstraps,
defaultLocalTimeout,
); err != nil {
return err
</s> add var upsConfig proxy.UpstreamConfig
upsConfig, err = proxy.ParseUpstreamsConfig(localAddrs, upstream.Options{
Bootstrap: bootstraps,
Timeout: defaultLocalTimeout,
// TODO(e.burkov): Should we verify server's ceritificates?
})
if err != nil {
return fmt.Errorf("parsing upstreams: %w", err)
}
s.localResolvers = &proxy.Proxy{
Config: proxy.Config{
UpstreamConfig: &upsConfig,
}, </s> remove ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward.go |
keep keep keep keep replace replace replace replace keep keep replace replace replace replace replace replace keep keep | <mask> if err != nil {
<mask> return err
<mask> }
<mask>
<mask> // TODO(e.burkov): The approach of subtracting sets of strings
<mask> // is not really applicable here since in case of listening on
<mask> // all network interfaces we should check the whole interface's
<mask> // network to cut off all the loopback addresses as well.
<mask> localAddrs = stringSetSubtract(localAddrs, ourAddrs)
<mask>
<mask> if s.localResolvers, err = aghnet.NewMultiAddrExchanger(
<mask> localAddrs,
<mask> bootstraps,
<mask> defaultLocalTimeout,
<mask> ); err != nil {
<mask> return err
<mask> }
<mask>
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove
resp = ctx.Res
</s> add </s> remove if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
</s> add </s> remove req := d.Req
resp, err := s.localResolvers.Exchange(req)
</s> add err := s.localResolvers.Resolve(d) </s> remove d.Res = resp
</s> add if d.Res == nil {
d.Res = s.genNXDomain(d.Req)
return resultCodeFinish
} </s> remove ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward.go |
keep keep keep keep replace keep keep keep keep keep | <mask> require.NoErrorf(t, serr, "dns server failed to stop: %s", serr)
<mask> })
<mask> }
<mask>
<mask> func createTestServer(t *testing.T, filterConf *dnsfilter.Config, forwardConf ServerConfig) *Server {
<mask> t.Helper()
<mask>
<mask> rules := `||nxdomain.example.org
<mask> ||null.example.org^
<mask> 127.0.0.1 host.example.org
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
})
</s> add </s> remove })
</s> add }, nil) </s> remove var s *Server
</s> add </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> snd, err := aghnet.NewSubnetDetector()
<mask> require.NoError(t, err)
<mask> require.NotNil(t, snd)
<mask>
<mask> var s *Server
<mask> s, err = NewServer(DNSCreateParams{
<mask> DNSFilter: f,
<mask> SubnetDetector: snd,
<mask> })
<mask> require.NoError(t, err)
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove if s.localResolvers, err = aghnet.NewMultiAddrExchanger(
localAddrs,
bootstraps,
defaultLocalTimeout,
); err != nil {
return err
</s> add var upsConfig proxy.UpstreamConfig
upsConfig, err = proxy.ParseUpstreamsConfig(localAddrs, upstream.Options{
Bootstrap: bootstraps,
Timeout: defaultLocalTimeout,
// TODO(e.burkov): Should we verify server's ceritificates?
})
if err != nil {
return fmt.Errorf("parsing upstreams: %w", err)
}
s.localResolvers = &proxy.Proxy{
Config: proxy.Config{
UpstreamConfig: &upsConfig,
}, </s> remove resp, err = s.localResolvers.Exchange(req)
</s> add err = s.localResolvers.Resolve(ctx) </s> remove ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
}
</s> add </s> remove })
</s> add }, nil) </s> add ctx := &proxy.DNSContext{
Proto: "udp",
Req: req,
StartTime: time.Now(),
} | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> s.Lock()
<mask> defer s.Unlock()
<mask>
<mask> s.localResolvers = &aghtest.Exchanger{}
<mask>
<mask> return s
<mask> }
<mask>
<mask> func createServerTLSConfig(t *testing.T) (*tls.Config, []byte, []byte) {
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
})
</s> add </s> remove s.localResolvers = &aghtest.Exchanger{Ups: ups}
</s> add s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
}, ups) </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove if s.localResolvers, err = aghnet.NewMultiAddrExchanger(
localAddrs,
bootstraps,
defaultLocalTimeout,
); err != nil {
return err
</s> add var upsConfig proxy.UpstreamConfig
upsConfig, err = proxy.ParseUpstreamsConfig(localAddrs, upstream.Options{
Bootstrap: bootstraps,
Timeout: defaultLocalTimeout,
// TODO(e.burkov): Should we verify server's ceritificates?
})
if err != nil {
return fmt.Errorf("parsing upstreams: %w", err)
}
s.localResolvers = &proxy.Proxy{
Config: proxy.Config{
UpstreamConfig: &upsConfig,
}, | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> s = createTestServer(t, &dnsfilter.Config{}, ServerConfig{
<mask> UDPListenAddrs: []*net.UDPAddr{{}},
<mask> TCPListenAddrs: []*net.TCPAddr{{}},
<mask> })
<mask>
<mask> tlsConf.CertificateChainData, tlsConf.PrivateKeyData = certPem, keyPem
<mask> s.conf.TLSConfig = tlsConf
<mask>
<mask> err := s.Prepare(nil)
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove s.localResolvers = &aghtest.Exchanger{Ups: ups}
</s> add s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
}, ups) </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
})
</s> add </s> remove })
</s> add }, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> func TestServer(t *testing.T) {
<mask> s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
<mask> UDPListenAddrs: []*net.UDPAddr{{}},
<mask> TCPListenAddrs: []*net.TCPAddr{{}},
<mask> })
<mask> s.conf.UpstreamConfig.Upstreams = []upstream.Upstream{
<mask> &aghtest.TestUpstream{
<mask> IPv4: map[string][]net.IP{
<mask> "google-public-dns-a.google.com.": {{8, 8, 8, 8}},
<mask> },
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
})
</s> add </s> remove })
</s> add }, nil) </s> remove s.localResolvers = &aghtest.Exchanger{Ups: ups}
</s> add s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
}, ups) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> func TestServerWithProtectionDisabled(t *testing.T) {
<mask> s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
<mask> UDPListenAddrs: []*net.UDPAddr{{}},
<mask> TCPListenAddrs: []*net.TCPAddr{{}},
<mask> })
<mask> s.conf.UpstreamConfig.Upstreams = []upstream.Upstream{
<mask> &aghtest.TestUpstream{
<mask> IPv4: map[string][]net.IP{
<mask> "google-public-dns-a.google.com.": {{8, 8, 8, 8}},
<mask> },
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
})
</s> add </s> remove })
</s> add }, nil) </s> remove s.localResolvers = &aghtest.Exchanger{Ups: ups}
</s> add s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
}, ups) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> UpstreamDNS: []string{"8.8.8.8:53", "8.8.4.4:53"},
<mask> },
<mask> ConfigModified: func() {},
<mask> }
<mask> s := createTestServer(t, filterConf, forwardConf)
<mask> s.conf.UpstreamConfig.Upstreams = []upstream.Upstream{
<mask> &aghtest.TestUpstream{
<mask> IPv4: map[string][]net.IP{
<mask> "google-public-dns-a.google.com.": {{8, 8, 8, 8}},
<mask> },
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> FilteringConfig: FilteringConfig{
<mask> ProtectionEnabled: true,
<mask> },
<mask> }
<mask> s := createTestServer(t, filterConf, forwardConf)
<mask> startDeferStop(t, s)
<mask>
<mask> addr := s.dnsProxy.Addr(proxy.ProtoUDP).String()
<mask> client := dns.Client{Net: proxy.ProtoUDP}
<mask>
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> func TestInvalidRequest(t *testing.T) {
<mask> s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
<mask> UDPListenAddrs: []*net.UDPAddr{{}},
<mask> TCPListenAddrs: []*net.TCPAddr{{}},
<mask> })
<mask> startDeferStop(t, s)
<mask>
<mask> addr := s.dnsProxy.Addr(proxy.ProtoUDP).String()
<mask> req := dns.Msg{
<mask> MsgHdr: dns.MsgHdr{
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
})
</s> add </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s.localResolvers = &aghtest.Exchanger{Ups: ups}
</s> add s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
}, ups) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> FilteringConfig: FilteringConfig{
<mask> ProtectionEnabled: true,
<mask> },
<mask> }
<mask> s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
<mask> startDeferStop(t, s)
<mask>
<mask> addr := s.dnsProxy.Addr(proxy.ProtoUDP)
<mask>
<mask> // Default blocking.
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> FilteringConfig: FilteringConfig{
<mask> ProtectionEnabled: true,
<mask> },
<mask> }
<mask> s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
<mask> s.conf.GetCustomUpstreamByClient = func(_ string) *proxy.UpstreamConfig {
<mask> return &proxy.UpstreamConfig{
<mask> Upstreams: []upstream.Upstream{
<mask> &aghtest.TestUpstream{
<mask> IPv4: map[string][]net.IP{
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> func TestBlockCNAMEProtectionEnabled(t *testing.T) {
<mask> s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
<mask> UDPListenAddrs: []*net.UDPAddr{{}},
<mask> TCPListenAddrs: []*net.TCPAddr{{}},
<mask> })
<mask> testUpstm := &aghtest.TestUpstream{
<mask> CName: testCNAMEs,
<mask> IPv4: testIPv4,
<mask> IPv6: nil,
<mask> }
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
})
</s> add </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> FilteringConfig: FilteringConfig{
<mask> ProtectionEnabled: true,
<mask> },
<mask> }
<mask> s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
<mask> s.conf.UpstreamConfig.Upstreams = []upstream.Upstream{
<mask> &aghtest.TestUpstream{
<mask> CName: testCNAMEs,
<mask> IPv4: testIPv4,
<mask> },
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> settings.FilteringEnabled = false
<mask> },
<mask> },
<mask> }
<mask> s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
<mask> s.conf.UpstreamConfig.Upstreams = []upstream.Upstream{
<mask> &aghtest.TestUpstream{
<mask> CName: testCNAMEs,
<mask> IPv4: testIPv4,
<mask> },
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove })
</s> add }, nil) </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> ProtectionEnabled: true,
<mask> BlockingMode: "null_ip",
<mask> },
<mask> }
<mask> s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
<mask> startDeferStop(t, s)
<mask> addr := s.dnsProxy.Addr(proxy.ProtoUDP)
<mask>
<mask> // Nil filter blocking.
<mask> req := dns.Msg{
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove })
</s> add }, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> FilteringConfig: FilteringConfig{
<mask> ProtectionEnabled: true,
<mask> },
<mask> }
<mask> s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
<mask> startDeferStop(t, s)
<mask> addr := s.dnsProxy.Addr(proxy.ProtoUDP)
<mask>
<mask> // Hosts blocking.
<mask> req := createTestMessage("host.example.org.")
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> SafeBrowsingBlockHost: ans4.String(),
<mask> ProtectionEnabled: true,
<mask> },
<mask> }
<mask> s := createTestServer(t, filterConf, forwardConf)
<mask> s.dnsFilter.SetSafeBrowsingUpstream(sbUps)
<mask> startDeferStop(t, s)
<mask> addr := s.dnsProxy.Addr(proxy.ProtoUDP)
<mask>
<mask> // SafeBrowsing blocking.
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) </s> remove s := createTestServer(t, &dnsfilter.Config{}, forwardConf)
</s> add s := createTestServer(t, &dnsfilter.Config{}, forwardConf, nil) </s> remove s := createTestServer(t, filterConf, forwardConf)
</s> add s := createTestServer(t, filterConf, forwardConf, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> req: localIP,
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> dns.localResolvers = &aghtest.Exchanger{
<mask> Ups: tc.locUpstream,
<mask> }
<mask>
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> host, eerr := dns.Exchange(tc.req)
<mask>
</s> Pull request: 2704 local addresses vol.4
Updates #2704.
Squashed commit of the following:
commit bbc292a1c9dc7382e1116cfd85fea22ab8de6949
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Apr 9 19:22:46 2021 +0300
all: replace exchanger with proxy </s> add resp = ctx.Res
</s> remove s.localResolvers = &aghtest.Exchanger{Ups: ups}
</s> add s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
}, ups) </s> remove if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
</s> add </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{
UDPListenAddrs: []*net.UDPAddr{{}},
TCPListenAddrs: []*net.TCPAddr{{}},
})
</s> add </s> remove req := d.Req
resp, err := s.localResolvers.Exchange(req)
</s> add err := s.localResolvers.Resolve(d) </s> remove })
</s> add }, nil) | https://github.com/AdguardTeam/AdGuardHome/commit/8b8319fca047c541d1813218a80f27cd28098bd1 | internal/dnsforward/dnsforward_test.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.