code_before
stringlengths
16
1.81M
edits
stringlengths
4
328k
next_edit
stringlengths
0
76.5k
code_after
stringlengths
3
49.9M
label_window
sequencelengths
4
1.81k
instruction
stringlengths
20
51.9k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
"time" "github.com/gobuffalo/packr" "golang.org/x/crypto/ssh/terminal" ) // VersionString will be set through ldflags, contains current version var VersionString = "undefined"
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add
"github.com/hmage/golibs/log"
"time" "github.com/gobuffalo/packr" "github.com/hmage/golibs/log" "golang.org/x/crypto/ssh/terminal" ) // VersionString will be set through ldflags, contains current version var VersionString = "undefined"
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
app.go
"github.com/AdguardTeam/AdGuardHome/dhcpd" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/AdGuardHome/log" "gopkg.in/yaml.v2" ) const ( dataDir = "data" // data storage
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"github.com/AdguardTeam/AdGuardHome/dhcpd" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/hmage/golibs/log" "gopkg.in/yaml.v2" ) const ( dataDir = "data" // data storage
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
config.go
"strings" "time" "github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/AdGuardHome/log" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/miekg/dns" "gopkg.in/asaskevich/govalidator.v4" )
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"strings" "time" "github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/miekg/dns" "gopkg.in/asaskevich/govalidator.v4" )
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
control.go
"github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/miekg/dns" "gopkg.in/asaskevich/govalidator.v4" ) const updatePeriod = time.Minute * 30
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/hmage/golibs/log" "github.com/miekg/dns" "gopkg.in/asaskevich/govalidator.v4" ) const updatePeriod = time.Minute * 30
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
control.go
"strings" "time" "github.com/AdguardTeam/AdGuardHome/dhcpd" "github.com/AdguardTeam/AdGuardHome/log" "github.com/joomcode/errorx" ) var dhcpServer = dhcpd.Server{}
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"strings" "time" "github.com/AdguardTeam/AdGuardHome/dhcpd" "github.com/hmage/golibs/log" "github.com/joomcode/errorx" ) var dhcpServer = dhcpd.Server{}
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dhcp.go
"net" "os" "time" "github.com/AdguardTeam/AdGuardHome/log" "github.com/krolaw/dhcp4" ) func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) { iface, err := net.InterfaceByName(ifaceName)
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add
"github.com/hmage/golibs/log"
"net" "os" "time" "github.com/hmage/golibs/log" "github.com/krolaw/dhcp4" ) func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) { iface, err := net.InterfaceByName(ifaceName)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dhcpd/check_other_dhcp.go
"fmt" "net" "time" "github.com/AdguardTeam/AdGuardHome/log" "github.com/krolaw/dhcp4" ) const defaultDiscoverTime = time.Second * 3
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"fmt" "net" "time" "github.com/hmage/golibs/log" "github.com/krolaw/dhcp4" ) const defaultDiscoverTime = time.Second * 3
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dhcpd/dhcpd.go
"fmt" "net" "strings" "github.com/AdguardTeam/AdGuardHome/log" "github.com/joomcode/errorx" ) func isTimeout(err error) bool { operr, ok := err.(*net.OpError)
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"fmt" "net" "strings" "github.com/hmage/golibs/log" "github.com/joomcode/errorx" ) func isTimeout(err error) bool { operr, ok := err.(*net.OpError)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dhcpd/helpers.go
"syscall" "time" "github.com/AdguardTeam/AdGuardHome/dhcpd" "github.com/AdguardTeam/AdGuardHome/log" "github.com/krolaw/dhcp4" ) func main() { if len(os.Args) < 2 {
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"syscall" "time" "github.com/AdguardTeam/AdGuardHome/dhcpd" "github.com/hmage/golibs/log" "github.com/krolaw/dhcp4" ) func main() { if len(os.Args) < 2 {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dhcpd/standalone/main.go
"net" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/AdGuardHome/log" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/joomcode/errorx" ) var dnsServer = dnsforward.Server{}
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"net" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/joomcode/errorx" ) var dnsServer = dnsforward.Server{}
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dns.go
"github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/joomcode/errorx" ) var dnsServer = dnsforward.Server{} func isRunning() bool {
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/hmage/golibs/log" "github.com/joomcode/errorx" ) var dnsServer = dnsforward.Server{} func isRunning() bool {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dns.go
"sync" "sync/atomic" "time" "github.com/AdguardTeam/AdGuardHome/log" "github.com/bluele/gcache" "golang.org/x/net/publicsuffix" ) const defaultCacheSize = 64 * 1024 // in number of elements
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"sync" "sync/atomic" "time" "github.com/bluele/gcache" "golang.org/x/net/publicsuffix" ) const defaultCacheSize = 64 * 1024 // in number of elements
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dnsfilter/dnsfilter.go
"github.com/bluele/gcache" "golang.org/x/net/publicsuffix" ) const defaultCacheSize = 64 * 1024 // in number of elements const defaultCacheTime = 30 * time.Minute
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"github.com/bluele/gcache" "github.com/hmage/golibs/log" "golang.org/x/net/publicsuffix" ) const defaultCacheSize = 64 * 1024 // in number of elements const defaultCacheTime = 30 * time.Minute
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dnsfilter/dnsfilter.go
"fmt" "os" "runtime" "github.com/AdguardTeam/AdGuardHome/log" "github.com/shirou/gopsutil/process" "go.uber.org/goleak" ) // first in file because it must be run first
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"fmt" "os" "runtime" "github.com/hmage/golibs/log" "github.com/shirou/gopsutil/process" "go.uber.org/goleak" ) // first in file because it must be run first
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dnsfilter/dnsfilter_test.go
"sync" "time" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/AdguardTeam/AdGuardHome/log" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/joomcode/errorx" "github.com/miekg/dns" )
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"sync" "time" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/joomcode/errorx" "github.com/miekg/dns" )
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dnsforward/dnsforward.go
"github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/joomcode/errorx" "github.com/miekg/dns" ) // DefaultTimeout is the default upstream timeout
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add
"github.com/hmage/golibs/log"
"github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/hmage/golibs/log" "github.com/joomcode/errorx" "github.com/miekg/dns" ) // DefaultTimeout is the default upstream timeout
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dnsforward/dnsforward.go
"sync" "time" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/AdguardTeam/AdGuardHome/log" "github.com/miekg/dns" ) const ( logBufferCap = 5000 // maximum capacity of logBuffer before it's flushed to disk
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add
"github.com/hmage/golibs/log"
"sync" "time" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/hmage/golibs/log" "github.com/miekg/dns" ) const ( logBufferCap = 5000 // maximum capacity of logBuffer before it's flushed to disk
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dnsforward/querylog.go
"os" "sync" "time" "github.com/AdguardTeam/AdGuardHome/log" "github.com/go-test/deep" ) var ( fileWriteLock sync.Mutex
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add
"os" "sync" "time" "github.com/go-test/deep" ) var ( fileWriteLock sync.Mutex
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dnsforward/querylog_file.go
"time" "github.com/go-test/deep" ) var ( fileWriteLock sync.Mutex )
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"time" "github.com/go-test/deep" "github.com/hmage/golibs/log" ) var ( fileWriteLock sync.Mutex )
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dnsforward/querylog_file.go
"strings" "sync" "time" "github.com/AdguardTeam/AdGuardHome/log" "github.com/bluele/gcache" "github.com/miekg/dns" ) type hourTop struct {
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add
"strings" "sync" "time" "github.com/bluele/gcache" "github.com/miekg/dns" ) type hourTop struct {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dnsforward/querylog_top.go
"github.com/bluele/gcache" "github.com/miekg/dns" ) type hourTop struct {
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add
"github.com/hmage/golibs/log"
"github.com/bluele/gcache" "github.com/hmage/golibs/log" "github.com/miekg/dns" ) type hourTop struct {
[ "keep", "add", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dnsforward/querylog_top.go
"sync" "time" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/AdguardTeam/AdGuardHome/log" ) var ( requests = newDNSCounter("requests_total") filtered = newDNSCounter("filtered_total")
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"sync" "time" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/hmage/golibs/log" ) var ( requests = newDNSCounter("requests_total") filtered = newDNSCounter("filtered_total")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
dnsforward/stats.go
"strings" "time" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/AdguardTeam/AdGuardHome/log" ) var ( nextFilterID = time.Now().Unix() // semi-stable way to generate an unique ID filterTitleRegexp = regexp.MustCompile(`^! Title: +(.*)$`)
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add
"github.com/hmage/golibs/log"
"strings" "time" "github.com/AdguardTeam/AdGuardHome/dnsfilter" "github.com/hmage/golibs/log" ) var ( nextFilterID = time.Now().Unix() // semi-stable way to generate an unique ID filterTitleRegexp = regexp.MustCompile(`^! Title: +(.*)$`)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
filter.go
github.com/davecgh/go-spew v1.1.1 github.com/go-ole/go-ole v1.2.1 // indirect github.com/go-test/deep v1.0.1 github.com/gobuffalo/packr v1.19.0 github.com/jedisct1/go-dnsstamps v0.0.0-20180418170050-1e4999280f86 github.com/joomcode/errorx v0.1.0 github.com/krolaw/dhcp4 v0.0.0-20180925202202-7cead472c414 github.com/miekg/dns v1.1.1 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pkg/errors v0.8.0
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add
github.com/hmage/golibs v0.0.0-20181229160906-c8491df0bfc4
github.com/davecgh/go-spew v1.1.1 github.com/go-ole/go-ole v1.2.1 // indirect github.com/go-test/deep v1.0.1 github.com/gobuffalo/packr v1.19.0 github.com/hmage/golibs v0.0.0-20181229160906-c8491df0bfc4 github.com/jedisct1/go-dnsstamps v0.0.0-20180418170050-1e4999280f86 github.com/joomcode/errorx v0.1.0 github.com/krolaw/dhcp4 v0.0.0-20180925202202-7cead472c414 github.com/miekg/dns v1.1.1 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pkg/errors v0.8.0
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
go.mod
github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= github.com/gobuffalo/packr v1.19.0 h1:3UDmBDxesCOPF8iZdMDBBWKfkBoYujIMIZePnobqIUI= github.com/gobuffalo/packr v1.19.0/go.mod h1:MstrNkfCQhd5o+Ct4IJ0skWlxN8emOq8DsoT1G98VIU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jedisct1/go-dnsstamps v0.0.0-20180418170050-1e4999280f86 h1:Olj4M6T1omUfx7yTTcnhLf4xo6gYMmRHSJIfeA1NZy0= github.com/jedisct1/go-dnsstamps v0.0.0-20180418170050-1e4999280f86/go.mod h1:j/ONpSHHmPgDwmFKXg9vhQvIjADe/ft1X4a3TVOmp9g= github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmcvetta/randutil v0.0.0-20150817122601-2bb1b664bcff h1:6NvhExg4omUC9NfA+l4Oq3ibNNeJUdiAF3iBVB0PlDk=
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
github.com/hmage/golibs v0.0.0-20181229160906-c8491df0bfc4 h1:FMAReGTEDNr4AdbScv/PqzjMQUpkkVHiF/t8sDHQQVQ= github.com/hmage/golibs v0.0.0-20181229160906-c8491df0bfc4/go.mod h1:H6Ev6svFxUVPFThxLtdnFfcE9e3GWufpfmcVFpqV6HM=
github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= github.com/gobuffalo/packr v1.19.0 h1:3UDmBDxesCOPF8iZdMDBBWKfkBoYujIMIZePnobqIUI= github.com/gobuffalo/packr v1.19.0/go.mod h1:MstrNkfCQhd5o+Ct4IJ0skWlxN8emOq8DsoT1G98VIU= github.com/hmage/golibs v0.0.0-20181229160906-c8491df0bfc4 h1:FMAReGTEDNr4AdbScv/PqzjMQUpkkVHiF/t8sDHQQVQ= github.com/hmage/golibs v0.0.0-20181229160906-c8491df0bfc4/go.mod h1:H6Ev6svFxUVPFThxLtdnFfcE9e3GWufpfmcVFpqV6HM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jedisct1/go-dnsstamps v0.0.0-20180418170050-1e4999280f86 h1:Olj4M6T1omUfx7yTTcnhLf4xo6gYMmRHSJIfeA1NZy0= github.com/jedisct1/go-dnsstamps v0.0.0-20180418170050-1e4999280f86/go.mod h1:j/ONpSHHmPgDwmFKXg9vhQvIjADe/ft1X4a3TVOmp9g= github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmcvetta/randutil v0.0.0-20150817122601-2bb1b664bcff h1:6NvhExg4omUC9NfA+l4Oq3ibNNeJUdiAF3iBVB0PlDk=
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
go.sum
"io/ioutil" "net/http" "strings" "github.com/AdguardTeam/AdGuardHome/log" ) // -------------------- // internationalization // --------------------
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log"
"github.com/hmage/golibs/log"
"io/ioutil" "net/http" "strings" "github.com/hmage/golibs/log" ) // -------------------- // internationalization // --------------------
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
i18n.go
"io/ioutil" "os" "path/filepath" "github.com/AdguardTeam/AdGuardHome/log" "gopkg.in/yaml.v2" ) const currentSchemaVersion = 2 // used for upgrading from old configs to new config
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add
"github.com/hmage/golibs/log"
"io/ioutil" "os" "path/filepath" "github.com/hmage/golibs/log" "gopkg.in/yaml.v2" ) const currentSchemaVersion = 2 // used for upgrading from old configs to new config
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
upgrade.go
} continue } if ok { return true, nil } if err != nil { return false, err } } }
</s> remove if ok { return true, nil } </s> add </s> remove func ifaceIPv6Addrs(iface *net.Interface) (ips []net.IP, err error) { </s> add func ifaceIPv6Addrs(iface netIface) (ips []net.IP, err error) { </s> remove func (s *winServer) ResetLeases(leases []*Lease) { } func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) { } func (s *winServer) WriteDiskConfig6(c *V6ServerConf) { } func (s *winServer) Start() error { return nil } func (s *winServer) Stop() { } func (s *winServer) Reset() { } func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> add func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil }
} continue } if err != nil { return false, err } } }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/check_other_dhcp.go
} if err != nil { return false, err } } } // TODO(a.garipov): Refactor further. Inspect error handling, remove parameter // next, address the TODO, merge with tryConn6, etc.
</s> remove if ok { return true, nil } </s> add </s> remove if ok { return true, nil } </s> add </s> remove func ifaceIPv6Addrs(iface *net.Interface) (ips []net.IP, err error) { </s> add func ifaceIPv6Addrs(iface netIface) (ips []net.IP, err error) { </s> remove func (s *winServer) ResetLeases(leases []*Lease) { } func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) { } func (s *winServer) WriteDiskConfig6(c *V6ServerConf) { } func (s *winServer) Start() error { return nil } func (s *winServer) Stop() { } func (s *winServer) Reset() { } func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> add func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil }
return ok, nil
} if err != nil { return false, err } return ok, nil } } // TODO(a.garipov): Refactor further. Inspect error handling, remove parameter // next, address the TODO, merge with tryConn6, etc.
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/check_other_dhcp.go
} continue } if ok { return true, nil } if err != nil { return false, err } } }
</s>
} continue } if err != nil { return false, err } } }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/check_other_dhcp.go
return mc, serverConn } func ComparePacket(got *dhcpv4.DHCPv4, want *dhcpv4.DHCPv4) error { if got == nil && got == want { return nil } if (want == nil || got == nil) && (got != want) { return fmt.Errorf("packet got %v, want %v", got, want)
</s> remove func pktsExpected(got []*dhcpv4.DHCPv4, want []*dhcpv4.DHCPv4) error { </s> add func pktsExpected(got, want []*dhcpv4.DHCPv4) error { </s> remove func udpMatch(addr *net.UDPAddr, bound *net.UDPAddr) bool { </s> add func udpMatch(addr, bound *net.UDPAddr) bool { </s> remove if ip := ipnet.IP.To16(); ip != nil { ips = append(ips, ip) </s> add if ip := ipnet.IP.To4(); ip == nil { // Assume that net.(*Interface).Addrs can only return // valid IPv4 and IPv6 addresses. Since this isn't an // IPv4 address, it must be an IPv6 one. ips = append(ips, ipnet.IP) </s> remove func (s *winServer) ResetLeases(leases []*Lease) { } func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) { } func (s *winServer) WriteDiskConfig6(c *V6ServerConf) { } func (s *winServer) Start() error { return nil } func (s *winServer) Stop() { } func (s *winServer) Reset() { } func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> add func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> remove if ok { return true, nil } </s> add
func ComparePacket(got, want *dhcpv4.DHCPv4) error {
return mc, serverConn } func ComparePacket(got, want *dhcpv4.DHCPv4) error { if got == nil && got == want { return nil } if (want == nil || got == nil) && (got != want) { return fmt.Errorf("packet got %v, want %v", got, want)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/nclient4/client_test.go
} return nil } func pktsExpected(got []*dhcpv4.DHCPv4, want []*dhcpv4.DHCPv4) error { if len(got) != len(want) { return fmt.Errorf("got %d packets, want %d packets", len(got), len(want)) } for i := range got {
</s> remove func ComparePacket(got *dhcpv4.DHCPv4, want *dhcpv4.DHCPv4) error { </s> add func ComparePacket(got, want *dhcpv4.DHCPv4) error { </s> remove func (s *winServer) ResetLeases(leases []*Lease) { } func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) { } func (s *winServer) WriteDiskConfig6(c *V6ServerConf) { } func (s *winServer) Start() error { return nil } func (s *winServer) Stop() { } func (s *winServer) Reset() { } func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> add func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> remove if ok { return true, nil } </s> add </s> remove if ok { return true, nil } </s> add
func pktsExpected(got, want []*dhcpv4.DHCPv4) error {
} return nil } func pktsExpected(got, want []*dhcpv4.DHCPv4) error { if len(got) != len(want) { return fmt.Errorf("got %d packets, want %d packets", len(got), len(want)) } for i := range got {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/nclient4/client_test.go
newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33}), newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x44, 0x44, 0x44, 0x44}), }, server: [][]*dhcpv4.DHCPv4{ []*dhcpv4.DHCPv4{ // Response for first packet. newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}), }, []*dhcpv4.DHCPv4{ // Response for second packet. newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x44, 0x44, 0x44, 0x44}), },
</s> remove []*dhcpv4.DHCPv4{ // Response for second packet. </s> add { // Response for second packet. </s> remove func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr net.IP, dstAddr net.IP) uint16 { </s> add func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr, dstAddr net.IP) uint16 { </s> remove func pktsExpected(got []*dhcpv4.DHCPv4, want []*dhcpv4.DHCPv4) error { </s> add func pktsExpected(got, want []*dhcpv4.DHCPv4) error { </s> remove var ( // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) ) </s> add // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) </s> remove var ( // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") ) </s> add // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr")
{ // Response for first packet.
newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33}), newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x44, 0x44, 0x44, 0x44}), }, server: [][]*dhcpv4.DHCPv4{ { // Response for first packet. newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}), }, []*dhcpv4.DHCPv4{ // Response for second packet. newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x44, 0x44, 0x44, 0x44}), },
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/nclient4/client_test.go
server: [][]*dhcpv4.DHCPv4{ []*dhcpv4.DHCPv4{ // Response for first packet. newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}), }, []*dhcpv4.DHCPv4{ // Response for second packet. newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x44, 0x44, 0x44, 0x44}), }, }, wantErr: []error{ nil,
</s> remove []*dhcpv4.DHCPv4{ // Response for first packet. </s> add { // Response for first packet. </s> remove func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr net.IP, dstAddr net.IP) uint16 { </s> add func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr, dstAddr net.IP) uint16 { </s> remove func ifaceIPv6Addrs(iface *net.Interface) (ips []net.IP, err error) { </s> add func ifaceIPv6Addrs(iface netIface) (ips []net.IP, err error) { </s> remove func pktsExpected(got []*dhcpv4.DHCPv4, want []*dhcpv4.DHCPv4) error { </s> add func pktsExpected(got, want []*dhcpv4.DHCPv4) error {
{ // Response for second packet.
server: [][]*dhcpv4.DHCPv4{ []*dhcpv4.DHCPv4{ // Response for first packet. newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}), }, { // Response for second packet. newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x44, 0x44, 0x44, 0x44}), }, }, wantErr: []error{ nil,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/nclient4/client_test.go
"github.com/mdlayher/raw" "github.com/u-root/u-root/pkg/uio" ) var ( // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) ) var ( // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") )
</s> remove var ( // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") ) </s> add // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") </s> remove func (b UDP) CalculateChecksum(partialChecksum uint16, totalLen uint16) uint16 { </s> add func (b UDP) CalculateChecksum(partialChecksum, totalLen uint16) uint16 { </s> remove if ip := ipnet.IP.To16(); ip != nil { ips = append(ips, ip) </s> add if ip := ipnet.IP.To4(); ip == nil { // Assume that net.(*Interface).Addrs can only return // valid IPv4 and IPv6 addresses. Since this isn't an // IPv4 address, it must be an IPv6 one. ips = append(ips, ipnet.IP) </s> remove func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr net.IP, dstAddr net.IP) uint16 { </s> add func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr, dstAddr net.IP) uint16 {
// BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255})
"github.com/mdlayher/raw" "github.com/u-root/u-root/pkg/uio" ) // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) var ( // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") )
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/nclient4/conn_unix.go
// Any UDP packet sent to this address is broadcast on the subnet. BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) ) var ( // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") ) // NewRawUDPConn returns a UDP connection bound to the interface and port // given based on a raw packet socket. All packets are broadcasted. // // The interface can be completely unconfigured.
</s> remove var ( // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) ) </s> add // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) </s> remove func (b UDP) CalculateChecksum(partialChecksum uint16, totalLen uint16) uint16 { </s> add func (b UDP) CalculateChecksum(partialChecksum, totalLen uint16) uint16 { </s> remove if ip := ipnet.IP.To16(); ip != nil { ips = append(ips, ip) </s> add if ip := ipnet.IP.To4(); ip == nil { // Assume that net.(*Interface).Addrs can only return // valid IPv4 and IPv6 addresses. Since this isn't an // IPv4 address, it must be an IPv6 one. ips = append(ips, ipnet.IP) </s> remove func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr net.IP, dstAddr net.IP) uint16 { </s> add func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr, dstAddr net.IP) uint16 {
// ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr")
// Any UDP packet sent to this address is broadcast on the subnet. BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) ) // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") // NewRawUDPConn returns a UDP connection bound to the interface and port // given based on a raw packet socket. All packets are broadcasted. // // The interface can be completely unconfigured.
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/nclient4/conn_unix.go
boundAddr: boundAddr, } } func udpMatch(addr *net.UDPAddr, bound *net.UDPAddr) bool { if bound == nil { return true } if bound.IP != nil && !bound.IP.Equal(addr.IP) { return false
</s> remove func ComparePacket(got *dhcpv4.DHCPv4, want *dhcpv4.DHCPv4) error { </s> add func ComparePacket(got, want *dhcpv4.DHCPv4) error { </s> remove func udp4pkt(packet []byte, dest *net.UDPAddr, src *net.UDPAddr) []byte { </s> add func udp4pkt(packet []byte, dest, src *net.UDPAddr) []byte { </s> remove func (s *winServer) ResetLeases(leases []*Lease) { } func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) { } func (s *winServer) WriteDiskConfig6(c *V6ServerConf) { } func (s *winServer) Start() error { return nil } func (s *winServer) Stop() { } func (s *winServer) Reset() { } func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> add func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> remove if ok { return true, nil } </s> add </s> remove if ok { return true, nil } </s> add
func udpMatch(addr, bound *net.UDPAddr) bool {
boundAddr: boundAddr, } } func udpMatch(addr, bound *net.UDPAddr) bool { if bound == nil { return true } if bound.IP != nil && !bound.IP.Equal(addr.IP) { return false
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/nclient4/conn_unix.go
// CalculateChecksum calculates the checksum of the udp packet, given the total // length of the packet and the checksum of the network-layer pseudo-header // (excluding the total length) and the checksum of the payload. func (b UDP) CalculateChecksum(partialChecksum uint16, totalLen uint16) uint16 { // Add the length portion of the checksum to the pseudo-checksum. tmp := make([]byte, 2) binary.BigEndian.PutUint16(tmp, totalLen) checksum := Checksum(tmp, partialChecksum)
</s> remove func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr net.IP, dstAddr net.IP) uint16 { </s> add func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr, dstAddr net.IP) uint16 { </s> remove var ( // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") ) </s> add // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") </s> remove var ( // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) ) </s> add // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) </s> remove func ifaceIPv6Addrs(iface *net.Interface) (ips []net.IP, err error) { </s> add func ifaceIPv6Addrs(iface netIface) (ips []net.IP, err error) {
func (b UDP) CalculateChecksum(partialChecksum, totalLen uint16) uint16 {
// CalculateChecksum calculates the checksum of the udp packet, given the total // length of the packet and the checksum of the network-layer pseudo-header // (excluding the total length) and the checksum of the payload. func (b UDP) CalculateChecksum(partialChecksum, totalLen uint16) uint16 { // Add the length portion of the checksum to the pseudo-checksum. tmp := make([]byte, 2) binary.BigEndian.PutUint16(tmp, totalLen) checksum := Checksum(tmp, partialChecksum)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/nclient4/ipv4.go
// PseudoHeaderChecksum calculates the pseudo-header checksum for the // given destination protocol and network address, ignoring the length // field. Pseudo-headers are needed by transport layers when calculating // their own checksum. func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr net.IP, dstAddr net.IP) uint16 { xsum := Checksum([]byte(srcAddr), 0) xsum = Checksum([]byte(dstAddr), xsum) return Checksum([]byte{0, uint8(protocol)}, xsum) }
</s> remove func (b UDP) CalculateChecksum(partialChecksum uint16, totalLen uint16) uint16 { </s> add func (b UDP) CalculateChecksum(partialChecksum, totalLen uint16) uint16 { </s> remove func udp4pkt(packet []byte, dest *net.UDPAddr, src *net.UDPAddr) []byte { </s> add func udp4pkt(packet []byte, dest, src *net.UDPAddr) []byte { </s> remove var ( // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") ) </s> add // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") </s> remove if ip := ipnet.IP.To16(); ip != nil { ips = append(ips, ip) </s> add if ip := ipnet.IP.To4(); ip == nil { // Assume that net.(*Interface).Addrs can only return // valid IPv4 and IPv6 addresses. Since this isn't an // IPv4 address, it must be an IPv6 one. ips = append(ips, ipnet.IP) </s> remove var ( // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) ) </s> add // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255})
func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr, dstAddr net.IP) uint16 {
// PseudoHeaderChecksum calculates the pseudo-header checksum for the // given destination protocol and network address, ignoring the length // field. Pseudo-headers are needed by transport layers when calculating // their own checksum. func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr, dstAddr net.IP) uint16 { xsum := Checksum([]byte(srcAddr), 0) xsum = Checksum([]byte(dstAddr), xsum) return Checksum([]byte{0, uint8(protocol)}, xsum) }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/nclient4/ipv4.go
xsum = Checksum([]byte(dstAddr), xsum) return Checksum([]byte{0, uint8(protocol)}, xsum) } func udp4pkt(packet []byte, dest *net.UDPAddr, src *net.UDPAddr) []byte { ipLen := IPv4MinimumSize udpLen := UDPMinimumSize h := make([]byte, 0, ipLen+udpLen+len(packet)) hdr := uio.NewBigEndianBuffer(h)
</s> remove func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr net.IP, dstAddr net.IP) uint16 { </s> add func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr, dstAddr net.IP) uint16 { </s> remove func udpMatch(addr *net.UDPAddr, bound *net.UDPAddr) bool { </s> add func udpMatch(addr, bound *net.UDPAddr) bool { </s> remove if ip := ipnet.IP.To16(); ip != nil { ips = append(ips, ip) </s> add if ip := ipnet.IP.To4(); ip == nil { // Assume that net.(*Interface).Addrs can only return // valid IPv4 and IPv6 addresses. Since this isn't an // IPv4 address, it must be an IPv6 one. ips = append(ips, ipnet.IP) </s> remove func pktsExpected(got []*dhcpv4.DHCPv4, want []*dhcpv4.DHCPv4) error { </s> add func pktsExpected(got, want []*dhcpv4.DHCPv4) error {
func udp4pkt(packet []byte, dest, src *net.UDPAddr) []byte {
xsum = Checksum([]byte(dstAddr), xsum) return Checksum([]byte{0, uint8(protocol)}, xsum) } func udp4pkt(packet []byte, dest, src *net.UDPAddr) []byte { ipLen := IPv4MinimumSize udpLen := UDPMinimumSize h := make([]byte, 0, ipLen+udpLen+len(packet)) hdr := uio.NewBigEndianBuffer(h)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/nclient4/ipv4.go
type winServer struct { } func (s *winServer) ResetLeases(leases []*Lease) { } func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) { } func (s *winServer) WriteDiskConfig6(c *V6ServerConf) { } func (s *winServer) Start() error { return nil } func (s *winServer) Stop() { } func (s *winServer) Reset() { } func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil }
</s> remove if ok { return true, nil } </s> add </s> remove if ok { return true, nil } </s> add </s> remove func pktsExpected(got []*dhcpv4.DHCPv4, want []*dhcpv4.DHCPv4) error { </s> add func pktsExpected(got, want []*dhcpv4.DHCPv4) error { </s> remove func udpMatch(addr *net.UDPAddr, bound *net.UDPAddr) bool { </s> add func udpMatch(addr, bound *net.UDPAddr) bool {
func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil }
type winServer struct { } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/v46_windows.go
return } } // ifaceIPv6Addrs returns the interface's IPv6 addresses. func ifaceIPv6Addrs(iface netIface) (ips []net.IP, err error) { addrs, err := iface.Addrs() if err != nil { return nil, err }
</s> remove func ifaceIPv6Addrs(iface *net.Interface) (ips []net.IP, err error) { </s> add func ifaceIPv6Addrs(iface netIface) (ips []net.IP, err error) { </s> remove if ok { return true, nil } </s> add </s> remove if ok { return true, nil } </s> add </s> remove if ip := ipnet.IP.To16(); ip != nil { ips = append(ips, ip) </s> add if ip := ipnet.IP.To4(); ip == nil { // Assume that net.(*Interface).Addrs can only return // valid IPv4 and IPv6 addresses. Since this isn't an // IPv4 address, it must be an IPv6 one. ips = append(ips, ipnet.IP)
type netIface interface { Addrs() ([]net.Addr, error) }
return } } type netIface interface { Addrs() ([]net.Addr, error) } // ifaceIPv6Addrs returns the interface's IPv6 addresses. func ifaceIPv6Addrs(iface netIface) (ips []net.IP, err error) { addrs, err := iface.Addrs() if err != nil { return nil, err }
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/v6.go
} } // ifaceIPv6Addrs returns the interface's IPv6 addresses. func ifaceIPv6Addrs(iface *net.Interface) (ips []net.IP, err error) { addrs, err := iface.Addrs() if err != nil { return nil, err }
</s> remove if ok { return true, nil } </s> add </s> remove if ok { return true, nil } </s> add </s> remove if ip := ipnet.IP.To16(); ip != nil { ips = append(ips, ip) </s> add if ip := ipnet.IP.To4(); ip == nil { // Assume that net.(*Interface).Addrs can only return // valid IPv4 and IPv6 addresses. Since this isn't an // IPv4 address, it must be an IPv6 one. ips = append(ips, ipnet.IP)
func ifaceIPv6Addrs(iface netIface) (ips []net.IP, err error) {
} } // ifaceIPv6Addrs returns the interface's IPv6 addresses. func ifaceIPv6Addrs(iface netIface) (ips []net.IP, err error) { addrs, err := iface.Addrs() if err != nil { return nil, err }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/v6.go
if !ok { continue } if ip := ipnet.IP.To16(); ip != nil { ips = append(ips, ip) } } return ips, nil }
</s> remove if ok { return true, nil } </s> add </s> remove if ok { return true, nil } </s> add </s> remove func (s *winServer) ResetLeases(leases []*Lease) { } func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) { } func (s *winServer) WriteDiskConfig6(c *V6ServerConf) { } func (s *winServer) Start() error { return nil } func (s *winServer) Stop() { } func (s *winServer) Reset() { } func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> add func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> remove func udpMatch(addr *net.UDPAddr, bound *net.UDPAddr) bool { </s> add func udpMatch(addr, bound *net.UDPAddr) bool {
if ip := ipnet.IP.To4(); ip == nil { // Assume that net.(*Interface).Addrs can only return // valid IPv4 and IPv6 addresses. Since this isn't an // IPv4 address, it must be an IPv6 one. ips = append(ips, ipnet.IP)
if !ok { continue } if ip := ipnet.IP.To4(); ip == nil { // Assume that net.(*Interface).Addrs can only return // valid IPv4 and IPv6 addresses. Since this isn't an // IPv4 address, it must be an IPv6 one. ips = append(ips, ipnet.IP) if ip := ipnet.IP.To4(); ip == nil { // Assume that net.(*Interface).Addrs can only return // valid IPv4 and IPv6 addresses. Since this isn't an // IPv4 address, it must be an IPv6 one. ips = append(ips, ipnet.IP) } } return ips, nil }
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/v6.go
"net" "testing" "github.com/insomniacslk/dhcp/dhcpv6" "github.com/insomniacslk/dhcp/iana" "github.com/stretchr/testify/assert" )
</s> remove var ( // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) ) </s> add // BroadcastMac is the broadcast MAC address. // // Any UDP packet sent to this address is broadcast on the subnet. var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255}) </s> remove var ( // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") ) </s> add // ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr". var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr") </s> remove func (s *winServer) ResetLeases(leases []*Lease) { } func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) { } func (s *winServer) WriteDiskConfig6(c *V6ServerConf) { } func (s *winServer) Start() error { return nil } func (s *winServer) Stop() { } func (s *winServer) Reset() { } func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> add func (s *winServer) ResetLeases(leases []*Lease) {} func (s *winServer) GetLeases(flags int) []Lease { return nil } func (s *winServer) GetLeasesRef() []*Lease { return nil } func (s *winServer) AddStaticLease(lease Lease) error { return nil } func (s *winServer) RemoveStaticLease(l Lease) error { return nil } func (s *winServer) FindMACbyIP(ip net.IP) net.HardwareAddr { return nil } func (s *winServer) WriteDiskConfig4(c *V4ServerConf) {} func (s *winServer) WriteDiskConfig6(c *V6ServerConf) {} func (s *winServer) Start() error { return nil } func (s *winServer) Stop() {} func (s *winServer) Reset() {} func v4Create(conf V4ServerConf) (DHCPServer, error) { return &winServer{}, nil } func v6Create(conf V6ServerConf) (DHCPServer, error) { return &winServer{}, nil } </s> remove func udp4pkt(packet []byte, dest *net.UDPAddr, src *net.UDPAddr) []byte { </s> add func udp4pkt(packet []byte, dest, src *net.UDPAddr) []byte {
"github.com/AdguardTeam/AdGuardHome/internal/agherr"
"net" "testing" "github.com/AdguardTeam/AdGuardHome/internal/agherr" "github.com/insomniacslk/dhcp/dhcpv6" "github.com/insomniacslk/dhcp/iana" "github.com/stretchr/testify/assert" )
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dhcpd: fix interface ipv6 check Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master Updates #2335. Squashed commit of the following: commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7 Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 14:03:24 2020 +0300 dhcpd: fix loop exit condition commit 32b4b946bfa30159326dc295fa1a2607b78172af Author: Ainar Garipov <[email protected]> Date: Wed Nov 25 13:26:50 2020 +0300 dhcpd: fix interface ipv6 check
https://github.com/AdguardTeam/AdGuardHome/commit/36c7735b855f4388d0cf36fb2f26f1979809c217
internal/dhcpd/v6_test.go
) { pctx := ctx.proxyCtx e := stats.Entry{} e.Domain = strings.ToLower(pctx.Req.Question[0].Name) e.Domain = e.Domain[:len(e.Domain)-1] // remove last "." if clientID := ctx.clientID; clientID != "" { e.Client = clientID } else { e.Client = clientIP
</s> remove func TestProcessQueryLogsAndStats(t *testing.T) { </s> add func TestServer_ProcessQueryLogsAndStats(t *testing.T) { const domain = "example.com." </s> remove Name: "example.com.", </s> add Name: tc.domain,
if e.Domain != "." { // Remove last ".", but save the domain as is for "." queries. e.Domain = e.Domain[:len(e.Domain)-1] }
) { pctx := ctx.proxyCtx e := stats.Entry{} e.Domain = strings.ToLower(pctx.Req.Question[0].Name) if e.Domain != "." { // Remove last ".", but save the domain as is for "." queries. e.Domain = e.Domain[:len(e.Domain)-1] } if clientID := ctx.clientID; clientID != "" { e.Client = clientID } else { e.Client = clientIP
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats.go
} // Update implements the [stats.Interface] interface for *testStats. func (l *testStats) Update(e stats.Entry) { l.lastEntry = e } // ShouldCount implements the [stats.Interface] interface for *testStats. func (l *testStats) ShouldCount(string, uint16, uint16, []string) bool { return true
</s> remove func TestProcessQueryLogsAndStats(t *testing.T) { </s> add func TestServer_ProcessQueryLogsAndStats(t *testing.T) { const domain = "example.com." </s> remove e.Domain = e.Domain[:len(e.Domain)-1] // remove last "." </s> add if e.Domain != "." { // Remove last ".", but save the domain as is for "." queries. e.Domain = e.Domain[:len(e.Domain)-1] } </s> remove Time: time.Now(), QHost: strings.ToLower(q.Name[:len(q.Name)-1]), </s> add Time: time.Now(), QHost: qHost, </s> remove Name: "example.com.", </s> add Name: tc.domain,
if e.Domain == "" { return }
} // Update implements the [stats.Interface] interface for *testStats. func (l *testStats) Update(e stats.Entry) { if e.Domain == "" { return } l.lastEntry = e } // ShouldCount implements the [stats.Interface] interface for *testStats. func (l *testStats) ShouldCount(string, uint16, uint16, []string) bool { return true
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
func (l *testStats) ShouldCount(string, uint16, uint16, []string) bool { return true } func TestProcessQueryLogsAndStats(t *testing.T) { testCases := []struct { name string proto proxy.Proto addr net.Addr clientID string
</s> remove e.Domain = e.Domain[:len(e.Domain)-1] // remove last "." </s> add if e.Domain != "." { // Remove last ".", but save the domain as is for "." queries. e.Domain = e.Domain[:len(e.Domain)-1] } </s> remove Name: "example.com.", </s> add Name: tc.domain,
func TestServer_ProcessQueryLogsAndStats(t *testing.T) { const domain = "example.com."
func (l *testStats) ShouldCount(string, uint16, uint16, []string) bool { return true } func TestServer_ProcessQueryLogsAndStats(t *testing.T) { const domain = "example.com." testCases := []struct { name string proto proxy.Proto addr net.Addr clientID string
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
testCases := []struct { name string proto proxy.Proto addr net.Addr clientID string wantLogProto querylog.ClientProto
</s> remove func TestProcessQueryLogsAndStats(t *testing.T) { </s> add func TestServer_ProcessQueryLogsAndStats(t *testing.T) { const domain = "example.com." </s> remove e.Domain = e.Domain[:len(e.Domain)-1] // remove last "." </s> add if e.Domain != "." { // Remove last ".", but save the domain as is for "." queries. e.Domain = e.Domain[:len(e.Domain)-1] }
domain string
testCases := []struct { name string domain string proto proxy.Proto addr net.Addr clientID string wantLogProto querylog.ClientProto
[ "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
reason filtering.Reason wantStatResult stats.Result }{{ name: "success_udp", proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: "", wantStatClient: "1.2.3.4",
</s>
domain: domain,
reason filtering.Reason wantStatResult stats.Result }{{ name: "success_udp", domain: domain, proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: "", wantStatClient: "1.2.3.4",
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
reason: filtering.NotFilteredNotFound, wantStatResult: stats.RNotFiltered, }, { name: "success_tls_clientid", proto: proxy.ProtoTLS, addr: &net.TCPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "cli42", wantLogProto: querylog.ClientProtoDoT, wantStatClient: "cli42",
</s>
domain: domain,
reason: filtering.NotFilteredNotFound, wantStatResult: stats.RNotFiltered, }, { name: "success_tls_clientid", domain: domain, proto: proxy.ProtoTLS, addr: &net.TCPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "cli42", wantLogProto: querylog.ClientProtoDoT, wantStatClient: "cli42",
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
reason: filtering.NotFilteredNotFound, wantStatResult: stats.RNotFiltered, }, { name: "success_tls", proto: proxy.ProtoTLS, addr: &net.TCPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: querylog.ClientProtoDoT,
</s>
domain: domain,
reason: filtering.NotFilteredNotFound, wantStatResult: stats.RNotFiltered, }, { name: "success_tls", domain: domain, proto: proxy.ProtoTLS, addr: &net.TCPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: querylog.ClientProtoDoT,
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
reason: filtering.NotFilteredNotFound, wantStatResult: stats.RNotFiltered, }, { name: "success_quic", proto: proxy.ProtoQUIC, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: querylog.ClientProtoDoQ, wantStatClient: "1.2.3.4",
</s>
domain: domain,
reason: filtering.NotFilteredNotFound, wantStatResult: stats.RNotFiltered, }, { name: "success_quic", domain: domain, proto: proxy.ProtoQUIC, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: querylog.ClientProtoDoQ, wantStatClient: "1.2.3.4",
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
wantStatResult: stats.RNotFiltered, }, { name: "success_https", proto: proxy.ProtoHTTPS, addr: &net.TCPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: querylog.ClientProtoDoH, wantStatClient: "1.2.3.4",
</s>
domain: domain,
wantStatResult: stats.RNotFiltered, }, { name: "success_https", domain: domain, proto: proxy.ProtoHTTPS, addr: &net.TCPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: querylog.ClientProtoDoH, wantStatClient: "1.2.3.4",
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
wantStatResult: stats.RNotFiltered, }, { name: "success_dnscrypt", proto: proxy.ProtoDNSCrypt, addr: &net.TCPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: querylog.ClientProtoDNSCrypt, wantStatClient: "1.2.3.4",
</s>
domain: domain,
wantStatResult: stats.RNotFiltered, }, { name: "success_dnscrypt", domain: domain, proto: proxy.ProtoDNSCrypt, addr: &net.TCPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: querylog.ClientProtoDNSCrypt, wantStatClient: "1.2.3.4",
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
reason: filtering.NotFilteredNotFound, wantStatResult: stats.RNotFiltered, }, { name: "success_udp_filtered", proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: "", wantStatClient: "1.2.3.4",
</s>
domain: domain,
reason: filtering.NotFilteredNotFound, wantStatResult: stats.RNotFiltered, }, { name: "success_udp_filtered", domain: domain, proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: "", wantStatClient: "1.2.3.4",
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
wantStatResult: stats.RFiltered, }, { name: "success_udp_sb", proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: "", wantStatClient: "1.2.3.4", wantCode: resultCodeSuccess,
</s>
domain: domain,
wantStatResult: stats.RFiltered, }, { name: "success_udp_sb", domain: domain, proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: "", wantStatClient: "1.2.3.4", wantCode: resultCodeSuccess,
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
}, { name: "success_udp_ss", proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: "", wantStatClient: "1.2.3.4", wantCode: resultCodeSuccess,
</s>
domain: domain,
}, { name: "success_udp_ss", domain: domain, proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: "", wantStatClient: "1.2.3.4", wantCode: resultCodeSuccess,
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
wantStatResult: stats.RSafeSearch, }, { name: "success_udp_pc", proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: "",
</s>
domain: domain,
wantStatResult: stats.RSafeSearch, }, { name: "success_udp_pc", domain: domain, proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 1234}, clientID: "", wantLogProto: "",
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
reason: filtering.FilteredParental, wantStatResult: stats.RParental, }} ups, err := upstream.AddressToUpstream("1.1.1.1", nil) require.NoError(t, err) for _, tc := range testCases {
</s> remove {num: 0, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 1, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 2, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, </s> add {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, </s> remove e.Domain = e.Domain[:len(e.Domain)-1] // remove last "." </s> add if e.Domain != "." { // Remove last ".", but save the domain as is for "." queries. e.Domain = e.Domain[:len(e.Domain)-1] } </s> remove func TestProcessQueryLogsAndStats(t *testing.T) { </s> add func TestServer_ProcessQueryLogsAndStats(t *testing.T) { const domain = "example.com."
}, { name: "success_udp_pc_empty_fqdn", domain: ".", proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 5}, Port: 1234}, clientID: "", wantLogProto: "", wantStatClient: "1.2.3.5", wantCode: resultCodeSuccess, reason: filtering.FilteredParental, wantStatResult: stats.RParental,
reason: filtering.FilteredParental, wantStatResult: stats.RParental, }, { name: "success_udp_pc_empty_fqdn", domain: ".", proto: proxy.ProtoUDP, addr: &net.UDPAddr{IP: net.IP{1, 2, 3, 5}, Port: 1234}, clientID: "", wantLogProto: "", wantStatClient: "1.2.3.5", wantCode: resultCodeSuccess, reason: filtering.FilteredParental, wantStatResult: stats.RParental, }} ups, err := upstream.AddressToUpstream("1.1.1.1", nil) require.NoError(t, err) for _, tc := range testCases {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
} t.Run(tc.name, func(t *testing.T) { req := &dns.Msg{ Question: []dns.Question{{ Name: "example.com.", }}, } pctx := &proxy.DNSContext{ Proto: tc.proto, Req: req,
</s> remove e.Domain = e.Domain[:len(e.Domain)-1] // remove last "." </s> add if e.Domain != "." { // Remove last ".", but save the domain as is for "." queries. e.Domain = e.Domain[:len(e.Domain)-1] } </s> remove func TestProcessQueryLogsAndStats(t *testing.T) { </s> add func TestServer_ProcessQueryLogsAndStats(t *testing.T) { const domain = "example.com." </s> remove {num: 0, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 1, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 2, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, </s> add {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)},
Name: tc.domain,
} t.Run(tc.name, func(t *testing.T) { req := &dns.Msg{ Question: []dns.Question{{ Name: tc.domain, }}, } pctx := &proxy.DNSContext{ Proto: tc.proto, Req: req,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/dnsforward/stats_test.go
func newLogEntry(params *AddParams) (entry *logEntry) { q := params.Question.Question[0] entry = &logEntry{ // TODO(d.kolyshev): Export this timestamp to func params. Time: time.Now(),
</s> remove Time: time.Now(), QHost: strings.ToLower(q.Name[:len(q.Name)-1]), </s> add Time: time.Now(), QHost: qHost, </s> remove func TestProcessQueryLogsAndStats(t *testing.T) { </s> add func TestServer_ProcessQueryLogsAndStats(t *testing.T) { const domain = "example.com." </s> remove e.Domain = e.Domain[:len(e.Domain)-1] // remove last "." </s> add if e.Domain != "." { // Remove last ".", but save the domain as is for "." queries. e.Domain = e.Domain[:len(e.Domain)-1] }
qHost := q.Name if qHost != "." { qHost = strings.ToLower(q.Name[:len(q.Name)-1]) }
func newLogEntry(params *AddParams) (entry *logEntry) { q := params.Question.Question[0] qHost := q.Name if qHost != "." { qHost = strings.ToLower(q.Name[:len(q.Name)-1]) } entry = &logEntry{ // TODO(d.kolyshev): Export this timestamp to func params. Time: time.Now(),
[ "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/querylog/qlog.go
q := params.Question.Question[0] entry = &logEntry{ // TODO(d.kolyshev): Export this timestamp to func params. Time: time.Now(), QHost: strings.ToLower(q.Name[:len(q.Name)-1]), QType: dns.Type(q.Qtype).String(), QClass: dns.Class(q.Qclass).String(), ClientID: params.ClientID, ClientProto: params.ClientProto,
</s> remove e.Domain = e.Domain[:len(e.Domain)-1] // remove last "." </s> add if e.Domain != "." { // Remove last ".", but save the domain as is for "." queries. e.Domain = e.Domain[:len(e.Domain)-1] } </s> remove func TestProcessQueryLogsAndStats(t *testing.T) { </s> add func TestServer_ProcessQueryLogsAndStats(t *testing.T) { const domain = "example.com."
Time: time.Now(), QHost: qHost,
q := params.Question.Question[0] entry = &logEntry{ // TODO(d.kolyshev): Export this timestamp to func params. Time: time.Now(), QHost: qHost, Time: time.Now(), QHost: qHost, Time: time.Now(), QHost: qHost, QType: dns.Type(q.Qtype).String(), QClass: dns.Class(q.Qclass).String(), ClientID: params.ClientID, ClientProto: params.ClientProto,
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/querylog/qlog.go
require.NoError(t, l.flushLogBuffer()) // Add memory entries. addEntry(l, "test.example.org", net.IPv4(1, 1, 1, 3), net.IPv4(2, 2, 2, 3)) addEntry(l, "example.com", net.IPv4(1, 1, 1, 4), net.IPv4(2, 2, 2, 4)) type tcAssertion struct { host string answer net.IP client net.IP num int
</s> remove {num: 0, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 1, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 2, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, </s> add {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, </s> remove {num: 0, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 1, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 2, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, </s> add {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, </s> remove func TestProcessQueryLogsAndStats(t *testing.T) { </s> add func TestServer_ProcessQueryLogsAndStats(t *testing.T) { const domain = "example.com."
addEntry(l, "", net.IPv4(1, 1, 1, 5), net.IPv4(2, 2, 2, 5))
require.NoError(t, l.flushLogBuffer()) // Add memory entries. addEntry(l, "test.example.org", net.IPv4(1, 1, 1, 3), net.IPv4(2, 2, 2, 3)) addEntry(l, "example.com", net.IPv4(1, 1, 1, 4), net.IPv4(2, 2, 2, 4)) addEntry(l, "", net.IPv4(1, 1, 1, 5), net.IPv4(2, 2, 2, 5)) type tcAssertion struct { host string answer net.IP client net.IP num int
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/querylog/qlog_test.go
}{{ name: "all", sCr: []searchCriterion{}, want: []tcAssertion{ {num: 0, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 1, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 2, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, }, }, { name: "by_domain_strict", sCr: []searchCriterion{{ criterionType: ctTerm,
</s> remove {num: 0, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 1, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 2, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, </s> add {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)},
{num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)},
}{{ name: "all", sCr: []searchCriterion{}, want: []tcAssertion{ {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, }, }, { name: "by_domain_strict", sCr: []searchCriterion{{ criterionType: ctTerm,
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/querylog/qlog_test.go
strict: false, value: "2.2.2", }}, want: []tcAssertion{ {num: 0, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 1, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 2, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, }, }} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) {
</s> remove {num: 0, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 1, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 2, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, </s> add {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, </s> remove Name: "example.com.", </s> add Name: tc.domain,
{num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)},
strict: false, value: "2.2.2", }}, want: []tcAssertion{ {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, {num: 0, host: ".", answer: net.IPv4(1, 1, 1, 5), client: net.IPv4(2, 2, 2, 5)}, {num: 1, host: "example.com", answer: net.IPv4(1, 1, 1, 4), client: net.IPv4(2, 2, 2, 4)}, {num: 2, host: "test.example.org", answer: net.IPv4(1, 1, 1, 3), client: net.IPv4(2, 2, 2, 3)}, {num: 3, host: "example.org", answer: net.IPv4(1, 1, 1, 2), client: net.IPv4(2, 2, 2, 2)}, {num: 4, host: "example.org", answer: net.IPv4(1, 1, 1, 1), client: net.IPv4(2, 2, 2, 1)}, }, }} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: stat empty queries Merge in DNS/adguard-home from 5910-stats-malformed-entry to master Squashed commit of the following: commit ea6718daf0d65dc4b13cd08430da7fdeb6f7fd5b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 17:34:50 2023 +0400 all: imp docs commit 5341c5b351c87556b91a7f692960edc76f44b21a Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:47:13 2023 +0400 all: docs commit 1703c421f501484a80ddcf4ca1ba24f71fa5d225 Merge: f56b62490 d26c480d0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 16:46:13 2023 +0400 Merge remote-tracking branch 'origin/master' into 5910-stats-malformed-entry # Conflicts: # CHANGELOG.md commit f56b62490c7033e1d0b620a9cb4ba8de64862de0 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:49:43 2023 +0400 all: docs commit be954a8cab950d038c8cf08b95158069fa0747ba Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:44:05 2023 +0400 querylog: empty queries commit 0cda309d402156e750c7387e471da6795aa43bd6 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 19 14:26:41 2023 +0400 dnsforward: stat empty queries
https://github.com/AdguardTeam/AdGuardHome/commit/371261b2c66a0b9b64c8c3e2262eb11b982b8572
internal/querylog/qlog_test.go
} // go through each element and delete if url matches config.Lock() newFilters := config.Filters[:0] for _, filter := range config.Filters {
</s> remove return fmt.Errorf("Refusing to stop forwarding DNS server: not running") </s> add return nil </s> remove return fmt.Errorf("Refusing to reconfigure forwarding DNS server: not running") </s> add return nil
// Stop DNS server: // we close urlfilter object which in turn closes file descriptors to filter files. // Otherwise, Windows won't allow us to remove the file which is being currently used. _ = dnsServer.Stop()
} // Stop DNS server: // we close urlfilter object which in turn closes file descriptors to filter files. // Otherwise, Windows won't allow us to remove the file which is being currently used. _ = dnsServer.Stop() // go through each element and delete if url matches config.Lock() newFilters := config.Filters[:0] for _, filter := range config.Filters {
[ "keep", "add", "keep", "keep", "keep", "keep" ]
- /filtering/remove_url: windows: remove filter file only after DNS server has been stopped Otherwise, os.Remove() will return with an error "file is being used".
https://github.com/AdguardTeam/AdGuardHome/commit/375e410aa310c24ec0e95ee48ebd40675d5df1e7
home/control.go
err := os.Remove(filter.Path()) if err != nil && !os.IsNotExist(err) { httpError(w, http.StatusInternalServerError, "Couldn't remove the filter file: %s", err) return } log.Debug("os.Remove(%s)", filter.Path())
</s> remove return fmt.Errorf("Refusing to stop forwarding DNS server: not running") </s> add return nil </s> remove return fmt.Errorf("Refusing to reconfigure forwarding DNS server: not running") </s> add return nil
config.Unlock()
err := os.Remove(filter.Path()) if err != nil && !os.IsNotExist(err) { config.Unlock() httpError(w, http.StatusInternalServerError, "Couldn't remove the filter file: %s", err) return } log.Debug("os.Remove(%s)", filter.Path())
[ "keep", "add", "keep", "keep", "keep", "keep" ]
- /filtering/remove_url: windows: remove filter file only after DNS server has been stopped Otherwise, os.Remove() will return with an error "file is being used".
https://github.com/AdguardTeam/AdGuardHome/commit/375e410aa310c24ec0e95ee48ebd40675d5df1e7
home/control.go
config.Unlock() httpError(w, http.StatusInternalServerError, "Couldn't remove the filter file: %s", err) return } } } // Update the configuration after removing filter files config.Filters = newFilters config.Unlock()
</s> remove return fmt.Errorf("Refusing to stop forwarding DNS server: not running") </s> add return nil </s> remove return fmt.Errorf("Refusing to reconfigure forwarding DNS server: not running") </s> add return nil
log.Debug("os.Remove(%s)", filter.Path())
config.Unlock() httpError(w, http.StatusInternalServerError, "Couldn't remove the filter file: %s", err) return } log.Debug("os.Remove(%s)", filter.Path()) } } // Update the configuration after removing filter files config.Filters = newFilters config.Unlock()
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
- /filtering/remove_url: windows: remove filter file only after DNS server has been stopped Otherwise, os.Remove() will return with an error "file is being used".
https://github.com/AdguardTeam/AdGuardHome/commit/375e410aa310c24ec0e95ee48ebd40675d5df1e7
home/control.go
} func reconfigureDNSServer() error { if !isRunning() { return fmt.Errorf("Refusing to reconfigure forwarding DNS server: not running") } config, err := generateServerConfig() if err != nil { return errorx.Decorate(err, "Couldn't start forwarding DNS server")
</s> remove return fmt.Errorf("Refusing to stop forwarding DNS server: not running") </s> add return nil
return nil
} func reconfigureDNSServer() error { if !isRunning() { return nil } config, err := generateServerConfig() if err != nil { return errorx.Decorate(err, "Couldn't start forwarding DNS server")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
- /filtering/remove_url: windows: remove filter file only after DNS server has been stopped Otherwise, os.Remove() will return with an error "file is being used".
https://github.com/AdguardTeam/AdGuardHome/commit/375e410aa310c24ec0e95ee48ebd40675d5df1e7
home/dns.go
} func stopDNSServer() error { if !isRunning() { return fmt.Errorf("Refusing to stop forwarding DNS server: not running") } err := dnsServer.Stop() if err != nil { return errorx.Decorate(err, "Couldn't stop forwarding DNS server")
</s> remove return fmt.Errorf("Refusing to reconfigure forwarding DNS server: not running") </s> add return nil
return nil
} func stopDNSServer() error { if !isRunning() { return nil } err := dnsServer.Stop() if err != nil { return errorx.Decorate(err, "Couldn't stop forwarding DNS server")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
- /filtering/remove_url: windows: remove filter file only after DNS server has been stopped Otherwise, os.Remove() will return with an error "file is being used".
https://github.com/AdguardTeam/AdGuardHome/commit/375e410aa310c24ec0e95ee48ebd40675d5df1e7
home/dns.go
// TODO(a.garipov): Adapt to AAAA as well. func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) { req := dctx.proxyCtx.Req q := req.Question[0] if q.Qtype != dns.TypeA { return resultCodeSuccess } reqHost := strings.ToLower(q.Name) host := strings.TrimSuffix(reqHost, s.autohostSuffix)
</s> remove if tc.wantIP == nil { </s> add if tc.qtyp == dns.TypeAAAA { // TODO(a.garipov): Remove this special handling // when we fully support AAAA. require.NotNil(t, pctx.Res) ans := pctx.Res.Answer require.Len(t, ans, 0) } else if tc.wantIP == nil {
// Go on processing the AAAA request despite the fact that we don't // support it yet. The expected behavior here is to respond with an // empty asnwer and not NXDOMAIN. if q.Qtype != dns.TypeA && q.Qtype != dns.TypeAAAA {
// TODO(a.garipov): Adapt to AAAA as well. func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) { req := dctx.proxyCtx.Req q := req.Question[0] // Go on processing the AAAA request despite the fact that we don't // support it yet. The expected behavior here is to respond with an // empty asnwer and not NXDOMAIN. if q.Qtype != dns.TypeA && q.Qtype != dns.TypeAAAA { return resultCodeSuccess } reqHost := strings.ToLower(q.Name) host := strings.TrimSuffix(reqHost, s.autohostSuffix)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: fix nxdomain for internal aaaa reqs Updates #2393. Squashed commit of the following: commit 5ea4d3c2f217ed800da79c3d87184d8e0956e56c Author: Ainar Garipov <[email protected]> Date: Thu Mar 25 17:01:08 2021 +0300 dnsforward: fix nxdomain for internal aaaa reqs
https://github.com/AdguardTeam/AdGuardHome/commit/3764c1dfe497a150d09272257065ea5b5a49ecf6
internal/dnsforward/dns.go
wantIP: nil, qtyp: dns.TypeA, wantRes: resultCodeSuccess, }} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { s := &Server{
</s> remove if tc.wantIP == nil { </s> add if tc.qtyp == dns.TypeAAAA { // TODO(a.garipov): Remove this special handling // when we fully support AAAA. require.NotNil(t, pctx.Res) ans := pctx.Res.Answer require.Len(t, ans, 0) } else if tc.wantIP == nil { </s> remove if q.Qtype != dns.TypeA { </s> add // Go on processing the AAAA request despite the fact that we don't // support it yet. The expected behavior here is to respond with an // empty asnwer and not NXDOMAIN. if q.Qtype != dns.TypeA && q.Qtype != dns.TypeAAAA {
}, { name: "success_internal_aaaa", host: "example.lan", suffix: defaultAutohostSuffix, wantErrMsg: "", wantIP: nil, qtyp: dns.TypeAAAA, wantRes: resultCodeSuccess,
wantIP: nil, qtyp: dns.TypeA, wantRes: resultCodeSuccess, }, { name: "success_internal_aaaa", host: "example.lan", suffix: defaultAutohostSuffix, wantErrMsg: "", wantIP: nil, qtyp: dns.TypeAAAA, wantRes: resultCodeSuccess, }} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { s := &Server{
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: fix nxdomain for internal aaaa reqs Updates #2393. Squashed commit of the following: commit 5ea4d3c2f217ed800da79c3d87184d8e0956e56c Author: Ainar Garipov <[email protected]> Date: Thu Mar 25 17:01:08 2021 +0300 dnsforward: fix nxdomain for internal aaaa reqs
https://github.com/AdguardTeam/AdGuardHome/commit/3764c1dfe497a150d09272257065ea5b5a49ecf6
internal/dnsforward/dns_test.go
assert.Equal(t, tc.wantErrMsg, dctx.err.Error()) } pctx := dctx.proxyCtx if tc.wantIP == nil { assert.Nil(t, pctx.Res) } else { require.NotNil(t, pctx.Res) ans := pctx.Res.Answer
</s> remove if q.Qtype != dns.TypeA { </s> add // Go on processing the AAAA request despite the fact that we don't // support it yet. The expected behavior here is to respond with an // empty asnwer and not NXDOMAIN. if q.Qtype != dns.TypeA && q.Qtype != dns.TypeAAAA {
if tc.qtyp == dns.TypeAAAA { // TODO(a.garipov): Remove this special handling // when we fully support AAAA. require.NotNil(t, pctx.Res) ans := pctx.Res.Answer require.Len(t, ans, 0) } else if tc.wantIP == nil {
assert.Equal(t, tc.wantErrMsg, dctx.err.Error()) } pctx := dctx.proxyCtx if tc.qtyp == dns.TypeAAAA { // TODO(a.garipov): Remove this special handling // when we fully support AAAA. require.NotNil(t, pctx.Res) ans := pctx.Res.Answer require.Len(t, ans, 0) } else if tc.wantIP == nil { assert.Nil(t, pctx.Res) } else { require.NotNil(t, pctx.Res) ans := pctx.Res.Answer
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: dnsforward: fix nxdomain for internal aaaa reqs Updates #2393. Squashed commit of the following: commit 5ea4d3c2f217ed800da79c3d87184d8e0956e56c Author: Ainar Garipov <[email protected]> Date: Thu Mar 25 17:01:08 2021 +0300 dnsforward: fix nxdomain for internal aaaa reqs
https://github.com/AdguardTeam/AdGuardHome/commit/3764c1dfe497a150d09272257065ea5b5a49ecf6
internal/dnsforward/dns_test.go
/Corefile /dnsfilter.txt /querylog.json /querylog.json.1 /client/src/helpers/translations/node_modules /client/src/helpers/translations/oneskyapp.json # Test output dnsfilter/dnsfilter.TestLotsOfRules*.pprof tests/top-1m.csv
</s> remove <div className="card"> { props.title && </s> add <div className={props.type ? `card ${props.type}` : 'card'}> {props.title && </s> remove white-space: nowrap; text-overflow: ellipsis; overflow: hidden; </s> add
/scripts/translations/node_modules /scripts/translations/oneskyapp.json
/Corefile /dnsfilter.txt /querylog.json /querylog.json.1 /scripts/translations/node_modules /scripts/translations/oneskyapp.json /scripts/translations/node_modules /scripts/translations/oneskyapp.json # Test output dnsfilter/dnsfilter.TestLotsOfRules*.pprof tests/top-1m.csv
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
.gitignore
"example_comment_hash": "# Also a comment", "all_filters_up_to_date_toast": "All filters are already up-to-date", "updated_upstream_dns_toast": "Updated the upstream DNS servers", "dns_test_ok_toast": "Specified DNS servers are working correctly", "dns_test_not_ok_toast": "Server '{{key}}': could not be used, please check that you've written it correctly", "unblock_btn": "Unblock", "block_btn": "Block", "time_table_header": "Time", "domain_name_table_header": "Domain name", "type_table_header": "Type",
</s> remove <div className="card"> { props.title && </s> add <div className={props.type ? `card ${props.type}` : 'card'}> {props.title && </s> remove white-space: nowrap; text-overflow: ellipsis; overflow: hidden; </s> add
"dns_test_not_ok_toast": "Server \"{{key}}\": could not be used, please check that you've written it correctly",
"example_comment_hash": "# Also a comment", "all_filters_up_to_date_toast": "All filters are already up-to-date", "updated_upstream_dns_toast": "Updated the upstream DNS servers", "dns_test_ok_toast": "Specified DNS servers are working correctly", "dns_test_not_ok_toast": "Server \"{{key}}\": could not be used, please check that you've written it correctly", "unblock_btn": "Unblock", "block_btn": "Block", "time_table_header": "Time", "domain_name_table_header": "Domain name", "type_table_header": "Type",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/__locales/en.json
return ( <div className="row"> <div className="col-sm-6 col-lg-3"> <Card bodyType="card-wrap"> <div className="card-body-stats"> <div className="card-value card-value-stats text-blue"> {dnsQueries} </div> <div className="card-title-stats">
</s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Trans>blocked_by</Trans> <a href="#filters"><Trans>filters</Trans></a> </s> add <Trans>blocked_by</Trans><a href="#filters"> <Trans>filters</Trans></a> </s> remove <div className="card"> { props.title && </s> add <div className={props.type ? `card ${props.type}` : 'card'}> {props.title &&
<Card type="card--full" bodyType="card-wrap">
return ( <div className="row"> <div className="col-sm-6 col-lg-3"> <Card type="card--full" bodyType="card-wrap"> <div className="card-body-stats"> <div className="card-value card-value-stats text-blue"> {dnsQueries} </div> <div className="card-title-stats">
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/Dashboard/Statistics.js
</div> </Card> </div> <div className="col-sm-6 col-lg-3"> <Card bodyType="card-wrap"> <div className="card-body-stats"> <div className="card-value card-value-stats text-red"> {blockedFiltering} </div> <div className="card-value card-value-percent text-red">
</s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Trans>blocked_by</Trans> <a href="#filters"><Trans>filters</Trans></a> </s> add <Trans>blocked_by</Trans><a href="#filters"> <Trans>filters</Trans></a> </s> remove <div className="card"> { props.title && </s> add <div className={props.type ? `card ${props.type}` : 'card'}> {props.title &&
<Card type="card--full" bodyType="card-wrap">
</div> </Card> </div> <div className="col-sm-6 col-lg-3"> <Card type="card--full" bodyType="card-wrap"> <div className="card-body-stats"> <div className="card-value card-value-stats text-red"> {blockedFiltering} </div> <div className="card-value card-value-percent text-red">
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/Dashboard/Statistics.js
<div className="card-value card-value-percent text-red"> {getPercent(dnsQueries, blockedFiltering)} </div> <div className="card-title-stats"> <Trans>blocked_by</Trans> <a href="#filters"><Trans>filters</Trans></a> </div> </div> <div className="card-chart-bg"> <Line data={filteringData} color={STATUS_COLORS.red}/> </div>
</s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <div className="card"> { props.title && </s> add <div className={props.type ? `card ${props.type}` : 'card'}> {props.title &&
<Trans>blocked_by</Trans><a href="#filters"> <Trans>filters</Trans></a>
<div className="card-value card-value-percent text-red"> {getPercent(dnsQueries, blockedFiltering)} </div> <div className="card-title-stats"> <Trans>blocked_by</Trans><a href="#filters"> <Trans>filters</Trans></a> </div> </div> <div className="card-chart-bg"> <Line data={filteringData} color={STATUS_COLORS.red}/> </div>
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/Dashboard/Statistics.js
</div> </Card> </div> <div className="col-sm-6 col-lg-3"> <Card bodyType="card-wrap"> <div className="card-body-stats"> <div className="card-value card-value-stats text-green"> {replacedSafebrowsing} </div> <div className="card-value card-value-percent text-green">
</s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Trans>blocked_by</Trans> <a href="#filters"><Trans>filters</Trans></a> </s> add <Trans>blocked_by</Trans><a href="#filters"> <Trans>filters</Trans></a> </s> remove <div className="card"> { props.title && </s> add <div className={props.type ? `card ${props.type}` : 'card'}> {props.title &&
<Card type="card--full" bodyType="card-wrap">
</div> </Card> </div> <div className="col-sm-6 col-lg-3"> <Card type="card--full" bodyType="card-wrap"> <div className="card-body-stats"> <div className="card-value card-value-stats text-green"> {replacedSafebrowsing} </div> <div className="card-value card-value-percent text-green">
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/Dashboard/Statistics.js
</div> </Card> </div> <div className="col-sm-6 col-lg-3"> <Card bodyType="card-wrap"> <div className="card-body-stats"> <div className="card-value card-value-stats text-yellow"> {replacedParental} </div> <div className="card-value card-value-percent text-yellow">
</s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Trans>blocked_by</Trans> <a href="#filters"><Trans>filters</Trans></a> </s> add <Trans>blocked_by</Trans><a href="#filters"> <Trans>filters</Trans></a> </s> remove <div className="card"> { props.title && </s> add <div className={props.type ? `card ${props.type}` : 'card'}> {props.title &&
<Card type="card--full" bodyType="card-wrap">
</div> </Card> </div> <div className="col-sm-6 col-lg-3"> <Card type="card--full" bodyType="card-wrap"> <div className="card-body-stats"> <div className="card-value card-value-stats text-yellow"> {replacedParental} </div> <div className="card-value card-value-percent text-yellow">
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/Dashboard/Statistics.js
.nav-tabs .nav-link { width: auto; border-bottom: 1px solid transparent; } .mobile-menu { position: static; display: flex; padding: 0;
</s> remove white-space: nowrap; text-overflow: ellipsis; overflow: hidden; </s> add
font-size: 13px; white-space: nowrap;
.nav-tabs .nav-link { width: auto; border-bottom: 1px solid transparent; font-size: 13px; white-space: nowrap; } .mobile-menu { position: static; display: flex; padding: 0;
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/Header/Header.css
.nav-version { padding: 0; font-size: 0.85rem; } } .dns-status {
</s> remove white-space: nowrap; text-overflow: ellipsis; overflow: hidden; </s> add
} } @media screen and (min-width: 1280px) { .nav-tabs .nav-link { font-size: 14px; } .nav-version {
.nav-version { padding: 0; } } @media screen and (min-width: 1280px) { .nav-tabs .nav-link { font-size: 14px; } .nav-version { font-size: 0.85rem; } } .dns-status {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/Header/Header.css
}; render() { const menuClass = classnames({ 'col-lg mobile-menu': true, 'mobile-menu--active': this.props.isMenuOpen, }); return ( <Fragment>
</s> remove <div className="card"> { props.title && </s> add <div className={props.type ? `card ${props.type}` : 'card'}> {props.title && </s> remove <ul className="nav nav-tabs border-0 flex-column flex-lg-row"> </s> add <ul className="nav nav-tabs border-0 flex-column flex-lg-row flex-nowrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap">
'col-lg-6 mobile-menu': true,
}; render() { const menuClass = classnames({ 'col-lg-6 mobile-menu': true, 'mobile-menu--active': this.props.isMenuOpen, }); return ( <Fragment>
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/Header/Menu.js
return ( <Fragment> <div className={menuClass}> <ul className="nav nav-tabs border-0 flex-column flex-lg-row"> <li className="nav-item border-bottom d-lg-none" onClick={this.toggleMenu}> <div className="nav-link nav-link--back"> <svg className="nav-icon" fill="none" height="24" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="m19 12h-14"/><path d="m12 19-7-7 7-7"/></svg> <Trans>back</Trans> </div>
</s> remove 'col-lg mobile-menu': true, </s> add 'col-lg-6 mobile-menu': true, </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <div className="card"> { props.title && </s> add <div className={props.type ? `card ${props.type}` : 'card'}> {props.title && </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap">
<ul className="nav nav-tabs border-0 flex-column flex-lg-row flex-nowrap">
return ( <Fragment> <div className={menuClass}> <ul className="nav nav-tabs border-0 flex-column flex-lg-row flex-nowrap"> <li className="nav-item border-bottom d-lg-none" onClick={this.toggleMenu}> <div className="nav-link nav-link--back"> <svg className="nav-icon" fill="none" height="24" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="m19 12h-14"/><path d="m12 19-7-7 7-7"/></svg> <Trans>back</Trans> </div>
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/Header/Menu.js
.card-title-stats { color: #9aa0ac; } .card-body-stats { position: relative; flex: 1 1 auto;
</s> remove white-space: nowrap; text-overflow: ellipsis; overflow: hidden; </s> add
font-size: 13px;
.card-title-stats { font-size: 13px; color: #9aa0ac; } .card-body-stats { position: relative; flex: 1 1 auto;
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/ui/Card.css
} .card-title-stats { color: #9aa0ac; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .card-body-stats { position: relative; flex: 1 1 auto;
</s>
} .card-title-stats { color: #9aa0ac; } .card-body-stats { position: relative; flex: 1 1 auto;
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/ui/Card.css
position: relative; flex: 1 1 auto; margin: 0; padding: 1rem 1.5rem; } .card-value-stats { display: block;
</s> remove white-space: nowrap; text-overflow: ellipsis; overflow: hidden; </s> add
height: calc(100% - 3rem);
position: relative; flex: 1 1 auto; height: calc(100% - 3rem); margin: 0; padding: 1rem 1.5rem; } .card-value-stats { display: block;
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/ui/Card.css
import './Card.css'; const Card = props => ( <div className="card"> { props.title && <div className="card-header with-border"> <div className="card-inner"> <div className="card-title"> {props.title} </div>
</s> remove 'col-lg mobile-menu': true, </s> add 'col-lg-6 mobile-menu': true, </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap"> </s> remove <Card bodyType="card-wrap"> </s> add <Card type="card--full" bodyType="card-wrap">
<div className={props.type ? `card ${props.type}` : 'card'}> {props.title &&
import './Card.css'; const Card = props => ( <div className={props.type ? `card ${props.type}` : 'card'}> {props.title && <div className={props.type ? `card ${props.type}` : 'card'}> {props.title && <div className="card-header with-border"> <div className="card-inner"> <div className="card-title"> {props.title} </div>
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/ui/Card.js
Card.propTypes = { title: PropTypes.string, subtitle: PropTypes.string, bodyType: PropTypes.string, refresh: PropTypes.node, children: PropTypes.node.isRequired, }; export default Card;
</s> remove 'col-lg mobile-menu': true, </s> add 'col-lg-6 mobile-menu': true, </s> remove <div className="card"> { props.title && </s> add <div className={props.type ? `card ${props.type}` : 'card'}> {props.title && </s> remove white-space: nowrap; text-overflow: ellipsis; overflow: hidden; </s> add
type: PropTypes.string,
Card.propTypes = { title: PropTypes.string, subtitle: PropTypes.string, bodyType: PropTypes.string, type: PropTypes.string, refresh: PropTypes.node, children: PropTypes.node.isRequired, }; export default Card;
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Move translations script to scripts folder
https://github.com/AdguardTeam/AdGuardHome/commit/3779407291cb970719d6c4964dfa7d283edea5a1
client/src/components/ui/Card.js
func (d *Plugin) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) { start := time.Now() requests.Inc() // capture the written answer rrw := dnstest.NewRecorder(w) rcode, err, result := d.serveDNSInternal(ctx, rrw, r) if rcode > 0 {
</s> remove state := request.Request{W: w, Req: r} </s> add </s> remove logRequest(rrw.Msg, result, time.Since(start)) </s> add logRequest(rrw.Msg, result, time.Since(start), ip) </s> remove func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration) { </s> add func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration, ip string) {
state := request.Request{W: w, Req: r} ip := state.IP()
func (d *Plugin) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) { start := time.Now() requests.Inc() state := request.Request{W: w, Req: r} ip := state.IP() // capture the written answer rrw := dnstest.NewRecorder(w) rcode, err, result := d.serveDNSInternal(ctx, rrw, r) if rcode > 0 {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
coredns plugin -- forgot to pass client's IP to querylog, fix that. Closes #311
https://github.com/AdguardTeam/AdGuardHome/commit/379e14c28b18c0632e42760aca94aa7b72b05885
coredns_plugin/coredns_plugin.go
rrw := dnstest.NewRecorder(w) rcode, err, result := d.serveDNSInternal(ctx, rrw, r) if rcode > 0 { // actually send the answer if we have one state := request.Request{W: w, Req: r} answer := new(dns.Msg) answer.SetRcode(r, rcode) state.SizeAndDo(answer) w.WriteMsg(answer) }
</s> remove func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration) { </s> add func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration, ip string) { </s> remove logRequest(rrw.Msg, result, time.Since(start)) </s> add logRequest(rrw.Msg, result, time.Since(start), ip)
rrw := dnstest.NewRecorder(w) rcode, err, result := d.serveDNSInternal(ctx, rrw, r) if rcode > 0 { // actually send the answer if we have one answer := new(dns.Msg) answer.SetRcode(r, rcode) state.SizeAndDo(answer) w.WriteMsg(answer) }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
coredns plugin -- forgot to pass client's IP to querylog, fix that. Closes #311
https://github.com/AdguardTeam/AdGuardHome/commit/379e14c28b18c0632e42760aca94aa7b72b05885
coredns_plugin/coredns_plugin.go
} // log if d.QueryLogEnabled { logRequest(rrw.Msg, result, time.Since(start)) } return rcode, err } func (d *Plugin) Name() string { return "dnsfilter" }
</s> remove func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration) { </s> add func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration, ip string) { </s> remove state := request.Request{W: w, Req: r} </s> add
logRequest(rrw.Msg, result, time.Since(start), ip)
} // log if d.QueryLogEnabled { logRequest(rrw.Msg, result, time.Since(start), ip) } return rcode, err } func (d *Plugin) Name() string { return "dnsfilter" }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
coredns plugin -- forgot to pass client's IP to querylog, fix that. Closes #311
https://github.com/AdguardTeam/AdGuardHome/commit/379e14c28b18c0632e42760aca94aa7b72b05885
coredns_plugin/coredns_plugin.go
Time time.Time Elapsed time.Duration } func init() { logBuffer.SetCapacity(1000) }
</s> remove func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration) { </s> add func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration, ip string) { </s> remove logRequest(rrw.Msg, result, time.Since(start)) </s> add logRequest(rrw.Msg, result, time.Since(start), ip) </s> remove state := request.Request{W: w, Req: r} </s> add
IP string
Time time.Time Elapsed time.Duration IP string } func init() { logBuffer.SetCapacity(1000) }
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
coredns plugin -- forgot to pass client's IP to querylog, fix that. Closes #311
https://github.com/AdguardTeam/AdGuardHome/commit/379e14c28b18c0632e42760aca94aa7b72b05885
coredns_plugin/querylog.go
func init() { logBuffer.SetCapacity(1000) } func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration) { entry := logEntry{ R: r, Result: result, Time: time.Now(), Elapsed: elapsed,
</s> remove logRequest(rrw.Msg, result, time.Since(start)) </s> add logRequest(rrw.Msg, result, time.Since(start), ip) </s> remove state := request.Request{W: w, Req: r} </s> add
func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration, ip string) {
func init() { logBuffer.SetCapacity(1000) } func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration, ip string) { entry := logEntry{ R: r, Result: result, Time: time.Now(), Elapsed: elapsed,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
coredns plugin -- forgot to pass client's IP to querylog, fix that. Closes #311
https://github.com/AdguardTeam/AdGuardHome/commit/379e14c28b18c0632e42760aca94aa7b72b05885
coredns_plugin/querylog.go
R: r, Result: result, Time: time.Now(), Elapsed: elapsed, } logBuffer.Enqueue(entry) } func handler(w http.ResponseWriter, r *http.Request) { values := logBuffer.Values()
</s> remove func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration) { </s> add func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration, ip string) { </s> remove logRequest(rrw.Msg, result, time.Since(start)) </s> add logRequest(rrw.Msg, result, time.Since(start), ip)
IP: ip,
R: r, Result: result, Time: time.Now(), Elapsed: elapsed, IP: ip, } logBuffer.Enqueue(entry) } func handler(w http.ResponseWriter, r *http.Request) { values := logBuffer.Values()
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
coredns plugin -- forgot to pass client's IP to querylog, fix that. Closes #311
https://github.com/AdguardTeam/AdGuardHome/commit/379e14c28b18c0632e42760aca94aa7b72b05885
coredns_plugin/querylog.go
jsonentry := map[string]interface{}{ "reason": entry.Result.Reason.String(), "elapsed_ms": strconv.FormatFloat(entry.Elapsed.Seconds()*1000, 'f', -1, 64), "time": entry.Time.Format(time.RFC3339), } question := map[string]interface{}{ "host": strings.ToLower(strings.TrimSuffix(entry.R.Question[0].Name, ".")), "type": dns.Type(entry.R.Question[0].Qtype).String(), "class": dns.Class(entry.R.Question[0].Qclass).String(), }
</s> remove state := request.Request{W: w, Req: r} </s> add </s> remove func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration) { </s> add func logRequest(r *dns.Msg, result dnsfilter.Result, elapsed time.Duration, ip string) { </s> remove logRequest(rrw.Msg, result, time.Since(start)) </s> add logRequest(rrw.Msg, result, time.Since(start), ip)
"client": entry.IP,
jsonentry := map[string]interface{}{ "reason": entry.Result.Reason.String(), "elapsed_ms": strconv.FormatFloat(entry.Elapsed.Seconds()*1000, 'f', -1, 64), "time": entry.Time.Format(time.RFC3339), "client": entry.IP, } question := map[string]interface{}{ "host": strings.ToLower(strings.TrimSuffix(entry.R.Question[0].Name, ".")), "type": dns.Type(entry.R.Question[0].Qtype).String(), "class": dns.Class(entry.R.Question[0].Qclass).String(), }
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
coredns plugin -- forgot to pass client's IP to querylog, fix that. Closes #311
https://github.com/AdguardTeam/AdGuardHome/commit/379e14c28b18c0632e42760aca94aa7b72b05885
coredns_plugin/querylog.go
// ----- // stats // ----- func handleStats(w http.ResponseWriter, r *http.Request) { histrical := generateMapFromStats(&statistics.PerHour, 0, 24) // sum them up summed := map[string]interface{}{} for key, values := range histrical { summedValue := 0.0 floats, ok := values.([]float64) if !ok { continue } for _, v := range floats { summedValue += v } summed[key] = summedValue } summed["stats_period"] = "24 hours" json, err := json.Marshal(summed) if err != nil {
</s> remove summed["stats_period"] = "24 hours" </s> add </s> remove json, err := json.Marshal(summed) </s> add // read the body entirely body, err := ioutil.ReadAll(resp.Body) </s> remove errortext := fmt.Sprintf("Unable to marshal status json: %s", err) </s> add errortext := fmt.Sprintf("Couldn't read response body: %s", err) </s> remove http.Error(w, errortext, 500) return </s> add http.Error(w, errortext, http.StatusInternalServerError) </s> remove // handle time unit and prepare our time window size now := time.Now() timeUnitString := r.URL.Query().Get("time_unit") var stats *periodicStats var timeUnit time.Duration switch timeUnitString { case "seconds": timeUnit = time.Second stats = &statistics.PerSecond case "minutes": timeUnit = time.Minute stats = &statistics.PerMinute case "hours": timeUnit = time.Hour stats = &statistics.PerHour case "days": timeUnit = time.Hour * 24 stats = &statistics.PerDay default: http.Error(w, "Must specify valid time_unit parameter", 400) return } // parse start and end time startTime, err := time.Parse(time.RFC3339, r.URL.Query().Get("start_time")) if err != nil { errortext := fmt.Sprintf("Must specify valid start_time parameter: %s", err) log.Println(errortext) http.Error(w, errortext, 400) return } endTime, err := time.Parse(time.RFC3339, r.URL.Query().Get("end_time")) </s> add resp, err := client.Get("http://127.0.0.1:8618/stats_history?" + r.URL.RawQuery)
resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close()
// ----- // stats // ----- func handleStats(w http.ResponseWriter, r *http.Request) { resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() } summed["stats_period"] = "24 hours" json, err := json.Marshal(summed) if err != nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Implement online stats calculation in coredns plugin instead of scraping prometheus.
https://github.com/AdguardTeam/AdGuardHome/commit/37f6d38c498740c7c3db59c31da031cd5c305694
control.go
summedValue += v } summed[key] = summedValue } summed["stats_period"] = "24 hours" json, err := json.Marshal(summed) if err != nil { errortext := fmt.Sprintf("Unable to marshal status json: %s", err) log.Println(errortext)
</s> remove json, err := json.Marshal(summed) </s> add // read the body entirely body, err := ioutil.ReadAll(resp.Body) </s> remove histrical := generateMapFromStats(&statistics.PerHour, 0, 24) // sum them up summed := map[string]interface{}{} for key, values := range histrical { summedValue := 0.0 floats, ok := values.([]float64) if !ok { continue } for _, v := range floats { summedValue += v } summed[key] = summedValue </s> add resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() </s> remove errortext := fmt.Sprintf("Unable to marshal status json: %s", err) </s> add errortext := fmt.Sprintf("Couldn't read response body: %s", err) </s> remove http.Error(w, errortext, 500) </s> add http.Error(w, errortext, http.StatusBadGateway) </s> remove http.Error(w, errortext, 500) </s> add http.Error(w, errortext, http.StatusBadGateway)
summedValue += v } summed[key] = summedValue } json, err := json.Marshal(summed) if err != nil { errortext := fmt.Sprintf("Unable to marshal status json: %s", err) log.Println(errortext)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Implement online stats calculation in coredns plugin instead of scraping prometheus.
https://github.com/AdguardTeam/AdGuardHome/commit/37f6d38c498740c7c3db59c31da031cd5c305694
control.go
summed[key] = summedValue } summed["stats_period"] = "24 hours" json, err := json.Marshal(summed) if err != nil { errortext := fmt.Sprintf("Unable to marshal status json: %s", err) log.Println(errortext) http.Error(w, errortext, 500) return
</s> remove summed["stats_period"] = "24 hours" </s> add </s> remove errortext := fmt.Sprintf("Unable to marshal status json: %s", err) </s> add errortext := fmt.Sprintf("Couldn't read response body: %s", err) </s> remove http.Error(w, errortext, 500) </s> add http.Error(w, errortext, http.StatusBadGateway) </s> remove histrical := generateMapFromStats(&statistics.PerHour, 0, 24) // sum them up summed := map[string]interface{}{} for key, values := range histrical { summedValue := 0.0 floats, ok := values.([]float64) if !ok { continue } for _, v := range floats { summedValue += v } summed[key] = summedValue </s> add resp, err := client.Get("http://127.0.0.1:8618/stats") if err != nil { errortext := fmt.Sprintf("Couldn't get stats_top from coredns: %T %s\n", err, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadGateway) return } if resp != nil && resp.Body != nil { defer resp.Body.Close() </s> remove http.Error(w, errortext, 500) </s> add http.Error(w, errortext, http.StatusBadGateway)
// read the body entirely body, err := ioutil.ReadAll(resp.Body)
summed[key] = summedValue } summed["stats_period"] = "24 hours" // read the body entirely body, err := ioutil.ReadAll(resp.Body) if err != nil { errortext := fmt.Sprintf("Unable to marshal status json: %s", err) log.Println(errortext) http.Error(w, errortext, 500) return
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Implement online stats calculation in coredns plugin instead of scraping prometheus.
https://github.com/AdguardTeam/AdGuardHome/commit/37f6d38c498740c7c3db59c31da031cd5c305694
control.go