docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
sequencelengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
p.RLock()
<mask> return rcode, dnsfilter.Result{Reason: dnsfilter.FilteredSafeSearch}, err <mask> } <mask> <mask> // needs to be filtered instead <mask> result, err := p.d.CheckHost(host) <mask> if err != nil { <mask> log.Printf("plugin/dnsfilter: %s\n", err) <mask> p.RUnlock() <mask> return dns.RcodeServerFailure, dnsfilter.Result{}, fmt.Errorf("plugin/dnsfilter: %s", err) </s> Fix race conditions found by go's race detector
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
coredns_plugin/coredns_plugin.go
p.RUnlock()
<mask> if err != nil { <mask> log.Printf("plugin/dnsfilter: %s\n", err) <mask> return dns.RcodeServerFailure, dnsfilter.Result{}, fmt.Errorf("plugin/dnsfilter: %s", err) <mask> } <mask> p.RUnlock() <mask> <mask> if result.IsFiltered { <mask> switch result.Reason { </s> Fix race conditions found by go's race detector
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
coredns_plugin/coredns_plugin.go
p.RUnlock()
<mask> log.Printf("plugin/dnsfilter: %s\n", err) <mask> p.RUnlock() <mask> return dns.RcodeServerFailure, dnsfilter.Result{}, fmt.Errorf("plugin/dnsfilter: %s", err) <mask> } <mask> <mask> if result.IsFiltered { <mask> switch result.Reason { <mask> case dnsfilter.FilteredSafeBrowsing: <mask> // return cname safebrowsing.block.dns.adguard.com </s> Fix race conditions found by go's race detector
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
coredns_plugin/coredns_plugin.go
"sync"
<mask> "runtime" <mask> "strconv" <mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdguardDNS/dnsfilter" <mask> "github.com/coredns/coredns/plugin/pkg/response" <mask> "github.com/miekg/dns" <mask> ) </s> Fix race conditions found by go's race detector </s> remove soa.Serial = uint32(time.Now().Unix()) return []dns.RR{soa} </s> add soa.Serial = 100500 // faster than uint32(time.Now().Unix()) return []dns.RR{&soa}
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
coredns_plugin/querylog.go
logBufferLock sync.RWMutex
<mask> queryLogAPI = 1000 // maximum API response for /querylog <mask> ) <mask> <mask> var ( <mask> logBuffer []logEntry <mask> ) <mask> <mask> type logEntry struct { </s> Fix race conditions found by go's race detector </s> remove sync.Mutex `yaml:"-"` </s> add sync.RWMutex `yaml:"-"`
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
coredns_plugin/querylog.go
logBufferLock.Lock()
<mask> IP: ip, <mask> } <mask> var flushBuffer []logEntry <mask> <mask> logBuffer = append(logBuffer, entry) <mask> if len(logBuffer) >= logBufferCap { <mask> flushBuffer = logBuffer <mask> logBuffer = nil <mask> } </s> Fix race conditions found by go's race detector
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
coredns_plugin/querylog.go
logBufferLock.Unlock()
<mask> logBuffer = nil <mask> } <mask> if len(flushBuffer) > 0 { <mask> // write to file <mask> // do it in separate goroutine -- we are stalling DNS response this whole time <mask> go flushToFile(flushBuffer) <mask> } <mask> return </s> Fix race conditions found by go's race detector
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
coredns_plugin/querylog.go
logBufferLock.RLock()
<mask> // TODO: fetch values from disk if len(logBuffer) < queryLogSize <mask> // TODO: cache output <mask> values := logBuffer <mask> logBufferLock.RUnlock() <mask> var data = []map[string]interface{}{} <mask> for _, entry := range values { <mask> var q *dns.Msg <mask> var a *dns.Msg </s> Fix race conditions found by go's race detector </s> remove defer config.Unlock() </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
coredns_plugin/querylog.go
logBufferLock.RUnlock()
<mask> // TODO: fetch values from disk if len(logBuffer) < queryLogSize <mask> // TODO: cache output <mask> logBufferLock.RLock() <mask> values := logBuffer <mask> var data = []map[string]interface{}{} <mask> for _, entry := range values { <mask> var q *dns.Msg <mask> var a *dns.Msg <mask> </s> Fix race conditions found by go's race detector </s> remove defer config.Unlock() </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
coredns_plugin/querylog.go
"sync"
<mask> "path/filepath" <mask> "strconv" <mask> "strings" <mask> "syscall" <mask> "time" <mask> ) <mask> <mask> var client = &http.Client{ </s> Fix race conditions found by go's race detector
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
stats.go
sync.RWMutex
<mask> PerHour periodicStats <mask> PerDay periodicStats <mask> <mask> LastSeen statsEntry <mask> } <mask> <mask> var statistics stats <mask> </s> Fix race conditions found by go's race detector
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
stats.go
statistics.Lock()
<mask> } <mask> <mask> func purgeStats() { <mask> initPeriodicStats(&statistics.PerSecond) <mask> initPeriodicStats(&statistics.PerMinute) <mask> initPeriodicStats(&statistics.PerHour) <mask> initPeriodicStats(&statistics.PerDay) <mask> statistics.Unlock() <mask> } </s> Fix race conditions found by go's race detector
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
stats.go
statistics.Unlock()
<mask> initPeriodicStats(&statistics.PerMinute) <mask> initPeriodicStats(&statistics.PerHour) <mask> initPeriodicStats(&statistics.PerDay) <mask> } <mask> <mask> func runStatsCollectors() { <mask> go statsCollector(time.Second) <mask> } </s> Fix race conditions found by go's race detector
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
stats.go
statistics.Lock()
<mask> func collectStats() { <mask> now := time.Now() <mask> statsRotate(&statistics.PerSecond, now, int64(now.Sub(statistics.PerSecond.LastRotate)/time.Second)) <mask> statsRotate(&statistics.PerMinute, now, int64(now.Sub(statistics.PerMinute.LastRotate)/time.Minute)) <mask> statsRotate(&statistics.PerHour, now, int64(now.Sub(statistics.PerHour.LastRotate)/time.Hour)) <mask> statsRotate(&statistics.PerDay, now, int64(now.Sub(statistics.PerDay.LastRotate)/time.Hour/24)) <mask> statistics.Unlock() </s> Fix race conditions found by go's race detector </s> remove defer config.Unlock() </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
stats.go
statistics.Unlock()
<mask> statsRotate(&statistics.PerHour, now, int64(now.Sub(statistics.PerHour.LastRotate)/time.Hour)) <mask> statsRotate(&statistics.PerDay, now, int64(now.Sub(statistics.PerDay.LastRotate)/time.Hour/24)) <mask> <mask> // grab HTTP from prometheus <mask> resp, err := client.Get("http://127.0.0.1:9153/metrics") <mask> if resp != nil && resp.Body != nil { </s> Fix race conditions found by go's race detector
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
stats.go
statistics.Lock()
<mask> entry[key] = value <mask> } <mask> <mask> // calculate delta <mask> delta := calcDelta(entry, statistics.LastSeen) <mask> <mask> // apply delta to second/minute/hour/day <mask> applyDelta(&statistics.PerSecond, delta) <mask> applyDelta(&statistics.PerMinute, delta) <mask> applyDelta(&statistics.PerHour, delta) </s> Fix race conditions found by go's race detector
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
stats.go
statistics.Unlock()
<mask> // save last seen <mask> statistics.LastSeen = entry <mask> } <mask> <mask> func calcDelta(current, seen statsEntry) statsEntry { <mask> delta := statsEntry{} <mask> for key, currentValue := range current { </s> Fix race conditions found by go's race detector
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
stats.go
statistics.RLock()
<mask> func writeStats() error { <mask> statsFile := filepath.Join(config.ourBinaryDir, "stats.json") <mask> log.Printf("Writing JSON file: %s", statsFile) <mask> json, err := json.MarshalIndent(statistics, "", " ") <mask> statistics.RUnlock() <mask> if err != nil { <mask> log.Printf("Couldn't generate JSON: %s", err) <mask> return err </s> Fix race conditions found by go's race detector
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
stats.go
statistics.RUnlock()
<mask> statistics.RLock() <mask> json, err := json.MarshalIndent(statistics, "", " ") <mask> if err != nil { <mask> log.Printf("Couldn't generate JSON: %s", err) <mask> return err <mask> } <mask> err = ioutil.WriteFile(statsFile+".tmp", json, 0644) </s> Fix race conditions found by go's race detector
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2244c21b765e089e49fede0cc27af7f9f76bae4d
stats.go
"encoding/binary"
<mask> package home <mask> <mask> import ( <mask> "fmt" <mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/cache" </s> * rdns,whois: recheck IP addresses after some time </s> remove "sync" </s> add </s> remove "sync" </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
<mask> <mask> import ( <mask> "fmt" <mask> "strings" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" </s> * rdns,whois: recheck IP addresses after some time </s> remove "sync" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
"github.com/AdguardTeam/golibs/cache"
<mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> const ( <mask> rdnsTimeout = 3 * time.Second // max time to wait for rDNS response </s> * rdns,whois: recheck IP addresses after some time </s> remove "sync" </s> add </s> remove "sync" </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
ipChannel chan string // pass data from DNS request handling thread to rDNS thread upstream upstream.Upstream // Upstream object for our own DNS server // Contains IP addresses of clients to be resolved by rDNS // If IP address is resolved, it stays here while it's inside Clients. // If it's removed from Clients, this IP address will be resolved once again. // If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP. ipAddrs cache.Cache
<mask> <mask> // RDNS - module context <mask> type RDNS struct { <mask> clients *clientsContainer <mask> ipChannel chan string // pass data from DNS request handling thread to rDNS thread <mask> // contains IP addresses of clients to be resolved by rDNS <mask> // if IP address couldn't be resolved, it stays here forever to prevent further attempts to resolve the same IP <mask> ips map[string]bool <mask> lock sync.Mutex // synchronize access to 'ips' <mask> upstream upstream.Upstream // Upstream object for our own DNS server <mask> } <mask> <mask> // InitRDNS - create module context <mask> func InitRDNS(clients *clientsContainer) *RDNS { <mask> r := RDNS{} </s> * rdns,whois: recheck IP addresses after some time </s> remove ips map[string]bool lock sync.Mutex </s> add </s> remove if r.clients.Exists(ip, ClientSourceRDNS) { return </s> add now := uint64(time.Now().Unix()) expire := r.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired </s> remove log.Tracef("rDNS queue is full") </s> add log.Tracef("rDNS: queue is full") </s> remove // add IP to ips, if not exists r.lock.Lock() defer r.lock.Unlock() _, ok := r.ips[ip] if ok { </s> add if r.clients.Exists(ip, ClientSourceRDNS) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
cconf := cache.Config{} cconf.EnableLRU = true cconf.MaxCount = 10000 r.ipAddrs = cache.New(cconf)
<mask> log.Error("upstream.AddressToUpstream: %s", err) <mask> return nil <mask> } <mask> <mask> r.ips = make(map[string]bool) <mask> r.ipChannel = make(chan string, 256) <mask> go r.workerLoop() <mask> return &r <mask> } <mask> </s> * rdns,whois: recheck IP addresses after some time </s> remove w.ips = make(map[string]bool) </s> add cconf := cache.Config{} cconf.EnableLRU = true cconf.MaxCount = 10000 w.ipAddrs = cache.New(cconf) </s> remove log.Tracef("Adding %s for rDNS resolve", ip) </s> add log.Tracef("rDNS: adding %s", ip) </s> remove w.ips[ip] = true w.lock.Unlock() </s> add expire = make([]byte, 8) const ttl = 12 * 60 * 60 binary.BigEndian.PutUint64(expire, now+ttl) _ = w.ipAddrs.Set([]byte(ip), expire) </s> remove r.ips[ip] = true </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
now := uint64(time.Now().Unix()) expire := r.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired
<mask> } <mask> <mask> // Begin - add IP address to rDNS queue <mask> func (r *RDNS) Begin(ip string) { <mask> if r.clients.Exists(ip, ClientSourceRDNS) { <mask> return <mask> } <mask> <mask> // add IP to ips, if not exists <mask> r.lock.Lock() <mask> defer r.lock.Unlock() </s> * rdns,whois: recheck IP addresses after some time </s> remove // add IP to ips, if not exists r.lock.Lock() defer r.lock.Unlock() _, ok := r.ips[ip] if ok { </s> add if r.clients.Exists(ip, ClientSourceRDNS) { </s> remove log.Tracef("rDNS queue is full") </s> add log.Tracef("rDNS: queue is full") </s> remove w.lock.Lock() _, found := w.ips[ip] if found { w.lock.Unlock() return </s> add now := uint64(time.Now().Unix()) expire := w.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired </s> remove ipChannel chan string // pass data from DNS request handling thread to rDNS thread // contains IP addresses of clients to be resolved by rDNS // if IP address couldn't be resolved, it stays here forever to prevent further attempts to resolve the same IP ips map[string]bool lock sync.Mutex // synchronize access to 'ips' upstream upstream.Upstream // Upstream object for our own DNS server </s> add ipChannel chan string // pass data from DNS request handling thread to rDNS thread upstream upstream.Upstream // Upstream object for our own DNS server // Contains IP addresses of clients to be resolved by rDNS // If IP address is resolved, it stays here while it's inside Clients. // If it's removed from Clients, this IP address will be resolved once again. // If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP. ipAddrs cache.Cache </s> remove r.lock.Lock() delete(r.ips, ip) r.lock.Unlock() </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
expire = make([]byte, 8) const ttl = 12 * 60 * 60 binary.BigEndian.PutUint64(expire, now+ttl) _ = r.ipAddrs.Set([]byte(ip), expire)
<mask> return <mask> } <mask> // TTL expired <mask> } <mask> <mask> if r.clients.Exists(ip, ClientSourceRDNS) { <mask> return <mask> } <mask> </s> * rdns,whois: recheck IP addresses after some time </s> remove if r.clients.Exists(ip, ClientSourceRDNS) { return </s> add now := uint64(time.Now().Unix()) expire := r.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired </s> remove // add IP to ips, if not exists r.lock.Lock() defer r.lock.Unlock() _, ok := r.ips[ip] if ok { </s> add if r.clients.Exists(ip, ClientSourceRDNS) { </s> remove w.lock.Lock() _, found := w.ips[ip] if found { w.lock.Unlock() return </s> add now := uint64(time.Now().Unix()) expire := w.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired </s> remove r.lock.Lock() delete(r.ips, ip) r.lock.Unlock() </s> add </s> remove r.ips[ip] = true </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
if r.clients.Exists(ip, ClientSourceRDNS) {
<mask> if r.clients.Exists(ip, ClientSourceRDNS) { <mask> return <mask> } <mask> <mask> // add IP to ips, if not exists <mask> r.lock.Lock() <mask> defer r.lock.Unlock() <mask> _, ok := r.ips[ip] <mask> if ok { <mask> return <mask> } <mask> r.ips[ip] = true <mask> <mask> log.Tracef("Adding %s for rDNS resolve", ip) </s> * rdns,whois: recheck IP addresses after some time </s> remove r.ips[ip] = true </s> add </s> remove if r.clients.Exists(ip, ClientSourceRDNS) { return </s> add now := uint64(time.Now().Unix()) expire := r.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired </s> remove log.Tracef("Adding %s for rDNS resolve", ip) </s> add log.Tracef("rDNS: adding %s", ip) </s> remove r.lock.Lock() delete(r.ips, ip) r.lock.Unlock() </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
<mask> _, ok := r.ips[ip] <mask> if ok { <mask> return <mask> } <mask> r.ips[ip] = true <mask> <mask> log.Tracef("Adding %s for rDNS resolve", ip) <mask> select { <mask> case r.ipChannel <- ip: <mask> // </s> * rdns,whois: recheck IP addresses after some time </s> remove // add IP to ips, if not exists r.lock.Lock() defer r.lock.Unlock() _, ok := r.ips[ip] if ok { </s> add if r.clients.Exists(ip, ClientSourceRDNS) { </s> remove log.Tracef("Adding %s for rDNS resolve", ip) </s> add log.Tracef("rDNS: adding %s", ip) </s> remove log.Tracef("rDNS queue is full") </s> add log.Tracef("rDNS: queue is full") </s> remove w.ips[ip] = true w.lock.Unlock() </s> add expire = make([]byte, 8) const ttl = 12 * 60 * 60 binary.BigEndian.PutUint64(expire, now+ttl) _ = w.ipAddrs.Set([]byte(ip), expire) </s> remove w.lock.Lock() _, found := w.ips[ip] if found { w.lock.Unlock() return </s> add now := uint64(time.Now().Unix()) expire := w.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
log.Tracef("rDNS: adding %s", ip)
<mask> return <mask> } <mask> r.ips[ip] = true <mask> <mask> log.Tracef("Adding %s for rDNS resolve", ip) <mask> select { <mask> case r.ipChannel <- ip: <mask> // <mask> default: <mask> log.Tracef("rDNS queue is full") </s> * rdns,whois: recheck IP addresses after some time </s> remove r.ips[ip] = true </s> add </s> remove log.Tracef("rDNS queue is full") </s> add log.Tracef("rDNS: queue is full") </s> remove // add IP to ips, if not exists r.lock.Lock() defer r.lock.Unlock() _, ok := r.ips[ip] if ok { </s> add if r.clients.Exists(ip, ClientSourceRDNS) { </s> remove w.ips[ip] = true w.lock.Unlock() </s> add expire = make([]byte, 8) const ttl = 12 * 60 * 60 binary.BigEndian.PutUint64(expire, now+ttl) _ = w.ipAddrs.Set([]byte(ip), expire) </s> remove if r.clients.Exists(ip, ClientSourceRDNS) { return </s> add now := uint64(time.Now().Unix()) expire := r.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
log.Tracef("rDNS: queue is full")
<mask> select { <mask> case r.ipChannel <- ip: <mask> // <mask> default: <mask> log.Tracef("rDNS queue is full") <mask> } <mask> } <mask> <mask> // Use rDNS to get hostname by IP address <mask> func (r *RDNS) resolve(ip string) string { </s> * rdns,whois: recheck IP addresses after some time </s> remove log.Tracef("Adding %s for rDNS resolve", ip) </s> add log.Tracef("rDNS: adding %s", ip) </s> remove if r.clients.Exists(ip, ClientSourceRDNS) { return </s> add now := uint64(time.Now().Unix()) expire := r.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired </s> remove r.ips[ip] = true </s> add </s> remove ipChannel chan string // pass data from DNS request handling thread to rDNS thread // contains IP addresses of clients to be resolved by rDNS // if IP address couldn't be resolved, it stays here forever to prevent further attempts to resolve the same IP ips map[string]bool lock sync.Mutex // synchronize access to 'ips' upstream upstream.Upstream // Upstream object for our own DNS server </s> add ipChannel chan string // pass data from DNS request handling thread to rDNS thread upstream upstream.Upstream // Upstream object for our own DNS server // Contains IP addresses of clients to be resolved by rDNS // If IP address is resolved, it stays here while it's inside Clients. // If it's removed from Clients, this IP address will be resolved once again. // If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP. ipAddrs cache.Cache
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
<mask> if len(host) == 0 { <mask> continue <mask> } <mask> <mask> r.lock.Lock() <mask> delete(r.ips, ip) <mask> r.lock.Unlock() <mask> <mask> _, _ = config.clients.AddHost(ip, host, ClientSourceRDNS) <mask> } <mask> } </s> * rdns,whois: recheck IP addresses after some time </s> remove // add IP to ips, if not exists r.lock.Lock() defer r.lock.Unlock() _, ok := r.ips[ip] if ok { </s> add if r.clients.Exists(ip, ClientSourceRDNS) { </s> remove if r.clients.Exists(ip, ClientSourceRDNS) { return </s> add now := uint64(time.Now().Unix()) expire := r.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired </s> remove w.lock.Lock() _, found := w.ips[ip] if found { w.lock.Unlock() return </s> add now := uint64(time.Now().Unix()) expire := w.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired </s> remove r.ips[ip] = true </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/rdns.go
"encoding/binary"
<mask> package home <mask> <mask> import ( <mask> "fmt" <mask> "io/ioutil" <mask> "net" <mask> "strings" </s> * rdns,whois: recheck IP addresses after some time </s> remove "sync" </s> add </s> remove "sync" </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/whois.go
<mask> "fmt" <mask> "io/ioutil" <mask> "net" <mask> "strings" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> </s> * rdns,whois: recheck IP addresses after some time </s> remove "sync" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/whois.go
"github.com/AdguardTeam/golibs/cache"
<mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> const ( <mask> defaultServer = "whois.arin.net" </s> * rdns,whois: recheck IP addresses after some time </s> remove "sync" </s> add </s> remove "sync" </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/whois.go
<mask> <mask> // Whois - module context <mask> type Whois struct { <mask> clients *clientsContainer <mask> ips map[string]bool <mask> lock sync.Mutex <mask> ipChan chan string <mask> timeoutMsec uint <mask> } <mask> <mask> // Create module context </s> * rdns,whois: recheck IP addresses after some time </s> remove ipChannel chan string // pass data from DNS request handling thread to rDNS thread // contains IP addresses of clients to be resolved by rDNS // if IP address couldn't be resolved, it stays here forever to prevent further attempts to resolve the same IP ips map[string]bool lock sync.Mutex // synchronize access to 'ips' upstream upstream.Upstream // Upstream object for our own DNS server </s> add ipChannel chan string // pass data from DNS request handling thread to rDNS thread upstream upstream.Upstream // Upstream object for our own DNS server // Contains IP addresses of clients to be resolved by rDNS // If IP address is resolved, it stays here while it's inside Clients. // If it's removed from Clients, this IP address will be resolved once again. // If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP. ipAddrs cache.Cache </s> remove log.Tracef("rDNS queue is full") </s> add log.Tracef("rDNS: queue is full") </s> remove if r.clients.Exists(ip, ClientSourceRDNS) { return </s> add now := uint64(time.Now().Unix()) expire := r.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired </s> remove w.lock.Lock() _, found := w.ips[ip] if found { w.lock.Unlock() return </s> add now := uint64(time.Now().Unix()) expire := w.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/whois.go
// Contains IP addresses of clients // An active IP address is resolved once again after it expires. // If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP. ipAddrs cache.Cache
<mask> clients *clientsContainer <mask> ipChan chan string <mask> timeoutMsec uint <mask> } <mask> <mask> // Create module context <mask> func initWhois(clients *clientsContainer) *Whois { <mask> w := Whois{} <mask> w.timeoutMsec = 5000 </s> * rdns,whois: recheck IP addresses after some time </s> remove ips map[string]bool lock sync.Mutex </s> add </s> remove w.ips = make(map[string]bool) </s> add cconf := cache.Config{} cconf.EnableLRU = true cconf.MaxCount = 10000 w.ipAddrs = cache.New(cconf) </s> remove ipChannel chan string // pass data from DNS request handling thread to rDNS thread // contains IP addresses of clients to be resolved by rDNS // if IP address couldn't be resolved, it stays here forever to prevent further attempts to resolve the same IP ips map[string]bool lock sync.Mutex // synchronize access to 'ips' upstream upstream.Upstream // Upstream object for our own DNS server </s> add ipChannel chan string // pass data from DNS request handling thread to rDNS thread upstream upstream.Upstream // Upstream object for our own DNS server // Contains IP addresses of clients to be resolved by rDNS // If IP address is resolved, it stays here while it's inside Clients. // If it's removed from Clients, this IP address will be resolved once again. // If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP. ipAddrs cache.Cache </s> remove log.Tracef("rDNS queue is full") </s> add log.Tracef("rDNS: queue is full") </s> remove w.lock.Lock() _, found := w.ips[ip] if found { w.lock.Unlock() return </s> add now := uint64(time.Now().Unix()) expire := w.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/whois.go
cconf := cache.Config{} cconf.EnableLRU = true cconf.MaxCount = 10000 w.ipAddrs = cache.New(cconf)
<mask> func initWhois(clients *clientsContainer) *Whois { <mask> w := Whois{} <mask> w.timeoutMsec = 5000 <mask> w.clients = clients <mask> w.ips = make(map[string]bool) <mask> w.ipChan = make(chan string, 255) <mask> go w.workerLoop() <mask> return &w <mask> } <mask> </s> * rdns,whois: recheck IP addresses after some time </s> remove r.ips = make(map[string]bool) </s> add cconf := cache.Config{} cconf.EnableLRU = true cconf.MaxCount = 10000 r.ipAddrs = cache.New(cconf) </s> remove w.ips[ip] = true w.lock.Unlock() </s> add expire = make([]byte, 8) const ttl = 12 * 60 * 60 binary.BigEndian.PutUint64(expire, now+ttl) _ = w.ipAddrs.Set([]byte(ip), expire) </s> remove w.lock.Lock() _, found := w.ips[ip] if found { w.lock.Unlock() return </s> add now := uint64(time.Now().Unix()) expire := w.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/whois.go
now := uint64(time.Now().Unix()) expire := w.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired
<mask> } <mask> <mask> // Begin - begin requesting WHOIS info <mask> func (w *Whois) Begin(ip string) { <mask> w.lock.Lock() <mask> _, found := w.ips[ip] <mask> if found { <mask> w.lock.Unlock() <mask> return <mask> } <mask> w.ips[ip] = true <mask> w.lock.Unlock() <mask> <mask> log.Debug("Whois: adding %s", ip) </s> * rdns,whois: recheck IP addresses after some time </s> remove w.ips[ip] = true w.lock.Unlock() </s> add expire = make([]byte, 8) const ttl = 12 * 60 * 60 binary.BigEndian.PutUint64(expire, now+ttl) _ = w.ipAddrs.Set([]byte(ip), expire) </s> remove if r.clients.Exists(ip, ClientSourceRDNS) { return </s> add now := uint64(time.Now().Unix()) expire := r.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired </s> remove log.Tracef("Adding %s for rDNS resolve", ip) </s> add log.Tracef("rDNS: adding %s", ip) </s> remove r.ips[ip] = true </s> add </s> remove // add IP to ips, if not exists r.lock.Lock() defer r.lock.Unlock() _, ok := r.ips[ip] if ok { </s> add if r.clients.Exists(ip, ClientSourceRDNS) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/whois.go
expire = make([]byte, 8) const ttl = 12 * 60 * 60 binary.BigEndian.PutUint64(expire, now+ttl) _ = w.ipAddrs.Set([]byte(ip), expire)
<mask> if found { <mask> w.lock.Unlock() <mask> return <mask> } <mask> w.ips[ip] = true <mask> w.lock.Unlock() <mask> <mask> log.Debug("Whois: adding %s", ip) <mask> select { <mask> case w.ipChan <- ip: <mask> // </s> * rdns,whois: recheck IP addresses after some time </s> remove w.lock.Lock() _, found := w.ips[ip] if found { w.lock.Unlock() return </s> add now := uint64(time.Now().Unix()) expire := w.ipAddrs.Get([]byte(ip)) if len(expire) != 0 { exp := binary.BigEndian.Uint64(expire) if exp > now { return } // TTL expired </s> remove log.Tracef("Adding %s for rDNS resolve", ip) </s> add log.Tracef("rDNS: adding %s", ip) </s> remove r.ips[ip] = true </s> add </s> remove log.Tracef("rDNS queue is full") </s> add log.Tracef("rDNS: queue is full") </s> remove // add IP to ips, if not exists r.lock.Lock() defer r.lock.Unlock() _, ok := r.ips[ip] if ok { </s> add if r.clients.Exists(ip, ClientSourceRDNS) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/235b198ef97d7a46ab6d76a4074ec589fc0148eb
home/whois.go
"runtime"
<mask> "fmt" <mask> "net" <mask> "os" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/insomniacslk/dhcp/dhcpv4" <mask> "github.com/insomniacslk/dhcp/dhcpv4/nclient4" <mask> "github.com/insomniacslk/dhcp/iana" </s> - dhcp: CheckIfOtherDHCPServersPresent: fix Sometimes request from DHCP server couldn't be received because we were bound to a specific IP address. </s> remove "golang.org/x/net/ipv4" </s> add </s> remove n, _, _, err := c.ReadFrom(b) </s> add n, _, err := c.ReadFrom(b) </s> remove cm := ipv4.ControlMessage{} _, err = c.WriteTo(req.ToBytes(), &cm, dstAddr) </s> add _, err = c.WriteTo(req.ToBytes(), dstAddr)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/23752377b76895dbcd78f25ed6df58e1bbcae153
dhcpd/check_other_dhcp.go
"github.com/insomniacslk/dhcp/dhcpv4/nclient4"
<mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/insomniacslk/dhcp/dhcpv4" <mask> "github.com/insomniacslk/dhcp/iana" <mask> ) <mask> <mask> // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface, <mask> // and waits for a response for a period defined by defaultDiscoverTime <mask> func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) { </s> - dhcp: CheckIfOtherDHCPServersPresent: fix Sometimes request from DHCP server couldn't be received because we were bound to a specific IP address. </s> remove "golang.org/x/net/ipv4" </s> add </s> remove cm := ipv4.ControlMessage{} _, err = c.WriteTo(req.ToBytes(), &cm, dstAddr) </s> add _, err = c.WriteTo(req.ToBytes(), dstAddr) </s> remove n, _, _, err := c.ReadFrom(b) </s> add n, _, err := c.ReadFrom(b)
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/23752377b76895dbcd78f25ed6df58e1bbcae153
dhcpd/check_other_dhcp.go
<mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/insomniacslk/dhcp/dhcpv4" <mask> "github.com/insomniacslk/dhcp/iana" <mask> "golang.org/x/net/ipv4" <mask> ) <mask> <mask> // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface, <mask> // and waits for a response for a period defined by defaultDiscoverTime <mask> func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) { </s> - dhcp: CheckIfOtherDHCPServersPresent: fix Sometimes request from DHCP server couldn't be received because we were bound to a specific IP address. </s> remove cm := ipv4.ControlMessage{} _, err = c.WriteTo(req.ToBytes(), &cm, dstAddr) </s> add _, err = c.WriteTo(req.ToBytes(), dstAddr) </s> remove n, _, _, err := c.ReadFrom(b) </s> add n, _, err := c.ReadFrom(b)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/23752377b76895dbcd78f25ed6df58e1bbcae153
dhcpd/check_other_dhcp.go
if runtime.GOOS == "darwin" { return false, fmt.Errorf("Can't find DHCP server: not supported on macOS") }
<mask> } <mask> <mask> srcIP := ifaceIPNet[0] <mask> src := net.JoinHostPort(srcIP.String(), "68") <mask> dst := "255.255.255.255:67" <mask> <mask> hostname, _ := os.Hostname() </s> - dhcp: CheckIfOtherDHCPServersPresent: fix Sometimes request from DHCP server couldn't be received because we were bound to a specific IP address. </s> remove n, _, _, err := c.ReadFrom(b) </s> add n, _, err := c.ReadFrom(b) </s> remove c, err := newBroadcastPacketConn(net.IPv4(0, 0, 0, 0), 68, ifaceName) </s> add c, err := nclient4.NewRawUDPConn(ifaceName, 68) </s> remove cm := ipv4.ControlMessage{} _, err = c.WriteTo(req.ToBytes(), &cm, dstAddr) </s> add _, err = c.WriteTo(req.ToBytes(), dstAddr) </s> remove "golang.org/x/net/ipv4" </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/23752377b76895dbcd78f25ed6df58e1bbcae153
dhcpd/check_other_dhcp.go
c, err := nclient4.NewRawUDPConn(ifaceName, 68)
<mask> } <mask> <mask> // bind to 0.0.0.0:68 <mask> log.Tracef("Listening to udp4 %+v", udpAddr) <mask> c, err := newBroadcastPacketConn(net.IPv4(0, 0, 0, 0), 68, ifaceName) <mask> if c != nil { <mask> defer c.Close() <mask> } <mask> if err != nil { <mask> return false, wrapErrPrint(err, "Couldn't listen on :68") </s> - dhcp: CheckIfOtherDHCPServersPresent: fix Sometimes request from DHCP server couldn't be received because we were bound to a specific IP address. </s> remove cm := ipv4.ControlMessage{} _, err = c.WriteTo(req.ToBytes(), &cm, dstAddr) </s> add _, err = c.WriteTo(req.ToBytes(), dstAddr) </s> remove n, _, _, err := c.ReadFrom(b) </s> add n, _, err := c.ReadFrom(b) </s> remove "golang.org/x/net/ipv4" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/23752377b76895dbcd78f25ed6df58e1bbcae153
dhcpd/check_other_dhcp.go
_, err = c.WriteTo(req.ToBytes(), dstAddr)
<mask> return false, wrapErrPrint(err, "Couldn't listen on :68") <mask> } <mask> <mask> // send to 255.255.255.255:67 <mask> cm := ipv4.ControlMessage{} <mask> _, err = c.WriteTo(req.ToBytes(), &cm, dstAddr) <mask> if err != nil { <mask> return false, wrapErrPrint(err, "Couldn't send a packet to %s", dst) <mask> } <mask> <mask> for { </s> - dhcp: CheckIfOtherDHCPServersPresent: fix Sometimes request from DHCP server couldn't be received because we were bound to a specific IP address. </s> remove c, err := newBroadcastPacketConn(net.IPv4(0, 0, 0, 0), 68, ifaceName) </s> add c, err := nclient4.NewRawUDPConn(ifaceName, 68) </s> remove n, _, _, err := c.ReadFrom(b) </s> add n, _, err := c.ReadFrom(b) </s> remove "golang.org/x/net/ipv4" </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/23752377b76895dbcd78f25ed6df58e1bbcae153
dhcpd/check_other_dhcp.go
n, _, err := c.ReadFrom(b)
<mask> log.Tracef("Waiting %v for an answer", defaultDiscoverTime) <mask> // TODO: replicate dhclient's behaviour of retrying several times with progressively bigger timeouts <mask> b := make([]byte, 1500) <mask> _ = c.SetReadDeadline(time.Now().Add(defaultDiscoverTime)) <mask> n, _, _, err := c.ReadFrom(b) <mask> if isTimeout(err) { <mask> // timed out -- no DHCP servers <mask> return false, nil <mask> } <mask> if err != nil { </s> - dhcp: CheckIfOtherDHCPServersPresent: fix Sometimes request from DHCP server couldn't be received because we were bound to a specific IP address. </s> remove cm := ipv4.ControlMessage{} _, err = c.WriteTo(req.ToBytes(), &cm, dstAddr) </s> add _, err = c.WriteTo(req.ToBytes(), dstAddr) </s> remove c, err := newBroadcastPacketConn(net.IPv4(0, 0, 0, 0), 68, ifaceName) </s> add c, err := nclient4.NewRawUDPConn(ifaceName, 68) </s> remove "golang.org/x/net/ipv4" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/23752377b76895dbcd78f25ed6df58e1bbcae153
dhcpd/check_other_dhcp.go
log.Debug("DHCPv4: didn't receive DHCP response")
<mask> n, _, err := c.ReadFrom(b) <mask> if isTimeout(err) { <mask> // timed out -- no DHCP servers <mask> return false, nil <mask> } <mask> if err != nil { <mask> return false, wrapErrPrint(err, "Couldn't receive packet") <mask> } </s> - dhcp: CheckIfOtherDHCPServersPresent: fix Sometimes request from DHCP server couldn't be received because we were bound to a specific IP address. </s> remove n, _, _, err := c.ReadFrom(b) </s> add n, _, err := c.ReadFrom(b) </s> remove cm := ipv4.ControlMessage{} _, err = c.WriteTo(req.ToBytes(), &cm, dstAddr) </s> add _, err = c.WriteTo(req.ToBytes(), dstAddr) </s> remove c, err := newBroadcastPacketConn(net.IPv4(0, 0, 0, 0), 68, ifaceName) </s> add c, err := nclient4.NewRawUDPConn(ifaceName, 68) </s> remove "golang.org/x/net/ipv4" </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/23752377b76895dbcd78f25ed6df58e1bbcae153
dhcpd/check_other_dhcp.go
{dashboard.processing && <Loading />} {!dashboard.isCoreRunning && (
<mask> )} <mask> <LoadingBar className="loading-bar" updateTime={1000} /> <mask> <Route component={Header} /> <mask> <div className="container container--wrap"> <mask> {dashboard.processing && !dashboard.isCoreRunning && ( <mask> <div className="row row-cards"> <mask> <div className="col-lg-12"> <mask> <Status reloadPage={this.reloadPage} <mask> message="dns_start" <mask> /> </s> - client: hide dns is starting message by default </s> remove /> </s> add /> </s> remove isCoreRunning: false, </s> add isCoreRunning: true,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/242e5e136f60c024c167b6fc096fa5595c5ba9bd
client/src/components/App/index.js
/>
<mask> <div className="row row-cards"> <mask> <div className="col-lg-12"> <mask> <Status reloadPage={this.reloadPage} <mask> message="dns_start" <mask> /> <mask> <Loading /> <mask> </div> <mask> </div> <mask> )} <mask> {!dashboard.processing && dashboard.isCoreRunning && ( </s> - client: hide dns is starting message by default </s> remove {dashboard.processing && !dashboard.isCoreRunning && ( </s> add {dashboard.processing && <Loading />} {!dashboard.isCoreRunning && ( </s> remove isCoreRunning: false, </s> add isCoreRunning: true,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/242e5e136f60c024c167b6fc096fa5595c5ba9bd
client/src/components/App/index.js
isCoreRunning: true,
<mask> }), <mask> }, <mask> { <mask> processing: true, <mask> isCoreRunning: false, <mask> processingVersion: true, <mask> processingFiltering: true, <mask> processingClients: true, <mask> processingUpdate: false, <mask> processingDnsSettings: true, </s> - client: hide dns is starting message by default </s> remove /> </s> add /> </s> remove {dashboard.processing && !dashboard.isCoreRunning && ( </s> add {dashboard.processing && <Loading />} {!dashboard.isCoreRunning && (
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/242e5e136f60c024c167b6fc096fa5595c5ba9bd
client/src/reducers/index.js
<mask> Action: setup, <mask> }) <mask> } <mask> <mask> type cacheEntry struct { <mask> answer []dns.RR <mask> lastUpdated time.Time <mask> } <mask> <mask> var ( <mask> lookupCacheTime = time.Minute * 30 <mask> lookupCache = map[string]cacheEntry{} <mask> ) <mask> <mask> type plugFilter struct { <mask> ID int64 <mask> Path string <mask> } <mask> </s> Revert "Cache DNS lookups when resolving safebrowsing or parental servers, also cache replacement hostnames as well." This reverts commit a5d105352057bf24a59a08a2695f1d48f033cb17. This cache had unintended side effects. </s> remove cacheentry := lookupCache[val] if time.Since(cacheentry.lastUpdated) > lookupCacheTime { req := new(dns.Msg) req.SetQuestion(dns.Fqdn(val), question.Qtype) req.RecursionDesired = true reqstate := request.Request{W: w, Req: req, Context: ctx} result, err := p.upstream.Lookup(reqstate, dns.Fqdn(val), reqstate.QType()) if err != nil { log.Printf("Got error %s\n", err) return dns.RcodeServerFailure, fmt.Errorf("plugin/dnsfilter: %s", err) } if result != nil { for _, answer := range result.Answer { answer.Header().Name = question.Name } records = result.Answer cacheentry.answer = result.Answer cacheentry.lastUpdated = time.Now() lookupCache[val] = cacheentry </s> add req := new(dns.Msg) req.SetQuestion(dns.Fqdn(val), question.Qtype) req.RecursionDesired = true reqstate := request.Request{W: w, Req: req, Context: ctx} result, err := p.upstream.Lookup(reqstate, dns.Fqdn(val), reqstate.QType()) if err != nil { log.Printf("Got error %s\n", err) return dns.RcodeServerFailure, fmt.Errorf("plugin/dnsfilter: %s", err) } if result != nil { for _, answer := range result.Answer { answer.Header().Name = question.Name </s> remove } else { // get from cache records = cacheentry.answer </s> add records = result.Answer </s> remove _ "github.com/benburkert/dns/init" </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2449075bca9e12bf052a2d217e05a9196817d5bd
coredns_plugin/coredns_plugin.go
req := new(dns.Msg) req.SetQuestion(dns.Fqdn(val), question.Qtype) req.RecursionDesired = true reqstate := request.Request{W: w, Req: req, Context: ctx} result, err := p.upstream.Lookup(reqstate, dns.Fqdn(val), reqstate.QType()) if err != nil { log.Printf("Got error %s\n", err) return dns.RcodeServerFailure, fmt.Errorf("plugin/dnsfilter: %s", err) } if result != nil { for _, answer := range result.Answer { answer.Header().Name = question.Name
<mask> } <mask> records = append(records, result) <mask> } else { <mask> // this is a domain name, need to look it up <mask> cacheentry := lookupCache[val] <mask> if time.Since(cacheentry.lastUpdated) > lookupCacheTime { <mask> req := new(dns.Msg) <mask> req.SetQuestion(dns.Fqdn(val), question.Qtype) <mask> req.RecursionDesired = true <mask> reqstate := request.Request{W: w, Req: req, Context: ctx} <mask> result, err := p.upstream.Lookup(reqstate, dns.Fqdn(val), reqstate.QType()) <mask> if err != nil { <mask> log.Printf("Got error %s\n", err) <mask> return dns.RcodeServerFailure, fmt.Errorf("plugin/dnsfilter: %s", err) <mask> } <mask> if result != nil { <mask> for _, answer := range result.Answer { <mask> answer.Header().Name = question.Name <mask> } <mask> records = result.Answer <mask> cacheentry.answer = result.Answer <mask> cacheentry.lastUpdated = time.Now() <mask> lookupCache[val] = cacheentry <mask> } <mask> } else { <mask> // get from cache <mask> records = cacheentry.answer <mask> } </s> Revert "Cache DNS lookups when resolving safebrowsing or parental servers, also cache replacement hostnames as well." This reverts commit a5d105352057bf24a59a08a2695f1d48f033cb17. This cache had unintended side effects. </s> remove } else { // get from cache records = cacheentry.answer </s> add records = result.Answer </s> remove type cacheEntry struct { answer []dns.RR lastUpdated time.Time } var ( lookupCacheTime = time.Minute * 30 lookupCache = map[string]cacheEntry{} ) </s> add </s> remove _ "github.com/benburkert/dns/init" </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2449075bca9e12bf052a2d217e05a9196817d5bd
coredns_plugin/coredns_plugin.go
records = result.Answer
<mask> cacheentry.answer = result.Answer <mask> cacheentry.lastUpdated = time.Now() <mask> lookupCache[val] = cacheentry <mask> } <mask> } else { <mask> // get from cache <mask> records = cacheentry.answer <mask> } <mask> } <mask> m := new(dns.Msg) <mask> m.SetReply(r) <mask> m.Authoritative, m.RecursionAvailable, m.Compress = true, true, true </s> Revert "Cache DNS lookups when resolving safebrowsing or parental servers, also cache replacement hostnames as well." This reverts commit a5d105352057bf24a59a08a2695f1d48f033cb17. This cache had unintended side effects. </s> remove cacheentry := lookupCache[val] if time.Since(cacheentry.lastUpdated) > lookupCacheTime { req := new(dns.Msg) req.SetQuestion(dns.Fqdn(val), question.Qtype) req.RecursionDesired = true reqstate := request.Request{W: w, Req: req, Context: ctx} result, err := p.upstream.Lookup(reqstate, dns.Fqdn(val), reqstate.QType()) if err != nil { log.Printf("Got error %s\n", err) return dns.RcodeServerFailure, fmt.Errorf("plugin/dnsfilter: %s", err) } if result != nil { for _, answer := range result.Answer { answer.Header().Name = question.Name } records = result.Answer cacheentry.answer = result.Answer cacheentry.lastUpdated = time.Now() lookupCache[val] = cacheentry </s> add req := new(dns.Msg) req.SetQuestion(dns.Fqdn(val), question.Qtype) req.RecursionDesired = true reqstate := request.Request{W: w, Req: req, Context: ctx} result, err := p.upstream.Lookup(reqstate, dns.Fqdn(val), reqstate.QType()) if err != nil { log.Printf("Got error %s\n", err) return dns.RcodeServerFailure, fmt.Errorf("plugin/dnsfilter: %s", err) } if result != nil { for _, answer := range result.Answer { answer.Header().Name = question.Name </s> remove type cacheEntry struct { answer []dns.RR lastUpdated time.Time } var ( lookupCacheTime = time.Minute * 30 lookupCache = map[string]cacheEntry{} ) </s> add </s> remove _ "github.com/benburkert/dns/init" </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2449075bca9e12bf052a2d217e05a9196817d5bd
coredns_plugin/coredns_plugin.go
<mask> "sync" <mask> "sync/atomic" <mask> "time" <mask> <mask> _ "github.com/benburkert/dns/init" <mask> "github.com/bluele/gcache" <mask> "golang.org/x/net/publicsuffix" <mask> ) <mask> <mask> const defaultCacheSize = 64 * 1024 // in number of elements </s> Revert "Cache DNS lookups when resolving safebrowsing or parental servers, also cache replacement hostnames as well." This reverts commit a5d105352057bf24a59a08a2695f1d48f033cb17. This cache had unintended side effects. </s> remove } else { // get from cache records = cacheentry.answer </s> add records = result.Answer </s> remove cacheentry := lookupCache[val] if time.Since(cacheentry.lastUpdated) > lookupCacheTime { req := new(dns.Msg) req.SetQuestion(dns.Fqdn(val), question.Qtype) req.RecursionDesired = true reqstate := request.Request{W: w, Req: req, Context: ctx} result, err := p.upstream.Lookup(reqstate, dns.Fqdn(val), reqstate.QType()) if err != nil { log.Printf("Got error %s\n", err) return dns.RcodeServerFailure, fmt.Errorf("plugin/dnsfilter: %s", err) } if result != nil { for _, answer := range result.Answer { answer.Header().Name = question.Name } records = result.Answer cacheentry.answer = result.Answer cacheentry.lastUpdated = time.Now() lookupCache[val] = cacheentry </s> add req := new(dns.Msg) req.SetQuestion(dns.Fqdn(val), question.Qtype) req.RecursionDesired = true reqstate := request.Request{W: w, Req: req, Context: ctx} result, err := p.upstream.Lookup(reqstate, dns.Fqdn(val), reqstate.QType()) if err != nil { log.Printf("Got error %s\n", err) return dns.RcodeServerFailure, fmt.Errorf("plugin/dnsfilter: %s", err) } if result != nil { for _, answer := range result.Answer { answer.Header().Name = question.Name </s> remove type cacheEntry struct { answer []dns.RR lastUpdated time.Time } var ( lookupCacheTime = time.Minute * 30 lookupCache = map[string]cacheEntry{} ) </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2449075bca9e12bf052a2d217e05a9196817d5bd
dnsfilter/dnsfilter.go
securityCache gcache.Cache // "host" -> "IP" cache for safebrowsing and parental control servers
<mask> var ( <mask> stats Stats <mask> safebrowsingCache gcache.Cache <mask> parentalCache gcache.Cache <mask> safeSearchCache gcache.Cache <mask> ) </s> + dnsfilter: cache IP addresses of safebrowsing and parental control servers </s> remove d.transport.DialContext = createCustomDialContext(c.ResolverAddress) </s> add securityCache = gcache.New(2).LRU().Expiration(defaultCacheTime).Build() d.transport.DialContext = d.createCustomDialContext(c.ResolverAddress) </s> remove func createCustomDialContext(resolverAddr string) dialFunctionType { </s> add func (d *Dnsfilter) createCustomDialContext(resolverAddr string) dialFunctionType {
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24ae61de3ed99a7b21dd6d4598e296df0b3e952d
dnsfilter/dnsfilter.go
func (d *Dnsfilter) createCustomDialContext(resolverAddr string) dialFunctionType {
<mask> <mask> type dialFunctionType func(ctx context.Context, network, addr string) (net.Conn, error) <mask> <mask> // Connect to a remote server resolving hostname using our own DNS server <mask> func createCustomDialContext(resolverAddr string) dialFunctionType { <mask> return func(ctx context.Context, network, addr string) (net.Conn, error) { <mask> log.Tracef("network:%v addr:%v", network, addr) <mask> <mask> host, port, err := net.SplitHostPort(addr) <mask> if err != nil { </s> + dnsfilter: cache IP addresses of safebrowsing and parental control servers </s> remove d.transport.DialContext = createCustomDialContext(c.ResolverAddress) </s> add securityCache = gcache.New(2).LRU().Expiration(defaultCacheTime).Build() d.transport.DialContext = d.createCustomDialContext(c.ResolverAddress)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24ae61de3ed99a7b21dd6d4598e296df0b3e952d
dnsfilter/dnsfilter.go
cache := d.shouldCache(host) if cache { ip := searchInCache(host) if len(ip) != 0 { addr = fmt.Sprintf("%s:%s", ip, port) return dialer.DialContext(ctx, network, addr) } }
<mask> return con, err <mask> } <mask> <mask> r := upstream.NewResolver(resolverAddr, 30*time.Second) <mask> addrs, e := r.LookupIPAddr(ctx, host) <mask> log.Tracef("LookupIPAddr: %s: %v", host, addrs) <mask> if e != nil { <mask> return nil, e <mask> } </s> + dnsfilter: cache IP addresses of safebrowsing and parental control servers </s> remove func createCustomDialContext(resolverAddr string) dialFunctionType { </s> add func (d *Dnsfilter) createCustomDialContext(resolverAddr string) dialFunctionType { </s> remove d.transport.DialContext = createCustomDialContext(c.ResolverAddress) </s> add securityCache = gcache.New(2).LRU().Expiration(defaultCacheTime).Build() d.transport.DialContext = d.createCustomDialContext(c.ResolverAddress)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24ae61de3ed99a7b21dd6d4598e296df0b3e952d
dnsfilter/dnsfilter.go
if cache { addToCache(host, a.String()) }
<mask> } <mask> continue <mask> } <mask> return con, err <mask> } <mask> return nil, firstErr <mask> } <mask> } </s> + dnsfilter: cache IP addresses of safebrowsing and parental control servers </s> remove d.transport.DialContext = createCustomDialContext(c.ResolverAddress) </s> add securityCache = gcache.New(2).LRU().Expiration(defaultCacheTime).Build() d.transport.DialContext = d.createCustomDialContext(c.ResolverAddress) </s> remove func createCustomDialContext(resolverAddr string) dialFunctionType { </s> add func (d *Dnsfilter) createCustomDialContext(resolverAddr string) dialFunctionType {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24ae61de3ed99a7b21dd6d4598e296df0b3e952d
dnsfilter/dnsfilter.go
securityCache = gcache.New(2).LRU().Expiration(defaultCacheTime).Build() d.transport.DialContext = d.createCustomDialContext(c.ResolverAddress)
<mask> TLSHandshakeTimeout: 10 * time.Second, <mask> ExpectContinueTimeout: 1 * time.Second, <mask> } <mask> if c != nil && len(c.ResolverAddress) != 0 { <mask> d.transport.DialContext = createCustomDialContext(c.ResolverAddress) <mask> } <mask> d.client = http.Client{ <mask> Transport: d.transport, <mask> Timeout: defaultHTTPTimeout, <mask> } </s> + dnsfilter: cache IP addresses of safebrowsing and parental control servers </s> remove func createCustomDialContext(resolverAddr string) dialFunctionType { </s> add func (d *Dnsfilter) createCustomDialContext(resolverAddr string) dialFunctionType {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24ae61de3ed99a7b21dd6d4598e296df0b3e952d
dnsfilter/dnsfilter.go
snapchannel='candidate' ;;
<mask> <mask> case "$channel" <mask> in <mask> ('release') <mask> snapchannel='candidate' <mask> ;; <mask> ('beta') <mask> snapchannel='beta' <mask> ;; <mask> ('edge') <mask> snapchannel='edge' </s> Pull request 1848: fix-snap Merge in DNS/adguard-home from fix-snap to master Squashed commit of the following: commit 4a12b2709229150e1b896b71b2b0a99249f94fde Author: Ainar Garipov <[email protected]> Date: Sat May 20 11:51:25 2023 +0300 bamboo-specs: upd snap script </s> remove snapchannel='beta' ;; </s> add snapchannel='beta' ;; </s> remove snapchannel='edge' ;; </s> add snapchannel='edge' ;; </s> remove echo "invalid channel '$channel'" exit 1 ;; </s> add echo "invalid channel '$channel'" exit 1 ;; </s> remove exit 0 </s> add exit 0 </s> remove echo "don't publish to GitHub Releases for this channel" </s> add echo "don't publish to GitHub Releases for this channel"
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24b41100c3337822acaf5c118854a66267c5ea81
bamboo-specs/release.yaml
snapchannel='beta' ;;
<mask> ('release') <mask> snapchannel='candidate' <mask> ;; <mask> ('beta') <mask> snapchannel='beta' <mask> ;; <mask> ('edge') <mask> snapchannel='edge' <mask> ;; <mask> (*) <mask> echo "invalid channel '$channel'" </s> Pull request 1848: fix-snap Merge in DNS/adguard-home from fix-snap to master Squashed commit of the following: commit 4a12b2709229150e1b896b71b2b0a99249f94fde Author: Ainar Garipov <[email protected]> Date: Sat May 20 11:51:25 2023 +0300 bamboo-specs: upd snap script </s> remove snapchannel='candidate' ;; </s> add snapchannel='candidate' ;; </s> remove snapchannel='edge' ;; </s> add snapchannel='edge' ;; </s> remove echo "invalid channel '$channel'" exit 1 ;; </s> add echo "invalid channel '$channel'" exit 1 ;; </s> remove echo "don't publish to GitHub Releases for this channel" </s> add echo "don't publish to GitHub Releases for this channel" </s> remove exit 0 </s> add exit 0
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24b41100c3337822acaf5c118854a66267c5ea81
bamboo-specs/release.yaml
snapchannel='edge' ;;
<mask> ('beta') <mask> snapchannel='beta' <mask> ;; <mask> ('edge') <mask> snapchannel='edge' <mask> ;; <mask> (*) <mask> echo "invalid channel '$channel'" <mask> exit 1 <mask> ;; <mask> esac </s> Pull request 1848: fix-snap Merge in DNS/adguard-home from fix-snap to master Squashed commit of the following: commit 4a12b2709229150e1b896b71b2b0a99249f94fde Author: Ainar Garipov <[email protected]> Date: Sat May 20 11:51:25 2023 +0300 bamboo-specs: upd snap script </s> remove echo "invalid channel '$channel'" exit 1 ;; </s> add echo "invalid channel '$channel'" exit 1 ;; </s> remove snapchannel='beta' ;; </s> add snapchannel='beta' ;; </s> remove snapchannel='candidate' ;; </s> add snapchannel='candidate' ;; </s> remove echo "don't publish to GitHub Releases for this channel" </s> add echo "don't publish to GitHub Releases for this channel" </s> remove exit 0 </s> add exit 0
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24b41100c3337822acaf5c118854a66267c5ea81
bamboo-specs/release.yaml
echo "invalid channel '$channel'" exit 1 ;;
<mask> ('edge') <mask> snapchannel='edge' <mask> ;; <mask> (*) <mask> echo "invalid channel '$channel'" <mask> exit 1 <mask> ;; <mask> esac <mask> <mask> env\ <mask> SNAPCRAFT_CHANNEL="$snapchannel"\ <mask> SNAPCRAFT_EMAIL="${bamboo.snapcraftEmail}"\ </s> Pull request 1848: fix-snap Merge in DNS/adguard-home from fix-snap to master Squashed commit of the following: commit 4a12b2709229150e1b896b71b2b0a99249f94fde Author: Ainar Garipov <[email protected]> Date: Sat May 20 11:51:25 2023 +0300 bamboo-specs: upd snap script </s> remove snapchannel='edge' ;; </s> add snapchannel='edge' ;; </s> remove snapchannel='beta' ;; </s> add snapchannel='beta' ;; </s> remove SNAPCRAFT_MACAROON="${bamboo.snapcraftMacaroonPassword}"\ SNAPCRAFT_UBUNTU_DISCHARGE="${bamboo.snapcraftUbuntuDischargePassword}"\ </s> add SNAPCRAFT_STORE_CREDENTIALS="${bamboo.snapcraftMacaroonPassword}"\ </s> remove snapchannel='candidate' ;; </s> add snapchannel='candidate' ;; </s> remove exit 0 </s> add exit 0
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24b41100c3337822acaf5c118854a66267c5ea81
bamboo-specs/release.yaml
SNAPCRAFT_STORE_CREDENTIALS="${bamboo.snapcraftMacaroonPassword}"\
<mask> <mask> env\ <mask> SNAPCRAFT_CHANNEL="$snapchannel"\ <mask> SNAPCRAFT_EMAIL="${bamboo.snapcraftEmail}"\ <mask> SNAPCRAFT_MACAROON="${bamboo.snapcraftMacaroonPassword}"\ <mask> SNAPCRAFT_UBUNTU_DISCHARGE="${bamboo.snapcraftUbuntuDischargePassword}"\ <mask> ../bamboo-deploy-publisher/deploy.sh adguard-home-snap <mask> 'final-tasks': <mask> - 'clean' <mask> 'requirements': <mask> - 'adg-docker': 'true' </s> Pull request 1848: fix-snap Merge in DNS/adguard-home from fix-snap to master Squashed commit of the following: commit 4a12b2709229150e1b896b71b2b0a99249f94fde Author: Ainar Garipov <[email protected]> Date: Sat May 20 11:51:25 2023 +0300 bamboo-specs: upd snap script </s> remove echo "invalid channel '$channel'" exit 1 ;; </s> add echo "invalid channel '$channel'" exit 1 ;; </s> remove exit 0 </s> add exit 0 </s> remove echo "don't publish to GitHub Releases for this channel" </s> add echo "don't publish to GitHub Releases for this channel" </s> remove snapchannel='edge' ;; </s> add snapchannel='edge' ;; </s> remove snapchannel='beta' ;; </s> add snapchannel='beta' ;;
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24b41100c3337822acaf5c118854a66267c5ea81
bamboo-specs/release.yaml
echo "don't publish to GitHub Releases for this channel"
<mask> readonly channel <mask> <mask> if [ "$channel" != 'release' ] && [ "${channel}" != 'beta' ] <mask> then <mask> echo "don't publish to GitHub Releases for this channel" <mask> <mask> exit 0 <mask> fi <mask> <mask> cd ./dist/ </s> Pull request 1848: fix-snap Merge in DNS/adguard-home from fix-snap to master Squashed commit of the following: commit 4a12b2709229150e1b896b71b2b0a99249f94fde Author: Ainar Garipov <[email protected]> Date: Sat May 20 11:51:25 2023 +0300 bamboo-specs: upd snap script </s> remove exit 0 </s> add exit 0 </s> remove echo "invalid channel '$channel'" exit 1 ;; </s> add echo "invalid channel '$channel'" exit 1 ;; </s> remove snapchannel='edge' ;; </s> add snapchannel='edge' ;; </s> remove snapchannel='beta' ;; </s> add snapchannel='beta' ;; </s> remove snapchannel='candidate' ;; </s> add snapchannel='candidate' ;;
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24b41100c3337822acaf5c118854a66267c5ea81
bamboo-specs/release.yaml
exit 0
<mask> if [ "$channel" != 'release' ] && [ "${channel}" != 'beta' ] <mask> then <mask> echo "don't publish to GitHub Releases for this channel" <mask> <mask> exit 0 <mask> fi <mask> <mask> cd ./dist/ <mask> <mask> env\ </s> Pull request 1848: fix-snap Merge in DNS/adguard-home from fix-snap to master Squashed commit of the following: commit 4a12b2709229150e1b896b71b2b0a99249f94fde Author: Ainar Garipov <[email protected]> Date: Sat May 20 11:51:25 2023 +0300 bamboo-specs: upd snap script </s> remove echo "don't publish to GitHub Releases for this channel" </s> add echo "don't publish to GitHub Releases for this channel" </s> remove echo "invalid channel '$channel'" exit 1 ;; </s> add echo "invalid channel '$channel'" exit 1 ;; </s> remove snapchannel='edge' ;; </s> add snapchannel='edge' ;; </s> remove snapchannel='candidate' ;; </s> add snapchannel='candidate' ;; </s> remove SNAPCRAFT_MACAROON="${bamboo.snapcraftMacaroonPassword}"\ SNAPCRAFT_UBUNTU_DISCHARGE="${bamboo.snapcraftUbuntuDischargePassword}"\ </s> add SNAPCRAFT_STORE_CREDENTIALS="${bamboo.snapcraftMacaroonPassword}"\
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24b41100c3337822acaf5c118854a66267c5ea81
bamboo-specs/release.yaml
CertificatePath string `yaml:"certificate_path" json:"certificate_path"` // certificate file name PrivateKeyPath string `yaml:"private_key_path" json:"private_key_path"` // private key file name CertificateChainData []byte `yaml:"-" json:"-"` PrivateKeyData []byte `yaml:"-" json:"-"`
<mask> type TLSConfig struct { <mask> TLSListenAddr *net.TCPAddr `yaml:"-" json:"-"` <mask> CertificateChain string `yaml:"certificate_chain" json:"certificate_chain"` // PEM-encoded certificates chain <mask> PrivateKey string `yaml:"private_key" json:"private_key"` // PEM-encoded private key <mask> } <mask> <mask> // ServerConfig represents server configuration. <mask> // The zero ServerConfig is empty and ready for use. </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove config.TLS.PrivateKey == "" || config.TLS.CertificateChain == "" { // sleep until necessary data is supplied </s> add len(config.TLS.PrivateKeyData) == 0 || len(config.TLS.CertificateChainData) == 0 { // sleep until necessary data is supplied </s> remove certchain := make([]byte, len(config.TLS.CertificateChain)) copy(certchain, []byte(config.TLS.CertificateChain)) privatekey := make([]byte, len(config.TLS.PrivateKey)) copy(privatekey, []byte(config.TLS.PrivateKey)) </s> add certchain := make([]byte, len(config.TLS.CertificateChainData)) copy(certchain, config.TLS.CertificateChainData) privatekey := make([]byte, len(config.TLS.PrivateKeyData)) copy(privatekey, config.TLS.PrivateKeyData) </s> remove TLSListenAddr: &net.TCPAddr{Port: 0}, CertificateChain: string(certPem), PrivateKey: string(keyPem), </s> add TLSListenAddr: &net.TCPAddr{Port: 0}, CertificateChainData: certPem, PrivateKeyData: keyPem, </s> remove data := validateCertificates(config.TLS.CertificateChain, config.TLS.PrivateKey, config.TLS.ServerName) </s> add data := validateCertificates(string(config.TLS.CertificateChainData), string(config.TLS.PrivateKeyData), config.TLS.ServerName)
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
dnsforward/dnsforward.go
if s.conf.TLSListenAddr != nil && len(s.conf.CertificateChainData) != 0 && len(s.conf.PrivateKeyData) != 0 {
<mask> } <mask> <mask> convertArrayToMap(&s.BlockedHosts, s.conf.BlockedHosts) <mask> <mask> if s.conf.TLSListenAddr != nil && s.conf.CertificateChain != "" && s.conf.PrivateKey != "" { <mask> proxyConfig.TLSListenAddr = s.conf.TLSListenAddr <mask> keypair, err := tls.X509KeyPair([]byte(s.conf.CertificateChain), []byte(s.conf.PrivateKey)) <mask> if err != nil { <mask> return errorx.Decorate(err, "Failed to parse TLS keypair") <mask> } </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove keypair, err := tls.X509KeyPair([]byte(s.conf.CertificateChain), []byte(s.conf.PrivateKey)) </s> add keypair, err := tls.X509KeyPair(s.conf.CertificateChainData, s.conf.PrivateKeyData) </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add status := tlsConfigStatus{} if tlsLoadConfig(&data, &status) { status = validateCertificates(string(data.CertificateChainData), string(data.PrivateKeyData), data.ServerName) } data.tlsConfigStatus = status
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
dnsforward/dnsforward.go
keypair, err := tls.X509KeyPair(s.conf.CertificateChainData, s.conf.PrivateKeyData)
<mask> convertArrayToMap(&s.BlockedHosts, s.conf.BlockedHosts) <mask> <mask> if s.conf.TLSListenAddr != nil && s.conf.CertificateChain != "" && s.conf.PrivateKey != "" { <mask> proxyConfig.TLSListenAddr = s.conf.TLSListenAddr <mask> keypair, err := tls.X509KeyPair([]byte(s.conf.CertificateChain), []byte(s.conf.PrivateKey)) <mask> if err != nil { <mask> return errorx.Decorate(err, "Failed to parse TLS keypair") <mask> } <mask> proxyConfig.TLSConfig = &tls.Config{ <mask> Certificates: []tls.Certificate{keypair}, </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove if s.conf.TLSListenAddr != nil && s.conf.CertificateChain != "" && s.conf.PrivateKey != "" { </s> add if s.conf.TLSListenAddr != nil && len(s.conf.CertificateChainData) != 0 && len(s.conf.PrivateKeyData) != 0 { </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add status := tlsConfigStatus{} if tlsLoadConfig(&data, &status) { status = validateCertificates(string(data.CertificateChainData), string(data.PrivateKeyData), data.ServerName) } data.tlsConfigStatus = status
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
dnsforward/dnsforward.go
TLSListenAddr: &net.TCPAddr{Port: 0}, CertificateChainData: certPem, PrivateKeyData: keyPem,
<mask> s := createTestServer(t) <mask> defer removeDataDir(t) <mask> <mask> s.conf.TLSConfig = TLSConfig{ <mask> TLSListenAddr: &net.TCPAddr{Port: 0}, <mask> CertificateChain: string(certPem), <mask> PrivateKey: string(keyPem), <mask> } <mask> <mask> // Starting the server <mask> err := s.Start(nil) <mask> if err != nil { </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove certchain := make([]byte, len(config.TLS.CertificateChain)) copy(certchain, []byte(config.TLS.CertificateChain)) privatekey := make([]byte, len(config.TLS.PrivateKey)) copy(privatekey, []byte(config.TLS.PrivateKey)) </s> add certchain := make([]byte, len(config.TLS.CertificateChainData)) copy(certchain, config.TLS.CertificateChainData) privatekey := make([]byte, len(config.TLS.PrivateKeyData)) copy(privatekey, config.TLS.PrivateKeyData) </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add status := tlsConfigStatus{} if tlsLoadConfig(&data, &status) { status = validateCertificates(string(data.CertificateChainData), string(data.PrivateKeyData), data.ServerName) } data.tlsConfigStatus = status </s> remove keypair, err := tls.X509KeyPair([]byte(s.conf.CertificateChain), []byte(s.conf.PrivateKey)) </s> add keypair, err := tls.X509KeyPair(s.conf.CertificateChainData, s.conf.PrivateKeyData)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
dnsforward/dnsforward_test.go
status := tlsConfigStatus{} if !tlsLoadConfig(&config.TLS, &status) { log.Error("%s", status.WarningValidation) return err }
<mask> config.Clients = nil <mask> <mask> // Deduplicate filters <mask> deduplicateFilters() <mask> <mask> updateUniqueFilterID(config.Filters) <mask> </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add status := tlsConfigStatus{} if tlsLoadConfig(&data, &status) { status = validateCertificates(string(data.CertificateChainData), string(data.PrivateKeyData), data.ServerName) } data.tlsConfigStatus = status </s> remove TLSListenAddr: &net.TCPAddr{Port: 0}, CertificateChain: string(certPem), PrivateKey: string(keyPem), </s> add TLSListenAddr: &net.TCPAddr{Port: 0}, CertificateChainData: certPem, PrivateKeyData: keyPem, </s> remove keypair, err := tls.X509KeyPair([]byte(s.conf.CertificateChain), []byte(s.conf.PrivateKey)) </s> add keypair, err := tls.X509KeyPair(s.conf.CertificateChainData, s.conf.PrivateKeyData)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
home/config.go
"io/ioutil"
<mask> "errors" <mask> "fmt" <mask> "net/http" <mask> "reflect" <mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove certchain := make([]byte, len(config.TLS.CertificateChain)) copy(certchain, []byte(config.TLS.CertificateChain)) privatekey := make([]byte, len(config.TLS.PrivateKey)) copy(privatekey, []byte(config.TLS.PrivateKey)) </s> add certchain := make([]byte, len(config.TLS.CertificateChainData)) copy(certchain, config.TLS.CertificateChainData) privatekey := make([]byte, len(config.TLS.PrivateKeyData)) copy(privatekey, config.TLS.PrivateKeyData) </s> remove data := validateCertificates(config.TLS.CertificateChain, config.TLS.PrivateKey, config.TLS.ServerName) </s> add data := validateCertificates(string(config.TLS.CertificateChainData), string(config.TLS.PrivateKeyData), config.TLS.ServerName) </s> remove config.TLS.PrivateKey == "" || config.TLS.CertificateChain == "" { // sleep until necessary data is supplied </s> add len(config.TLS.PrivateKeyData) == 0 || len(config.TLS.CertificateChainData) == 0 { // sleep until necessary data is supplied
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
home/control_tls.go
status := tlsConfigStatus{} if tlsLoadConfig(&data, &status) { status = validateCertificates(string(data.CertificateChainData), string(data.PrivateKeyData), data.ServerName) } data.tlsConfigStatus = status
<mask> return <mask> } <mask> } <mask> <mask> data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) <mask> marshalTLS(w, data) <mask> } <mask> <mask> func handleTLSConfigure(w http.ResponseWriter, r *http.Request) { <mask> data, err := unmarshalTLS(r) </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
home/control_tls.go
status := tlsConfigStatus{} if !tlsLoadConfig(&data, &status) { data.tlsConfigStatus = status marshalTLS(w, data) return } data.tlsConfigStatus = validateCertificates(string(data.CertificateChainData), string(data.PrivateKeyData), data.ServerName)
<mask> } <mask> <mask> restartHTTPS := false <mask> if !reflect.DeepEqual(config.TLS.tlsConfigSettings, data.tlsConfigSettings) { <mask> log.Printf("tls config settings have changed, will restart HTTPS server") <mask> restartHTTPS = true <mask> } </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add </s> remove certchain := make([]byte, len(config.TLS.CertificateChain)) copy(certchain, []byte(config.TLS.CertificateChain)) privatekey := make([]byte, len(config.TLS.PrivateKey)) copy(privatekey, []byte(config.TLS.PrivateKey)) </s> add certchain := make([]byte, len(config.TLS.CertificateChainData)) copy(certchain, config.TLS.CertificateChainData) privatekey := make([]byte, len(config.TLS.PrivateKeyData)) copy(privatekey, config.TLS.PrivateKeyData) </s> remove data := validateCertificates(config.TLS.CertificateChain, config.TLS.PrivateKey, config.TLS.ServerName) </s> add data := validateCertificates(string(config.TLS.CertificateChainData), string(config.TLS.PrivateKeyData), config.TLS.ServerName) </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add status := tlsConfigStatus{} if tlsLoadConfig(&data, &status) { status = validateCertificates(string(data.CertificateChainData), string(data.PrivateKeyData), data.ServerName) } data.tlsConfigStatus = status
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
home/control_tls.go
<mask> } <mask> } <mask> <mask> restartHTTPS := false <mask> data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) <mask> if !reflect.DeepEqual(config.TLS.tlsConfigSettings, data.tlsConfigSettings) { <mask> log.Printf("tls config settings have changed, will restart HTTPS server") <mask> restartHTTPS = true <mask> } <mask> config.TLS = data </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add status := tlsConfigStatus{} if tlsLoadConfig(&data, &status) { status = validateCertificates(string(data.CertificateChainData), string(data.PrivateKeyData), data.ServerName) } data.tlsConfigStatus = status </s> remove certchain := make([]byte, len(config.TLS.CertificateChain)) copy(certchain, []byte(config.TLS.CertificateChain)) privatekey := make([]byte, len(config.TLS.PrivateKey)) copy(privatekey, []byte(config.TLS.PrivateKey)) </s> add certchain := make([]byte, len(config.TLS.CertificateChainData)) copy(certchain, config.TLS.CertificateChainData) privatekey := make([]byte, len(config.TLS.PrivateKeyData)) copy(privatekey, config.TLS.PrivateKeyData)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
home/control_tls.go
if data.CertificatePath != "" { return data, fmt.Errorf("certificate data and file can't be set together") }
<mask> } <mask> data.CertificateChain = string(certPEM) <mask> } <mask> <mask> if data.PrivateKey != "" { <mask> keyPEM, err := base64.StdEncoding.DecodeString(data.PrivateKey) <mask> if err != nil { </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove if s.conf.TLSListenAddr != nil && s.conf.CertificateChain != "" && s.conf.PrivateKey != "" { </s> add if s.conf.TLSListenAddr != nil && len(s.conf.CertificateChainData) != 0 && len(s.conf.PrivateKeyData) != 0 { </s> remove keypair, err := tls.X509KeyPair([]byte(s.conf.CertificateChain), []byte(s.conf.PrivateKey)) </s> add keypair, err := tls.X509KeyPair(s.conf.CertificateChainData, s.conf.PrivateKeyData) </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add status := tlsConfigStatus{} if tlsLoadConfig(&data, &status) { status = validateCertificates(string(data.CertificateChainData), string(data.PrivateKeyData), data.ServerName) } data.tlsConfigStatus = status
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
home/control_tls.go
if data.PrivateKeyPath != "" { return data, fmt.Errorf("private key data and file can't be set together") }
<mask> <mask> data.PrivateKey = string(keyPEM) <mask> } <mask> <mask> return data, nil <mask> } </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add status := tlsConfigStatus{} if tlsLoadConfig(&data, &status) { status = validateCertificates(string(data.CertificateChainData), string(data.PrivateKeyData), data.ServerName) } data.tlsConfigStatus = status </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
home/control_tls.go
len(config.TLS.PrivateKeyData) == 0 || len(config.TLS.CertificateChainData) == 0 { // sleep until necessary data is supplied
<mask> config.httpsServer.cond.L.Lock() <mask> // this mechanism doesn't let us through until all conditions are met <mask> for config.TLS.Enabled == false || <mask> config.TLS.PortHTTPS == 0 || <mask> config.TLS.PrivateKey == "" || <mask> config.TLS.CertificateChain == "" { // sleep until necessary data is supplied <mask> config.httpsServer.cond.Wait() <mask> } <mask> address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.TLS.PortHTTPS)) <mask> // validate current TLS config and update warnings (it could have been loaded from file) <mask> data := validateCertificates(config.TLS.CertificateChain, config.TLS.PrivateKey, config.TLS.ServerName) </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove data := validateCertificates(config.TLS.CertificateChain, config.TLS.PrivateKey, config.TLS.ServerName) </s> add data := validateCertificates(string(config.TLS.CertificateChainData), string(config.TLS.PrivateKeyData), config.TLS.ServerName) </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add </s> remove if s.conf.TLSListenAddr != nil && s.conf.CertificateChain != "" && s.conf.PrivateKey != "" { </s> add if s.conf.TLSListenAddr != nil && len(s.conf.CertificateChainData) != 0 && len(s.conf.PrivateKeyData) != 0 {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
home/home.go
data := validateCertificates(string(config.TLS.CertificateChainData), string(config.TLS.PrivateKeyData), config.TLS.ServerName)
<mask> config.httpsServer.cond.Wait() <mask> } <mask> address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.TLS.PortHTTPS)) <mask> // validate current TLS config and update warnings (it could have been loaded from file) <mask> data := validateCertificates(config.TLS.CertificateChain, config.TLS.PrivateKey, config.TLS.ServerName) <mask> if !data.ValidPair { <mask> cleanupAlways() <mask> log.Fatal(data.WarningValidation) <mask> } <mask> config.Lock() </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove config.TLS.PrivateKey == "" || config.TLS.CertificateChain == "" { // sleep until necessary data is supplied </s> add len(config.TLS.PrivateKeyData) == 0 || len(config.TLS.CertificateChainData) == 0 { // sleep until necessary data is supplied </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add </s> remove certchain := make([]byte, len(config.TLS.CertificateChain)) copy(certchain, []byte(config.TLS.CertificateChain)) privatekey := make([]byte, len(config.TLS.PrivateKey)) copy(privatekey, []byte(config.TLS.PrivateKey)) </s> add certchain := make([]byte, len(config.TLS.CertificateChainData)) copy(certchain, config.TLS.CertificateChainData) privatekey := make([]byte, len(config.TLS.PrivateKeyData)) copy(privatekey, config.TLS.PrivateKeyData)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
home/home.go
certchain := make([]byte, len(config.TLS.CertificateChainData)) copy(certchain, config.TLS.CertificateChainData) privatekey := make([]byte, len(config.TLS.PrivateKeyData)) copy(privatekey, config.TLS.PrivateKeyData)
<mask> config.Unlock() <mask> <mask> // prepare certs for HTTPS server <mask> // important -- they have to be copies, otherwise changing the contents in config.TLS will break encryption for in-flight requests <mask> certchain := make([]byte, len(config.TLS.CertificateChain)) <mask> copy(certchain, []byte(config.TLS.CertificateChain)) <mask> privatekey := make([]byte, len(config.TLS.PrivateKey)) <mask> copy(privatekey, []byte(config.TLS.PrivateKey)) <mask> cert, err := tls.X509KeyPair(certchain, privatekey) <mask> if err != nil { <mask> cleanupAlways() <mask> log.Fatal(err) <mask> } </s> + config: add certificate_path, private_key_path * POST /control/tls/configure: support certificate_path and private_key_path </s> remove data.tlsConfigStatus = validateCertificates(data.CertificateChain, data.PrivateKey, data.ServerName) </s> add </s> remove TLSListenAddr: &net.TCPAddr{Port: 0}, CertificateChain: string(certPem), PrivateKey: string(keyPem), </s> add TLSListenAddr: &net.TCPAddr{Port: 0}, CertificateChainData: certPem, PrivateKeyData: keyPem, </s> remove data := validateCertificates(config.TLS.CertificateChain, config.TLS.PrivateKey, config.TLS.ServerName) </s> add data := validateCertificates(string(config.TLS.CertificateChainData), string(config.TLS.PrivateKeyData), config.TLS.ServerName)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24bb708b21e158712e4c67ceca2816defd44ca88
home/home.go
func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string) error {
<mask> }() <mask> } <mask> } <mask> <mask> // Return 0 on success <mask> func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string) int { <mask> log.Tracef("got certificate: %s", certChain) <mask> <mask> // now do a more extended validation <mask> var certs []*pem.Block // PEM-encoded certificates <mask> var skippedBytes []string // skipped bytes </s> * helper functions return 'error', not 'int' </s> remove // Return 0 on success func validatePkey(data *tlsConfigStatus, pkey string) int { </s> add func validatePkey(data *tlsConfigStatus, pkey string) error { </s> remove return 0 </s> add return nil </s> remove if verifyCertChain(&data, certChain, serverName) != 0 { </s> add if verifyCertChain(&data, certChain, serverName) != nil { </s> remove return 1 </s> add return errors.New("") </s> remove if validatePkey(&data, pkey) != 0 { </s> add if validatePkey(&data, pkey) != nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24edf7eeb66668893b9add03003309d755295088
control.go
return errors.New("")
<mask> for _, cert := range certs { <mask> parsed, err := x509.ParseCertificate(cert.Bytes) <mask> if err != nil { <mask> data.WarningValidation = fmt.Sprintf("Failed to parse certificate: %s", err) <mask> return 1 <mask> } <mask> parsedCerts = append(parsedCerts, parsed) <mask> } <mask> <mask> if len(parsedCerts) == 0 { </s> * helper functions return 'error', not 'int' </s> remove return 1 </s> add return errors.New("") </s> remove return 1 </s> add return errors.New("") </s> remove return 1 </s> add return errors.New("") </s> remove // Return 0 on success func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string) int { </s> add func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string) error { </s> remove if validatePkey(&data, pkey) != 0 { </s> add if validatePkey(&data, pkey) != nil {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24edf7eeb66668893b9add03003309d755295088
control.go
return errors.New("")
<mask> } <mask> <mask> if len(parsedCerts) == 0 { <mask> data.WarningValidation = fmt.Sprintf("You have specified an empty certificate") <mask> return 1 <mask> } <mask> <mask> data.ValidCert = true <mask> <mask> // spew.Dump(parsedCerts) </s> * helper functions return 'error', not 'int' </s> remove return 1 </s> add return errors.New("") </s> remove return 1 </s> add return errors.New("") </s> remove return 1 </s> add return errors.New("") </s> remove return 0 </s> add return nil </s> remove return 0 </s> add return nil
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24edf7eeb66668893b9add03003309d755295088
control.go
return nil
<mask> data.NotBefore = mainCert.NotBefore <mask> data.DNSNames = mainCert.DNSNames <mask> } <mask> <mask> return 0 <mask> } <mask> <mask> // Return 0 on success <mask> func validatePkey(data *tlsConfigStatus, pkey string) int { <mask> // now do a more extended validation </s> * helper functions return 'error', not 'int' </s> remove // Return 0 on success func validatePkey(data *tlsConfigStatus, pkey string) int { </s> add func validatePkey(data *tlsConfigStatus, pkey string) error { </s> remove // Return 0 on success func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string) int { </s> add func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string) error { </s> remove return 1 </s> add return errors.New("") </s> remove if validatePkey(&data, pkey) != 0 { </s> add if validatePkey(&data, pkey) != nil { </s> remove return 1 </s> add return errors.New("")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24edf7eeb66668893b9add03003309d755295088
control.go
func validatePkey(data *tlsConfigStatus, pkey string) error {
<mask> <mask> return 0 <mask> } <mask> <mask> // Return 0 on success <mask> func validatePkey(data *tlsConfigStatus, pkey string) int { <mask> // now do a more extended validation <mask> var key *pem.Block // PEM-encoded certificates <mask> var skippedBytes []string // skipped bytes <mask> <mask> // go through all pem blocks, but take first valid pem block and drop the rest </s> * helper functions return 'error', not 'int' </s> remove // Return 0 on success func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string) int { </s> add func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string) error { </s> remove return 0 </s> add return nil </s> remove if verifyCertChain(&data, certChain, serverName) != 0 { </s> add if verifyCertChain(&data, certChain, serverName) != nil { </s> remove if validatePkey(&data, pkey) != 0 { </s> add if validatePkey(&data, pkey) != nil { </s> remove return 1 </s> add return errors.New("")
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24edf7eeb66668893b9add03003309d755295088
control.go
return errors.New("")
<mask> } <mask> <mask> if key == nil { <mask> data.WarningValidation = "No valid keys were found" <mask> return 1 <mask> } <mask> <mask> // parse the decoded key <mask> _, keytype, err := parsePrivateKey(key.Bytes) <mask> if err != nil { </s> * helper functions return 'error', not 'int' </s> remove return 1 </s> add return errors.New("") </s> remove return 1 </s> add return errors.New("") </s> remove return 1 </s> add return errors.New("") </s> remove if validatePkey(&data, pkey) != 0 { </s> add if validatePkey(&data, pkey) != nil { </s> remove if verifyCertChain(&data, certChain, serverName) != 0 { </s> add if verifyCertChain(&data, certChain, serverName) != nil {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24edf7eeb66668893b9add03003309d755295088
control.go
return errors.New("")
<mask> // parse the decoded key <mask> _, keytype, err := parsePrivateKey(key.Bytes) <mask> if err != nil { <mask> data.WarningValidation = fmt.Sprintf("Failed to parse private key: %s", err) <mask> return 1 <mask> } <mask> <mask> data.ValidKey = true <mask> data.KeyType = keytype <mask> return 0 </s> * helper functions return 'error', not 'int' </s> remove return 1 </s> add return errors.New("") </s> remove return 1 </s> add return errors.New("") </s> remove return 0 </s> add return nil </s> remove return 1 </s> add return errors.New("") </s> remove return 0 </s> add return nil
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24edf7eeb66668893b9add03003309d755295088
control.go
return nil
<mask> } <mask> <mask> data.ValidKey = true <mask> data.KeyType = keytype <mask> return 0 <mask> } <mask> <mask> /* Process certificate data and its private key. <mask> All parameters are optional. <mask> On error, return partially set object </s> * helper functions return 'error', not 'int' </s> remove return 1 </s> add return errors.New("") </s> remove return 1 </s> add return errors.New("") </s> remove if verifyCertChain(&data, certChain, serverName) != 0 { </s> add if verifyCertChain(&data, certChain, serverName) != nil { </s> remove if validatePkey(&data, pkey) != 0 { </s> add if validatePkey(&data, pkey) != nil { </s> remove return 0 </s> add return nil
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24edf7eeb66668893b9add03003309d755295088
control.go
if verifyCertChain(&data, certChain, serverName) != nil {
<mask> var data tlsConfigStatus <mask> <mask> // check only public certificate separately from the key <mask> if certChain != "" { <mask> if verifyCertChain(&data, certChain, serverName) != 0 { <mask> return data <mask> } <mask> } <mask> <mask> // validate private key (right now the only validation possible is just parsing it) </s> * helper functions return 'error', not 'int' </s> remove if validatePkey(&data, pkey) != 0 { </s> add if validatePkey(&data, pkey) != nil { </s> remove // Return 0 on success func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string) int { </s> add func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string) error { </s> remove return 0 </s> add return nil </s> remove return 1 </s> add return errors.New("") </s> remove // Return 0 on success func validatePkey(data *tlsConfigStatus, pkey string) int { </s> add func validatePkey(data *tlsConfigStatus, pkey string) error {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24edf7eeb66668893b9add03003309d755295088
control.go
if validatePkey(&data, pkey) != nil {
<mask> } <mask> <mask> // validate private key (right now the only validation possible is just parsing it) <mask> if pkey != "" { <mask> if validatePkey(&data, pkey) != 0 { <mask> return data <mask> } <mask> } <mask> <mask> // if both are set, validate both in unison </s> * helper functions return 'error', not 'int' </s> remove if verifyCertChain(&data, certChain, serverName) != 0 { </s> add if verifyCertChain(&data, certChain, serverName) != nil { </s> remove return 1 </s> add return errors.New("") </s> remove return 0 </s> add return nil </s> remove return 1 </s> add return errors.New("") </s> remove return 0 </s> add return nil
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24edf7eeb66668893b9add03003309d755295088
control.go
"update_failed_try_later": "Update failed, please try again later",
<mask> "update_now": "Update now", <mask> "update_failed": "Update failed", <mask> "processing_update": "Please wait, AdGuard Home is being updated" <mask> } </s> * client: add update timeout </s> remove }, CHECK_TIMEOUT); </s> add const rmTimeout = t => t && clearTimeout(t); const setRecursiveTimeout = (time, ...args) => setTimeout( checkUpdate, time, ...args, ); console.log(count); axios.get('control/status') .then((response) => { rmTimeout(timeout); if (response) { dispatch(getUpdateSuccess()); window.location.reload(true); } timeout = setRecursiveTimeout(CHECK_TIMEOUT, count += 1); }) .catch(() => { rmTimeout(timeout); timeout = setRecursiveTimeout(CHECK_TIMEOUT, count += 1); }); return false; }; checkUpdate(); </s> remove const timer = setInterval(async () => { const dnsStatus = await apiClient.getGlobalStatus(); if (dnsStatus) { clearInterval(timer); dispatch(getUpdateSuccess()); window.location.reload(true); </s> add const checkUpdate = async (attempts) => { let count = attempts || 1; let timeout; if (count > 60) { dispatch(addErrorToast({ error: 'update_failed_try_later' })); dispatch(getUpdateFailure()); return false;
[ "keep", "add", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24f582d36d99934295a2417de1c10d7a0afced25
client/src/__locales/en.json
import axios from 'axios';
<mask> import { t } from 'i18next'; <mask> import { showLoading, hideLoading } from 'react-redux-loading-bar'; <mask> <mask> import { normalizeHistory, normalizeFilteringStatus, normalizeLogs, normalizeTextarea } from '../helpers/helpers'; <mask> import { SETTINGS_NAMES, CHECK_TIMEOUT } from '../helpers/constants'; <mask> import Api from '../api/Api'; <mask> <mask> const apiClient = new Api(); </s> * client: add update timeout </s> remove }, CHECK_TIMEOUT); </s> add const rmTimeout = t => t && clearTimeout(t); const setRecursiveTimeout = (time, ...args) => setTimeout( checkUpdate, time, ...args, ); console.log(count); axios.get('control/status') .then((response) => { rmTimeout(timeout); if (response) { dispatch(getUpdateSuccess()); window.location.reload(true); } timeout = setRecursiveTimeout(CHECK_TIMEOUT, count += 1); }) .catch(() => { rmTimeout(timeout); timeout = setRecursiveTimeout(CHECK_TIMEOUT, count += 1); }); return false; }; checkUpdate(); </s> remove const timer = setInterval(async () => { const dnsStatus = await apiClient.getGlobalStatus(); if (dnsStatus) { clearInterval(timer); dispatch(getUpdateSuccess()); window.location.reload(true); </s> add const checkUpdate = async (attempts) => { let count = attempts || 1; let timeout; if (count > 60) { dispatch(addErrorToast({ error: 'update_failed_try_later' })); dispatch(getUpdateFailure()); return false;
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24f582d36d99934295a2417de1c10d7a0afced25
client/src/actions/index.js
const checkUpdate = async (attempts) => { let count = attempts || 1; let timeout; if (count > 60) { dispatch(addErrorToast({ error: 'update_failed_try_later' })); dispatch(getUpdateFailure()); return false;
<mask> dispatch(getUpdateRequest()); <mask> try { <mask> await apiClient.getUpdate(); <mask> <mask> const timer = setInterval(async () => { <mask> const dnsStatus = await apiClient.getGlobalStatus(); <mask> if (dnsStatus) { <mask> clearInterval(timer); <mask> dispatch(getUpdateSuccess()); <mask> window.location.reload(true); <mask> } <mask> }, CHECK_TIMEOUT); <mask> } catch (error) { <mask> dispatch(addErrorToast({ error: 'update_failed' })); <mask> dispatch(getUpdateFailure()); </s> * client: add update timeout </s> remove }, CHECK_TIMEOUT); </s> add const rmTimeout = t => t && clearTimeout(t); const setRecursiveTimeout = (time, ...args) => setTimeout( checkUpdate, time, ...args, ); console.log(count); axios.get('control/status') .then((response) => { rmTimeout(timeout); if (response) { dispatch(getUpdateSuccess()); window.location.reload(true); } timeout = setRecursiveTimeout(CHECK_TIMEOUT, count += 1); }) .catch(() => { rmTimeout(timeout); timeout = setRecursiveTimeout(CHECK_TIMEOUT, count += 1); }); return false; }; checkUpdate();
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24f582d36d99934295a2417de1c10d7a0afced25
client/src/actions/index.js
const rmTimeout = t => t && clearTimeout(t); const setRecursiveTimeout = (time, ...args) => setTimeout( checkUpdate, time, ...args, ); console.log(count); axios.get('control/status') .then((response) => { rmTimeout(timeout); if (response) { dispatch(getUpdateSuccess()); window.location.reload(true); } timeout = setRecursiveTimeout(CHECK_TIMEOUT, count += 1); }) .catch(() => { rmTimeout(timeout); timeout = setRecursiveTimeout(CHECK_TIMEOUT, count += 1); }); return false; }; checkUpdate();
<mask> clearInterval(timer); <mask> dispatch(getUpdateSuccess()); <mask> window.location.reload(true); <mask> } <mask> }, CHECK_TIMEOUT); <mask> } catch (error) { <mask> dispatch(addErrorToast({ error: 'update_failed' })); <mask> dispatch(getUpdateFailure()); <mask> } <mask> }; </s> * client: add update timeout </s> remove const timer = setInterval(async () => { const dnsStatus = await apiClient.getGlobalStatus(); if (dnsStatus) { clearInterval(timer); dispatch(getUpdateSuccess()); window.location.reload(true); </s> add const checkUpdate = async (attempts) => { let count = attempts || 1; let timeout; if (count > 60) { dispatch(addErrorToast({ error: 'update_failed_try_later' })); dispatch(getUpdateFailure()); return false;
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/24f582d36d99934295a2417de1c10d7a0afced25
client/src/actions/index.js
<mask> try { <mask> const dnsStatus = await apiClient.getGlobalStatus(); <mask> dispatch(dnsStatusSuccess(dnsStatus)); <mask> dispatch(getVersion()); <mask> dispatch(getClients()); <mask> dispatch(getTopStats()); <mask> dispatch(getTlsStatus()); <mask> } catch (error) { <mask> dispatch(addErrorToast({ error })); <mask> dispatch(initSettingsFailure()); <mask> } </s> * client: remove /clients and /stats_top request from global requests </s> remove import { getClients } from '../actions'; </s> add import { getClients, getTopStats } from '../actions'; </s> remove import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast } from '../actions'; </s> add import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast, getClients } from '../actions';
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2520a62e2430dac1d9bf689c567b95d419a78339
client/src/actions/index.js
this.props.getClients();
<mask> class Logs extends Component { <mask> componentDidMount() { <mask> this.getLogs(); <mask> this.props.getFilteringStatus(); <mask> } <mask> <mask> componentDidUpdate(prevProps) { <mask> // get logs when queryLog becomes enabled <mask> if (this.props.dashboard.queryLogEnabled && !prevProps.dashboard.queryLogEnabled) { </s> * client: remove /clients and /stats_top request from global requests </s> remove import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast } from '../actions'; </s> add import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast, getClients } from '../actions'; </s> remove import { getClients } from '../actions'; </s> add import { getClients, getTopStats } from '../actions'; </s> remove dispatch(getClients()); dispatch(getTopStats()); </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2520a62e2430dac1d9bf689c567b95d419a78339
client/src/components/Logs/index.js
getClients: PropTypes.func.isRequired,
<mask> logStatusProcessing: PropTypes.bool, <mask> t: PropTypes.func, <mask> }; <mask> <mask> export default withNamespaces()(Logs); </s> * client: remove /clients and /stats_top request from global requests </s> remove import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast } from '../actions'; </s> add import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast, getClients } from '../actions'; </s> remove import { getClients } from '../actions'; </s> add import { getClients, getTopStats } from '../actions';
[ "keep", "add", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2520a62e2430dac1d9bf689c567b95d419a78339
client/src/components/Logs/index.js
this.props.getTopStats();
<mask> <mask> class Clients extends Component { <mask> componentDidMount() { <mask> this.props.getClients(); <mask> } <mask> <mask> render() { <mask> const { </s> * client: remove /clients and /stats_top request from global requests </s> remove import { getClients } from '../actions'; </s> add import { getClients, getTopStats } from '../actions'; </s> remove import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast } from '../actions'; </s> add import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast, getClients } from '../actions'; </s> remove dispatch(getClients()); dispatch(getTopStats()); </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2520a62e2430dac1d9bf689c567b95d419a78339
client/src/components/Settings/Clients/index.js
getTopStats: PropTypes.func.isRequired,
<mask> deleteClient: PropTypes.func.isRequired, <mask> addClient: PropTypes.func.isRequired, <mask> updateClient: PropTypes.func.isRequired, <mask> getClients: PropTypes.func.isRequired, <mask> topStats: PropTypes.object, <mask> }; <mask> <mask> export default withNamespaces()(Clients); </s> * client: remove /clients and /stats_top request from global requests </s> remove import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast } from '../actions'; </s> add import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast, getClients } from '../actions'; </s> remove import { getClients } from '../actions'; </s> add import { getClients, getTopStats } from '../actions';
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2520a62e2430dac1d9bf689c567b95d419a78339
client/src/components/Settings/Clients/index.js
import { getClients, getTopStats } from '../actions';
<mask> import { connect } from 'react-redux'; <mask> import { getClients } from '../actions'; <mask> import { addClient, updateClient, deleteClient, toggleClientModal } from '../actions/clients'; <mask> import Clients from '../components/Settings/Clients'; <mask> <mask> const mapStateToProps = (state) => { <mask> const { dashboard, clients } = state; </s> * client: remove /clients and /stats_top request from global requests </s> remove import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast } from '../actions'; </s> add import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast, getClients } from '../actions'; </s> remove dispatch(getClients()); dispatch(getTopStats()); </s> add
[ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2520a62e2430dac1d9bf689c567b95d419a78339
client/src/containers/Clients.js