docstring_tokens
stringlengths 18
16.9k
| code_tokens
stringlengths 75
1.81M
| html_url
stringlengths 74
116
| file_name
stringlengths 3
311
|
---|---|---|---|
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> refreshStatus = 1
<mask> refreshLock.Lock()
<mask> nUpdated := refreshFiltersIfNecessary(true)
<mask> refreshLock.Unlock()
<mask> refreshStatus = 0
<mask> return nUpdated, nil
<mask> }
<mask>
</s> Merge: * filters: use increasing update interval
Close #1246
Squashed commit of the following:
commit d0b40719457c1bc41c2f32b425c95e35916366e9
Author: Simon Zolin <[email protected]>
Date: Wed Jan 15 13:41:45 2020 +0300
minor
commit c1b682156c1b71dcfc2febe02e3df0a4d5e0a81b
Author: Simon Zolin <[email protected]>
Date: Tue Jan 14 20:09:27 2020 +0300
* filters: increasing update interval </s> remove _ = refreshFiltersIfNecessary(false)
</s> add nUpdated, isNetworkErr = refreshFiltersIfNecessary(false) </s> add isNetworkErr := false </s> add if nUpdated != 0 {
intval = maxInterval
}
}
if isNetworkErr {
intval *= 2
if intval > maxInterval {
intval = maxInterval
} </s> add const maxInterval = 1 * 60 * 60
intval := 5 // use a dynamically increasing time interval
nUpdated := 0 </s> remove time.Sleep(1 * time.Hour)
</s> add time.Sleep(time.Duration(intval) * time.Second) </s> add nfail := 0 | https://github.com/AdguardTeam/AdGuardHome/commit/47631105c7e92b6dbc232110af3050b4d8534f8f | home/filter.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // . store the new data on disk (1.txt)
<mask> // . Pass new filters to dnsfilter object - it analyzes new data while the old filters are still active
<mask> // . dnsfilter activates new filters
<mask> // . Remove the old filter files (1.txt.old)
<mask> func refreshFiltersIfNecessary(force bool) int {
<mask> var updateFilters []filter
<mask> var updateFlags []bool // 'true' if filter data has changed
<mask>
<mask> log.Debug("Filters: updating...")
<mask>
</s> Merge: * filters: use increasing update interval
Close #1246
Squashed commit of the following:
commit d0b40719457c1bc41c2f32b425c95e35916366e9
Author: Simon Zolin <[email protected]>
Date: Wed Jan 15 13:41:45 2020 +0300
minor
commit c1b682156c1b71dcfc2febe02e3df0a4d5e0a81b
Author: Simon Zolin <[email protected]>
Date: Tue Jan 14 20:09:27 2020 +0300
* filters: increasing update interval </s> remove return updateCount
</s> add return updateCount, false </s> remove time.Sleep(1 * time.Hour)
</s> add time.Sleep(time.Duration(intval) * time.Second) </s> add const maxInterval = 1 * 60 * 60
intval := 5 // use a dynamically increasing time interval
nUpdated := 0 </s> add nfail++ </s> add nfail := 0 </s> add if nfail == len(updateFilters) {
return 0, true
}
| https://github.com/AdguardTeam/AdGuardHome/commit/47631105c7e92b6dbc232110af3050b4d8534f8f | home/filter.go |
keep keep keep add keep keep keep keep keep keep | <mask> updateFilters = append(updateFilters, uf)
<mask> }
<mask> config.RUnlock()
<mask>
<mask> for i := range updateFilters {
<mask> uf := &updateFilters[i]
<mask> updated, err := uf.update()
<mask> updateFlags = append(updateFlags, updated)
<mask> if err != nil {
<mask> nfail++
</s> Merge: * filters: use increasing update interval
Close #1246
Squashed commit of the following:
commit d0b40719457c1bc41c2f32b425c95e35916366e9
Author: Simon Zolin <[email protected]>
Date: Wed Jan 15 13:41:45 2020 +0300
minor
commit c1b682156c1b71dcfc2febe02e3df0a4d5e0a81b
Author: Simon Zolin <[email protected]>
Date: Tue Jan 14 20:09:27 2020 +0300
* filters: increasing update interval </s> add nfail++ </s> add if nfail == len(updateFilters) {
return 0, true
}
</s> add isNetworkErr := false </s> add const maxInterval = 1 * 60 * 60
intval := 5 // use a dynamically increasing time interval
nUpdated := 0 </s> remove nUpdated := refreshFiltersIfNecessary(true)
</s> add nUpdated, _ := refreshFiltersIfNecessary(true) </s> remove _ = refreshFiltersIfNecessary(false)
</s> add nUpdated, isNetworkErr = refreshFiltersIfNecessary(false) | https://github.com/AdguardTeam/AdGuardHome/commit/47631105c7e92b6dbc232110af3050b4d8534f8f | home/filter.go |
keep keep keep add keep keep keep keep keep keep | <mask> uf := &updateFilters[i]
<mask> updated, err := uf.update()
<mask> updateFlags = append(updateFlags, updated)
<mask> if err != nil {
<mask> log.Printf("Failed to update filter %s: %s\n", uf.URL, err)
<mask> continue
<mask> }
<mask> uf.LastUpdated = now
<mask> }
<mask>
</s> Merge: * filters: use increasing update interval
Close #1246
Squashed commit of the following:
commit d0b40719457c1bc41c2f32b425c95e35916366e9
Author: Simon Zolin <[email protected]>
Date: Wed Jan 15 13:41:45 2020 +0300
minor
commit c1b682156c1b71dcfc2febe02e3df0a4d5e0a81b
Author: Simon Zolin <[email protected]>
Date: Tue Jan 14 20:09:27 2020 +0300
* filters: increasing update interval </s> add nfail := 0 </s> add if nfail == len(updateFilters) {
return 0, true
}
</s> remove nUpdated := refreshFiltersIfNecessary(true)
</s> add nUpdated, _ := refreshFiltersIfNecessary(true) </s> add if nUpdated != 0 {
intval = maxInterval
}
}
if isNetworkErr {
intval *= 2
if intval > maxInterval {
intval = maxInterval
} </s> remove return updateCount
</s> add return updateCount, false </s> remove _ = refreshFiltersIfNecessary(false)
</s> add nUpdated, isNetworkErr = refreshFiltersIfNecessary(false) | https://github.com/AdguardTeam/AdGuardHome/commit/47631105c7e92b6dbc232110af3050b4d8534f8f | home/filter.go |
keep add keep keep keep keep keep | <mask> }
<mask>
<mask> updateCount := 0
<mask> for i := range updateFilters {
<mask> uf := &updateFilters[i]
<mask> updated := updateFlags[i]
<mask> if updated {
</s> Merge: * filters: use increasing update interval
Close #1246
Squashed commit of the following:
commit d0b40719457c1bc41c2f32b425c95e35916366e9
Author: Simon Zolin <[email protected]>
Date: Wed Jan 15 13:41:45 2020 +0300
minor
commit c1b682156c1b71dcfc2febe02e3df0a4d5e0a81b
Author: Simon Zolin <[email protected]>
Date: Tue Jan 14 20:09:27 2020 +0300
* filters: increasing update interval </s> add nfail := 0 </s> remove return updateCount
</s> add return updateCount, false </s> add nfail++ </s> add isNetworkErr := false </s> add const maxInterval = 1 * 60 * 60
intval := 5 // use a dynamically increasing time interval
nUpdated := 0 </s> remove func refreshFiltersIfNecessary(force bool) int {
</s> add //
// Return the number of updated filters
// Return TRUE - there was a network error and nothing could be updated
func refreshFiltersIfNecessary(force bool) (int, bool) { | https://github.com/AdguardTeam/AdGuardHome/commit/47631105c7e92b6dbc232110af3050b4d8534f8f | home/filter.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask> }
<mask>
<mask> log.Debug("Filters: update finished")
<mask> return updateCount
<mask> }
<mask>
<mask> // Allows printable UTF-8 text with CR, LF, TAB characters
<mask> func isPrintableText(data []byte) bool {
<mask> for _, c := range data {
</s> Merge: * filters: use increasing update interval
Close #1246
Squashed commit of the following:
commit d0b40719457c1bc41c2f32b425c95e35916366e9
Author: Simon Zolin <[email protected]>
Date: Wed Jan 15 13:41:45 2020 +0300
minor
commit c1b682156c1b71dcfc2febe02e3df0a4d5e0a81b
Author: Simon Zolin <[email protected]>
Date: Tue Jan 14 20:09:27 2020 +0300
* filters: increasing update interval </s> add if nfail == len(updateFilters) {
return 0, true
}
</s> remove func refreshFiltersIfNecessary(force bool) int {
</s> add //
// Return the number of updated filters
// Return TRUE - there was a network error and nothing could be updated
func refreshFiltersIfNecessary(force bool) (int, bool) { </s> add nfail++ </s> add nfail := 0 </s> remove time.Sleep(1 * time.Hour)
</s> add time.Sleep(time.Duration(intval) * time.Second) </s> add const maxInterval = 1 * 60 * 60
intval := 5 // use a dynamically increasing time interval
nUpdated := 0 | https://github.com/AdguardTeam/AdGuardHome/commit/47631105c7e92b6dbc232110af3050b4d8534f8f | home/filter.go |
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep | <mask> Port int `yaml:"port"`
<mask>
<mask> dnsforward.FilteringConfig `yaml:",inline"`
<mask>
<mask> QueryLogEnabled bool `yaml:"querylog_enabled"`
<mask> Ratelimit int `yaml:"ratelimit"`
<mask> RefuseAny bool `yaml:"refuse_any"`
<mask> Pprof string `yaml:"-"`
<mask> Cache string `yaml:"-"`
<mask> Prometheus string `yaml:"-"`
<mask> BootstrapDNS string `yaml:"bootstrap_dns"`
<mask> UpstreamDNS []string `yaml:"upstream_dns"`
<mask> }
<mask>
<mask> var defaultDNS = []string{"tls://1.1.1.1", "tls://1.0.0.1"}
<mask>
<mask> // initialize to default values, will be changed later when reading config or parsing command line
</s> dnsforward -- implement ratelimit and refuseany </s> remove ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600)
</s> add ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600)
QueryLogEnabled bool `yaml:"querylog_enabled"`
Ratelimit int `yaml:"ratelimit"`
RatelimitWhitelist []string `yaml:"ratelimit_whitelist"`
RefuseAny bool `yaml:"refuse_any"` </s> add // if any of ServerConfig values are zero, then default values from below are used </s> add if msg.Question[0].Qtype == dns.TypeANY && s.RefuseAny {
return s.genNotImpl(msg), nil, nil, nil
}
</s> add QueryLogEnabled: true,
Ratelimit: 20,
RefuseAny: true, </s> remove logRequest(msg, reply, result, elapsed, host, upstreamAddr)
</s> add </s> remove elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
host, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
</s> add if s.QueryLogEnabled {
elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
logRequest(msg, reply, result, elapsed, ip, upstreamAddr) | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | config.go |
keep keep add keep keep keep keep keep keep | <mask> ProtectionEnabled: true, // whether or not use any of dnsfilter features
<mask> FilteringEnabled: true, // whether or not use filter lists
<mask> BlockedResponseTTL: 10, // in seconds
<mask> },
<mask> BootstrapDNS: "8.8.8.8:53",
<mask> UpstreamDNS: defaultDNS,
<mask> Cache: "cache",
<mask> Prometheus: "prometheus :9153",
<mask> },
</s> dnsforward -- implement ratelimit and refuseany </s> remove QueryLogEnabled: true,
Ratelimit: 20,
RefuseAny: true,
BootstrapDNS: "8.8.8.8:53",
UpstreamDNS: defaultDNS,
Cache: "cache",
Prometheus: "prometheus :9153",
</s> add BootstrapDNS: "8.8.8.8:53",
UpstreamDNS: defaultDNS,
Cache: "cache",
Prometheus: "prometheus :9153", </s> add if msg.Question[0].Qtype == dns.TypeANY && s.RefuseAny {
return s.genNotImpl(msg), nil, nil, nil
}
</s> add // if any of ServerConfig values are zero, then default values from below are used </s> add ip, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
// not a fatal error, move on
}
// ratelimit based on IP only, protects CPU cycles and outbound connections
if s.isRatelimited(ip) {
// log.Printf("Ratelimiting %s based on IP only", ip)
return // do nothing, don't reply, we got ratelimited
} </s> remove QueryLogEnabled bool `yaml:"querylog_enabled"`
Ratelimit int `yaml:"ratelimit"`
RefuseAny bool `yaml:"refuse_any"`
Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
BootstrapDNS string `yaml:"bootstrap_dns"`
UpstreamDNS []string `yaml:"upstream_dns"`
</s> add Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
BootstrapDNS string `yaml:"bootstrap_dns"`
UpstreamDNS []string `yaml:"upstream_dns"` </s> add gocache "github.com/patrickmn/go-cache" | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | config.go |
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep | <mask> ProtectionEnabled: true, // whether or not use any of dnsfilter features
<mask> FilteringEnabled: true, // whether or not use filter lists
<mask> BlockedResponseTTL: 10, // in seconds
<mask> },
<mask> QueryLogEnabled: true,
<mask> Ratelimit: 20,
<mask> RefuseAny: true,
<mask> BootstrapDNS: "8.8.8.8:53",
<mask> UpstreamDNS: defaultDNS,
<mask> Cache: "cache",
<mask> Prometheus: "prometheus :9153",
<mask> },
<mask> Filters: []filter{
<mask> {Filter: dnsfilter.Filter{ID: 1}, Enabled: true, URL: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt", Name: "AdGuard Simplified Domain Names filter"},
<mask> {Filter: dnsfilter.Filter{ID: 2}, Enabled: false, URL: "https://adaway.org/hosts.txt", Name: "AdAway"},
<mask> {Filter: dnsfilter.Filter{ID: 3}, Enabled: false, URL: "https://hosts-file.net/ad_servers.txt", Name: "hpHosts - Ad and Tracking servers only"},
</s> dnsforward -- implement ratelimit and refuseany </s> add QueryLogEnabled: true,
Ratelimit: 20,
RefuseAny: true, </s> add if msg.Question[0].Qtype == dns.TypeANY && s.RefuseAny {
return s.genNotImpl(msg), nil, nil, nil
}
</s> add // if any of ServerConfig values are zero, then default values from below are used </s> add ip, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
// not a fatal error, move on
}
// ratelimit based on IP only, protects CPU cycles and outbound connections
if s.isRatelimited(ip) {
// log.Printf("Ratelimiting %s based on IP only", ip)
return // do nothing, don't reply, we got ratelimited
} </s> remove QueryLogEnabled bool `yaml:"querylog_enabled"`
Ratelimit int `yaml:"ratelimit"`
RefuseAny bool `yaml:"refuse_any"`
Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
BootstrapDNS string `yaml:"bootstrap_dns"`
UpstreamDNS []string `yaml:"upstream_dns"`
</s> add Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
BootstrapDNS string `yaml:"bootstrap_dns"`
UpstreamDNS []string `yaml:"upstream_dns"` </s> add // ratelimit based on reply size now
replysize := reply.Len()
if s.isRatelimitedForReply(ip, replysize) {
log.Printf("Ratelimiting %s based on IP and size %d", ip, replysize)
return // do nothing, don't reply, we got ratelimited
}
// we're good to respond | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | config.go |
keep keep keep add keep keep keep keep keep | <mask>
<mask> "github.com/AdguardTeam/AdGuardHome/dnsfilter"
<mask> "github.com/joomcode/errorx"
<mask> "github.com/miekg/dns"
<mask> )
<mask>
<mask> // Server is the main way to start a DNS server.
<mask> //
<mask> // Example:
</s> dnsforward -- implement ratelimit and refuseany </s> add ip, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
// not a fatal error, move on
}
// ratelimit based on IP only, protects CPU cycles and outbound connections
if s.isRatelimited(ip) {
// log.Printf("Ratelimiting %s based on IP only", ip)
return // do nothing, don't reply, we got ratelimited
} </s> add ratelimitBuckets *gocache.Cache // where the ratelimiters are stored, per IP
</s> remove err := msg.Unpack(p)
</s> add err = msg.Unpack(p) </s> remove ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600)
</s> add ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600)
QueryLogEnabled bool `yaml:"querylog_enabled"`
Ratelimit int `yaml:"ratelimit"`
RatelimitWhitelist []string `yaml:"ratelimit_whitelist"`
RefuseAny bool `yaml:"refuse_any"` </s> remove logRequest(msg, reply, result, elapsed, host, upstreamAddr)
</s> add </s> add resp.RecursionAvailable = true
return &resp
}
func (s *Server) genNotImpl(request *dns.Msg) *dns.Msg {
resp := dns.Msg{}
resp.SetRcode(request, dns.RcodeNotImplemented)
resp.RecursionAvailable = true
resp.SetEdns0(1452, false) // NOTIMPL without EDNS is treated as 'we don't support EDNS', so explicitly set it | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | dnsforward/dnsforward.go |
keep keep add keep keep keep keep | <mask>
<mask> cache cache
<mask>
<mask> sync.RWMutex
<mask> ServerConfig
<mask> }
<mask>
</s> dnsforward -- implement ratelimit and refuseany </s> add if msg.Question[0].Qtype == dns.TypeANY && s.RefuseAny {
return s.genNotImpl(msg), nil, nil, nil
}
</s> add // if any of ServerConfig values are zero, then default values from below are used </s> remove ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600)
</s> add ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600)
QueryLogEnabled bool `yaml:"querylog_enabled"`
Ratelimit int `yaml:"ratelimit"`
RatelimitWhitelist []string `yaml:"ratelimit_whitelist"`
RefuseAny bool `yaml:"refuse_any"` </s> remove elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
host, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
</s> add if s.QueryLogEnabled {
elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
logRequest(msg, reply, result, elapsed, ip, upstreamAddr) </s> remove logRequest(msg, reply, result, elapsed, host, upstreamAddr)
</s> add </s> add resp.RecursionAvailable = true | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | dnsforward/dnsforward.go |
keep keep keep keep replace replace replace keep keep keep keep keep | <mask> }
<mask> */
<mask>
<mask> type FilteringConfig struct {
<mask> ProtectionEnabled bool `yaml:"protection_enabled"`
<mask> FilteringEnabled bool `yaml:"filtering_enabled"`
<mask> BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600)
<mask>
<mask> dnsfilter.Config `yaml:",inline"`
<mask> }
<mask>
<mask> // The zero ServerConfig is empty and ready for use.
</s> dnsforward -- implement ratelimit and refuseany </s> add // if any of ServerConfig values are zero, then default values from below are used </s> remove QueryLogEnabled bool `yaml:"querylog_enabled"`
Ratelimit int `yaml:"ratelimit"`
RefuseAny bool `yaml:"refuse_any"`
Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
BootstrapDNS string `yaml:"bootstrap_dns"`
UpstreamDNS []string `yaml:"upstream_dns"`
</s> add Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
BootstrapDNS string `yaml:"bootstrap_dns"`
UpstreamDNS []string `yaml:"upstream_dns"` </s> add gocache "github.com/patrickmn/go-cache" </s> add resp.RecursionAvailable = true
return &resp
}
func (s *Server) genNotImpl(request *dns.Msg) *dns.Msg {
resp := dns.Msg{}
resp.SetRcode(request, dns.RcodeNotImplemented)
resp.RecursionAvailable = true
resp.SetEdns0(1452, false) // NOTIMPL without EDNS is treated as 'we don't support EDNS', so explicitly set it </s> remove elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
host, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
</s> add if s.QueryLogEnabled {
elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
logRequest(msg, reply, result, elapsed, ip, upstreamAddr) </s> add // ratelimit based on reply size now
replysize := reply.Len()
if s.isRatelimitedForReply(ip, replysize) {
log.Printf("Ratelimiting %s based on IP and size %d", ip, replysize)
return // do nothing, don't reply, we got ratelimited
}
// we're good to respond | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | dnsforward/dnsforward.go |
keep keep keep add keep keep keep keep keep keep | <mask>
<mask> FilteringConfig
<mask> }
<mask>
<mask> var defaultValues = ServerConfig{
<mask> UDPListenAddr: &net.UDPAddr{Port: 53},
<mask> FilteringConfig: FilteringConfig{BlockedResponseTTL: 3600},
<mask> Upstreams: []Upstream{
<mask> //// dns over HTTPS
<mask> // &dnsOverHTTPS{address: "https://1.1.1.1/dns-query"},
</s> dnsforward -- implement ratelimit and refuseany </s> remove ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600)
</s> add ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600)
QueryLogEnabled bool `yaml:"querylog_enabled"`
Ratelimit int `yaml:"ratelimit"`
RatelimitWhitelist []string `yaml:"ratelimit_whitelist"`
RefuseAny bool `yaml:"refuse_any"` </s> remove QueryLogEnabled bool `yaml:"querylog_enabled"`
Ratelimit int `yaml:"ratelimit"`
RefuseAny bool `yaml:"refuse_any"`
Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
BootstrapDNS string `yaml:"bootstrap_dns"`
UpstreamDNS []string `yaml:"upstream_dns"`
</s> add Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
BootstrapDNS string `yaml:"bootstrap_dns"`
UpstreamDNS []string `yaml:"upstream_dns"` </s> remove logRequest(msg, reply, result, elapsed, host, upstreamAddr)
</s> add </s> remove elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
host, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
</s> add if s.QueryLogEnabled {
elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
logRequest(msg, reply, result, elapsed, ip, upstreamAddr) </s> add ratelimitBuckets *gocache.Cache // where the ratelimiters are stored, per IP
</s> add // ratelimit based on reply size now
replysize := reply.Len()
if s.isRatelimitedForReply(ip, replysize) {
log.Printf("Ratelimiting %s based on IP and size %d", ip, replysize)
return // do nothing, don't reply, we got ratelimited
}
// we're good to respond | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | dnsforward/dnsforward.go |
keep keep add keep keep keep keep keep | <mask> return s.genServerFailure(msg), nil, nil, nil
<mask> }
<mask>
<mask> // use dnsfilter before cache -- changed settings or filters would require cache invalidation otherwise
<mask> host := strings.TrimSuffix(msg.Question[0].Name, ".")
<mask> res, err := s.dnsFilter.CheckHost(host)
<mask> if err != nil {
<mask> log.Printf("dnsfilter failed to check host '%s': %s", host, err)
</s> dnsforward -- implement ratelimit and refuseany </s> remove logRequest(msg, reply, result, elapsed, host, upstreamAddr)
</s> add </s> remove elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
host, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
</s> add if s.QueryLogEnabled {
elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
logRequest(msg, reply, result, elapsed, ip, upstreamAddr) </s> remove err := msg.Unpack(p)
</s> add err = msg.Unpack(p) </s> add ip, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
// not a fatal error, move on
}
// ratelimit based on IP only, protects CPU cycles and outbound connections
if s.isRatelimited(ip) {
// log.Printf("Ratelimiting %s based on IP only", ip)
return // do nothing, don't reply, we got ratelimited
} </s> add ratelimitBuckets *gocache.Cache // where the ratelimiters are stored, per IP
</s> add // ratelimit based on reply size now
replysize := reply.Len()
if s.isRatelimitedForReply(ip, replysize) {
log.Printf("Ratelimiting %s based on IP and size %d", ip, replysize)
return // do nothing, don't reply, we got ratelimited
}
// we're good to respond | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | dnsforward/dnsforward.go |
keep keep add keep keep keep keep keep | <mask>
<mask> func (s *Server) handlePacket(p []byte, addr net.Addr, conn *net.UDPConn) {
<mask> start := time.Now()
<mask>
<mask> msg := &dns.Msg{}
<mask> err = msg.Unpack(p)
<mask> if err != nil {
<mask> log.Printf("got invalid DNS packet: %s", err)
</s> dnsforward -- implement ratelimit and refuseany </s> remove err := msg.Unpack(p)
</s> add err = msg.Unpack(p) </s> add resp.RecursionAvailable = true
return &resp
}
func (s *Server) genNotImpl(request *dns.Msg) *dns.Msg {
resp := dns.Msg{}
resp.SetRcode(request, dns.RcodeNotImplemented)
resp.RecursionAvailable = true
resp.SetEdns0(1452, false) // NOTIMPL without EDNS is treated as 'we don't support EDNS', so explicitly set it </s> remove elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
host, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
</s> add if s.QueryLogEnabled {
elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
logRequest(msg, reply, result, elapsed, ip, upstreamAddr) </s> add if msg.Question[0].Qtype == dns.TypeANY && s.RefuseAny {
return s.genNotImpl(msg), nil, nil, nil
}
</s> remove logRequest(msg, reply, result, elapsed, host, upstreamAddr)
</s> add </s> add // ratelimit based on reply size now
replysize := reply.Len()
if s.isRatelimitedForReply(ip, replysize) {
log.Printf("Ratelimiting %s based on IP and size %d", ip, replysize)
return // do nothing, don't reply, we got ratelimited
}
// we're good to respond | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | dnsforward/dnsforward.go |
keep keep keep keep replace keep keep keep keep keep | <mask> func (s *Server) handlePacket(p []byte, addr net.Addr, conn *net.UDPConn) {
<mask> start := time.Now()
<mask>
<mask> msg := &dns.Msg{}
<mask> err := msg.Unpack(p)
<mask> if err != nil {
<mask> log.Printf("got invalid DNS packet: %s", err)
<mask> return // do nothing
<mask> }
<mask>
</s> dnsforward -- implement ratelimit and refuseany </s> add ip, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
// not a fatal error, move on
}
// ratelimit based on IP only, protects CPU cycles and outbound connections
if s.isRatelimited(ip) {
// log.Printf("Ratelimiting %s based on IP only", ip)
return // do nothing, don't reply, we got ratelimited
} </s> add resp.RecursionAvailable = true
return &resp
}
func (s *Server) genNotImpl(request *dns.Msg) *dns.Msg {
resp := dns.Msg{}
resp.SetRcode(request, dns.RcodeNotImplemented)
resp.RecursionAvailable = true
resp.SetEdns0(1452, false) // NOTIMPL without EDNS is treated as 'we don't support EDNS', so explicitly set it </s> add // ratelimit based on reply size now
replysize := reply.Len()
if s.isRatelimitedForReply(ip, replysize) {
log.Printf("Ratelimiting %s based on IP and size %d", ip, replysize)
return // do nothing, don't reply, we got ratelimited
}
// we're good to respond </s> remove elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
host, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
</s> add if s.QueryLogEnabled {
elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
logRequest(msg, reply, result, elapsed, ip, upstreamAddr) </s> add if msg.Question[0].Qtype == dns.TypeANY && s.RefuseAny {
return s.genNotImpl(msg), nil, nil, nil
}
</s> remove logRequest(msg, reply, result, elapsed, host, upstreamAddr)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | dnsforward/dnsforward.go |
keep add keep keep keep keep | <mask>
<mask> if reply != nil {
<mask> rerr := s.respond(reply, addr, conn)
<mask> if rerr != nil {
<mask> log.Printf("Couldn't respond to UDP packet: %s", err)
<mask> }
</s> dnsforward -- implement ratelimit and refuseany </s> remove elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
host, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
</s> add if s.QueryLogEnabled {
elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
logRequest(msg, reply, result, elapsed, ip, upstreamAddr) </s> add ip, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
// not a fatal error, move on
}
// ratelimit based on IP only, protects CPU cycles and outbound connections
if s.isRatelimited(ip) {
// log.Printf("Ratelimiting %s based on IP only", ip)
return // do nothing, don't reply, we got ratelimited
} </s> remove err := msg.Unpack(p)
</s> add err = msg.Unpack(p) </s> remove logRequest(msg, reply, result, elapsed, host, upstreamAddr)
</s> add </s> add if msg.Question[0].Qtype == dns.TypeANY && s.RefuseAny {
return s.genNotImpl(msg), nil, nil, nil
}
</s> add resp.RecursionAvailable = true
return &resp
}
func (s *Server) genNotImpl(request *dns.Msg) *dns.Msg {
resp := dns.Msg{}
resp.SetRcode(request, dns.RcodeNotImplemented)
resp.RecursionAvailable = true
resp.SetEdns0(1452, false) // NOTIMPL without EDNS is treated as 'we don't support EDNS', so explicitly set it | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | dnsforward/dnsforward.go |
keep replace replace replace replace replace replace replace replace keep replace keep | <mask> // query logging and stats counters
<mask> elapsed := time.Since(start)
<mask> upstreamAddr := ""
<mask> if upstream != nil {
<mask> upstreamAddr = upstream.Address()
<mask> }
<mask> host, _, err := net.SplitHostPort(addr.String())
<mask> if err != nil {
<mask> log.Printf("Failed to split %v into host/port: %s", addr, err)
<mask> }
<mask> logRequest(msg, reply, result, elapsed, host, upstreamAddr)
<mask> }
</s> dnsforward -- implement ratelimit and refuseany </s> add ip, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
// not a fatal error, move on
}
// ratelimit based on IP only, protects CPU cycles and outbound connections
if s.isRatelimited(ip) {
// log.Printf("Ratelimiting %s based on IP only", ip)
return // do nothing, don't reply, we got ratelimited
} </s> add if msg.Question[0].Qtype == dns.TypeANY && s.RefuseAny {
return s.genNotImpl(msg), nil, nil, nil
}
</s> add // ratelimit based on reply size now
replysize := reply.Len()
if s.isRatelimitedForReply(ip, replysize) {
log.Printf("Ratelimiting %s based on IP and size %d", ip, replysize)
return // do nothing, don't reply, we got ratelimited
}
// we're good to respond </s> remove err := msg.Unpack(p)
</s> add err = msg.Unpack(p) </s> add resp.RecursionAvailable = true
return &resp
}
func (s *Server) genNotImpl(request *dns.Msg) *dns.Msg {
resp := dns.Msg{}
resp.SetRcode(request, dns.RcodeNotImplemented)
resp.RecursionAvailable = true
resp.SetEdns0(1452, false) // NOTIMPL without EDNS is treated as 'we don't support EDNS', so explicitly set it | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | dnsforward/dnsforward.go |
keep add keep keep keep keep keep | <mask> resp := dns.Msg{}
<mask> resp.SetRcode(request, dns.RcodeServerFailure)
<mask> return &resp
<mask> }
<mask>
<mask> func (s *Server) genNXDomain(request *dns.Msg) *dns.Msg {
<mask> resp := dns.Msg{}
</s> dnsforward -- implement ratelimit and refuseany </s> add resp.RecursionAvailable = true </s> remove err := msg.Unpack(p)
</s> add err = msg.Unpack(p) </s> add ip, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
// not a fatal error, move on
}
// ratelimit based on IP only, protects CPU cycles and outbound connections
if s.isRatelimited(ip) {
// log.Printf("Ratelimiting %s based on IP only", ip)
return // do nothing, don't reply, we got ratelimited
} </s> remove elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
host, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
</s> add if s.QueryLogEnabled {
elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
logRequest(msg, reply, result, elapsed, ip, upstreamAddr) </s> add if msg.Question[0].Qtype == dns.TypeANY && s.RefuseAny {
return s.genNotImpl(msg), nil, nil, nil
}
</s> add // ratelimit based on reply size now
replysize := reply.Len()
if s.isRatelimitedForReply(ip, replysize) {
log.Printf("Ratelimiting %s based on IP and size %d", ip, replysize)
return // do nothing, don't reply, we got ratelimited
}
// we're good to respond | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | dnsforward/dnsforward.go |
keep add keep keep keep keep | <mask> resp := dns.Msg{}
<mask> resp.SetRcode(request, dns.RcodeNameError)
<mask> resp.Ns = s.genSOA(request)
<mask> return &resp
<mask> }
<mask>
</s> dnsforward -- implement ratelimit and refuseany </s> add resp.RecursionAvailable = true
return &resp
}
func (s *Server) genNotImpl(request *dns.Msg) *dns.Msg {
resp := dns.Msg{}
resp.SetRcode(request, dns.RcodeNotImplemented)
resp.RecursionAvailable = true
resp.SetEdns0(1452, false) // NOTIMPL without EDNS is treated as 'we don't support EDNS', so explicitly set it </s> remove err := msg.Unpack(p)
</s> add err = msg.Unpack(p) </s> remove elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
host, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
</s> add if s.QueryLogEnabled {
elapsed := time.Since(start)
upstreamAddr := ""
if upstream != nil {
upstreamAddr = upstream.Address()
}
logRequest(msg, reply, result, elapsed, ip, upstreamAddr) </s> add if msg.Question[0].Qtype == dns.TypeANY && s.RefuseAny {
return s.genNotImpl(msg), nil, nil, nil
}
</s> add // ratelimit based on reply size now
replysize := reply.Len()
if s.isRatelimitedForReply(ip, replysize) {
log.Printf("Ratelimiting %s based on IP and size %d", ip, replysize)
return // do nothing, don't reply, we got ratelimited
}
// we're good to respond </s> add ip, _, err := net.SplitHostPort(addr.String())
if err != nil {
log.Printf("Failed to split %v into host/port: %s", addr, err)
// not a fatal error, move on
}
// ratelimit based on IP only, protects CPU cycles and outbound connections
if s.isRatelimited(ip) {
// log.Printf("Ratelimiting %s based on IP only", ip)
return // do nothing, don't reply, we got ratelimited
} | https://github.com/AdguardTeam/AdGuardHome/commit/478ce03386b92c265f63742b44c3b456e534d593 | dnsforward/dnsforward.go |
keep add keep keep keep keep keep keep | <mask> "net"
<mask> "net/netip"
<mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> add }, {
name: "partial_good",
wantErr: "",
u: "[/a.1.2.3.10.in-addr.arpa/a.10.in-addr.arpa/]#", </s> remove `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
</s> add `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`, </s> remove `bad arpa domain name "hello.world": not a reversed ip network`,
</s> add `bad arpa domain name "hello.world.": not a reversed ip network`, </s> remove `bad arpa domain name "non.arpa": not a reversed ip network`,
</s> add `bad arpa domain name "non.arpa.": not a reversed ip network`, </s> remove if !privateNets.Contains(subnet.IP) {
</s> add if !privateNets.Contains(subnet.Addr().AsSlice()) { </s> remove var subnet *net.IPNet
subnet, err = netutil.SubnetFromReversedAddr(domain)
</s> add var subnet netip.Prefix
subnet, err = extractARPASubnet(domain) | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/dns.go |
keep keep add keep keep keep keep keep keep | <mask> // was parsed successfully and belongs to one of the locally served IP
<mask> // ranges. It is also filled with unmapped version of the address if it's
<mask> // within DNS64 prefixes.
<mask> unreversedReqIP net.IP
<mask>
<mask> // err is the error returned from a processing function.
<mask> err error
<mask>
<mask> // clientID is the ClientID from DoH, DoQ, or DoT, if provided.
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove if !s.privateNets.Contains(ip) {
</s> add subnetAddr := subnet.Addr()
addrData := subnetAddr.AsSlice()
if !s.privateNets.Contains(addrData) { </s> remove log.Debug("dnsforward: parsing reversed addr: %s", err)
</s> add if errors.Is(err, netutil.ErrNotAReversedSubnet) {
log.Debug("dnsforward: request is not for arpa domain") </s> remove // DNS-Based Service Discovery uses PTR records having not an ARPA
// format of the domain name in question. Those shouldn't be
// invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
// RFC 2782.
name := strings.TrimSuffix(q.Name, ".")
if err = netutil.ValidateSRVDomainName(name); err != nil {
log.Debug("dnsforward: validating service domain: %s", err)
return resultCodeError
</s> add return resultCodeSuccess </s> remove log.Debug("dnsforward: addr %s is from locally served network", ip)
</s> add log.Debug("dnsforward: addr %s is from locally served network", subnetAddr) </s> remove ip, err := netutil.IPFromReversedAddr(q.Name)
</s> add subnet, err := extractARPASubnet(q.Name) </s> remove return resultCodeSuccess
</s> add return resultCodeError | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/dns.go |
keep replace keep replace keep keep keep keep | <mask>
<mask> ip, err := netutil.IPFromReversedAddr(q.Name)
<mask> if err != nil {
<mask> log.Debug("dnsforward: parsing reversed addr: %s", err)
<mask>
<mask> // DNS-Based Service Discovery uses PTR records having not an ARPA
<mask> // format of the domain name in question. Those shouldn't be
<mask> // invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove // DNS-Based Service Discovery uses PTR records having not an ARPA
// format of the domain name in question. Those shouldn't be
// invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
// RFC 2782.
name := strings.TrimSuffix(q.Name, ".")
if err = netutil.ValidateSRVDomainName(name); err != nil {
log.Debug("dnsforward: validating service domain: %s", err)
return resultCodeError
</s> add return resultCodeSuccess </s> remove var subnet *net.IPNet
subnet, err = netutil.SubnetFromReversedAddr(domain)
</s> add var subnet netip.Prefix
subnet, err = extractARPASubnet(domain) </s> remove log.Debug("dnsforward: request is not for arpa domain")
</s> add log.Debug("dnsforward: parsing reversed addr: %s", err) </s> add //
// TODO(e.burkov): Use netip.Addr when we switch to netip more fully. </s> remove if !s.privateNets.Contains(ip) {
</s> add subnetAddr := subnet.Addr()
addrData := subnetAddr.AsSlice()
if !s.privateNets.Contains(addrData) { | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/dns.go |
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep | <mask> ip, err := netutil.IPFromReversedAddr(q.Name)
<mask> if err != nil {
<mask> log.Debug("dnsforward: parsing reversed addr: %s", err)
<mask>
<mask> // DNS-Based Service Discovery uses PTR records having not an ARPA
<mask> // format of the domain name in question. Those shouldn't be
<mask> // invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
<mask> // RFC 2782.
<mask> name := strings.TrimSuffix(q.Name, ".")
<mask> if err = netutil.ValidateSRVDomainName(name); err != nil {
<mask> log.Debug("dnsforward: validating service domain: %s", err)
<mask>
<mask> return resultCodeError
<mask> }
<mask>
<mask> log.Debug("dnsforward: request is not for arpa domain")
<mask>
<mask> return resultCodeSuccess
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove log.Debug("dnsforward: parsing reversed addr: %s", err)
</s> add if errors.Is(err, netutil.ErrNotAReversedSubnet) {
log.Debug("dnsforward: request is not for arpa domain") </s> remove ip, err := netutil.IPFromReversedAddr(q.Name)
</s> add subnet, err := extractARPASubnet(q.Name) </s> remove var subnet *net.IPNet
subnet, err = netutil.SubnetFromReversedAddr(domain)
</s> add var subnet netip.Prefix
subnet, err = extractARPASubnet(domain) </s> remove log.Debug("dnsforward: request is not for arpa domain")
</s> add log.Debug("dnsforward: parsing reversed addr: %s", err) </s> remove return resultCodeSuccess
</s> add return resultCodeError </s> add //
// TODO(e.burkov): Use netip.Addr when we switch to netip more fully. | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/dns.go |
keep replace keep replace keep | <mask>
<mask> log.Debug("dnsforward: request is not for arpa domain")
<mask>
<mask> return resultCodeSuccess
<mask> }
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove // DNS-Based Service Discovery uses PTR records having not an ARPA
// format of the domain name in question. Those shouldn't be
// invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
// RFC 2782.
name := strings.TrimSuffix(q.Name, ".")
if err = netutil.ValidateSRVDomainName(name); err != nil {
log.Debug("dnsforward: validating service domain: %s", err)
return resultCodeError
</s> add return resultCodeSuccess </s> remove log.Debug("dnsforward: parsing reversed addr: %s", err)
</s> add if errors.Is(err, netutil.ErrNotAReversedSubnet) {
log.Debug("dnsforward: request is not for arpa domain") </s> remove dctx.unreversedReqIP = ip
</s> add dctx.unreversedReqIP = addrData </s> remove ip, err := netutil.IPFromReversedAddr(q.Name)
</s> add subnet, err := extractARPASubnet(q.Name) </s> remove log.Debug("dnsforward: addr %s is from locally served network", ip)
</s> add log.Debug("dnsforward: addr %s is from locally served network", subnetAddr) | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/dns.go |
keep keep replace keep keep keep replace keep keep keep | <mask> // assume that all the DHCP leases we give are locally served or at least
<mask> // shouldn't be accessible externally.
<mask> if !s.privateNets.Contains(ip) {
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> log.Debug("dnsforward: addr %s is from locally served network", ip)
<mask>
<mask> if !dctx.isLocalClient {
<mask> log.Debug("dnsforward: %q requests an internal ip", pctx.Addr)
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove return resultCodeSuccess
</s> add return resultCodeError </s> add //
// TODO(e.burkov): Use netip.Addr when we switch to netip more fully. </s> remove if !privateNets.Contains(subnet.IP) {
</s> add if !privateNets.Contains(subnet.Addr().AsSlice()) { </s> remove dctx.unreversedReqIP = ip
</s> add dctx.unreversedReqIP = addrData </s> remove // DNS-Based Service Discovery uses PTR records having not an ARPA
// format of the domain name in question. Those shouldn't be
// invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
// RFC 2782.
name := strings.TrimSuffix(q.Name, ".")
if err = netutil.ValidateSRVDomainName(name); err != nil {
log.Debug("dnsforward: validating service domain: %s", err)
return resultCodeError
</s> add return resultCodeSuccess | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return resultCodeFinish
<mask> }
<mask>
<mask> // Do not perform unreversing ever again.
<mask> dctx.unreversedReqIP = ip
<mask>
<mask> // There is no need to filter request from external addresses since this
<mask> // code is only executed when the request is for locally served ARPA
<mask> // hostname so disable redundant filters.
<mask> dctx.setts.ParentalEnabled = false
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove return resultCodeSuccess
</s> add return resultCodeError </s> remove log.Debug("dnsforward: request is not for arpa domain")
</s> add log.Debug("dnsforward: parsing reversed addr: %s", err) </s> remove if !s.privateNets.Contains(ip) {
</s> add subnetAddr := subnet.Addr()
addrData := subnetAddr.AsSlice()
if !s.privateNets.Contains(addrData) { </s> remove log.Debug("dnsforward: addr %s is from locally served network", ip)
</s> add log.Debug("dnsforward: addr %s is from locally served network", subnetAddr) </s> add //
// TODO(e.burkov): Use netip.Addr when we switch to netip more fully. </s> remove // DNS-Based Service Discovery uses PTR records having not an ARPA
// format of the domain name in question. Those shouldn't be
// invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
// RFC 2782.
name := strings.TrimSuffix(q.Name, ".")
if err = netutil.ValidateSRVDomainName(name); err != nil {
log.Debug("dnsforward: validating service domain: %s", err)
return resultCodeError
</s> add return resultCodeSuccess | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/dns.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> slices.Sort(keys)
<mask>
<mask> var errs []error
<mask> for _, domain := range keys {
<mask> var subnet *net.IPNet
<mask> subnet, err = netutil.SubnetFromReversedAddr(domain)
<mask> if err != nil {
<mask> errs = append(errs, err)
<mask>
<mask> continue
<mask> }
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove if !privateNets.Contains(subnet.IP) {
</s> add if !privateNets.Contains(subnet.Addr().AsSlice()) { </s> remove ip, err := netutil.IPFromReversedAddr(q.Name)
</s> add subnet, err := extractARPASubnet(q.Name) </s> remove // DNS-Based Service Discovery uses PTR records having not an ARPA
// format of the domain name in question. Those shouldn't be
// invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
// RFC 2782.
name := strings.TrimSuffix(q.Name, ".")
if err = netutil.ValidateSRVDomainName(name); err != nil {
log.Debug("dnsforward: validating service domain: %s", err)
return resultCodeError
</s> add return resultCodeSuccess </s> remove log.Debug("dnsforward: parsing reversed addr: %s", err)
</s> add if errors.Is(err, netutil.ErrNotAReversedSubnet) {
log.Debug("dnsforward: request is not for arpa domain") </s> add }, {
name: "partial_good",
wantErr: "",
u: "[/a.1.2.3.10.in-addr.arpa/a.10.in-addr.arpa/]#", </s> remove `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
</s> add `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`, | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/http.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> continue
<mask> }
<mask>
<mask> if !privateNets.Contains(subnet.IP) {
<mask> errs = append(
<mask> errs,
<mask> fmt.Errorf("arpa domain %q should point to a locally-served network", domain),
<mask> )
<mask> }
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove var subnet *net.IPNet
subnet, err = netutil.SubnetFromReversedAddr(domain)
</s> add var subnet netip.Prefix
subnet, err = extractARPASubnet(domain) </s> add }, {
name: "partial_good",
wantErr: "",
u: "[/a.1.2.3.10.in-addr.arpa/a.10.in-addr.arpa/]#", </s> remove `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
</s> add `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`, </s> remove log.Debug("dnsforward: addr %s is from locally served network", ip)
</s> add log.Debug("dnsforward: addr %s is from locally served network", subnetAddr) </s> remove `bad arpa domain name "hello.world": not a reversed ip network`,
</s> add `bad arpa domain name "hello.world.": not a reversed ip network`, </s> remove if !s.privateNets.Contains(ip) {
</s> add subnetAddr := subnet.Addr()
addrData := subnetAddr.AsSlice()
if !s.privateNets.Contains(addrData) { | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/http.go |
keep keep keep keep replace keep keep keep keep keep | <mask> wantSet: "",
<mask> }, {
<mask> name: "local_ptr_upstreams_bad",
<mask> wantSet: `validating private upstream servers: checking domain-specific upstreams: ` +
<mask> `bad arpa domain name "non.arpa": not a reversed ip network`,
<mask> }, {
<mask> name: "local_ptr_upstreams_null",
<mask> wantSet: "",
<mask> }}
<mask>
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove `bad arpa domain name "hello.world": not a reversed ip network`,
</s> add `bad arpa domain name "hello.world.": not a reversed ip network`, </s> add }, {
name: "partial_good",
wantErr: "",
u: "[/a.1.2.3.10.in-addr.arpa/a.10.in-addr.arpa/]#", </s> remove `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
</s> add `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`, </s> remove if !privateNets.Contains(subnet.IP) {
</s> add if !privateNets.Contains(subnet.Addr().AsSlice()) { </s> remove log.Debug("dnsforward: parsing reversed addr: %s", err)
</s> add if errors.Is(err, netutil.ErrNotAReversedSubnet) {
log.Debug("dnsforward: request is not for arpa domain") </s> remove // DNS-Based Service Discovery uses PTR records having not an ARPA
// format of the domain name in question. Those shouldn't be
// invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
// RFC 2782.
name := strings.TrimSuffix(q.Name, ".")
if err = netutil.ValidateSRVDomainName(name); err != nil {
log.Debug("dnsforward: validating service domain: %s", err)
return resultCodeError
</s> add return resultCodeSuccess | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/http_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> u: "[/127.in-addr.arpa/]#",
<mask> }, {
<mask> name: "not_arpa_subnet",
<mask> wantErr: `checking domain-specific upstreams: ` +
<mask> `bad arpa domain name "hello.world": not a reversed ip network`,
<mask> u: "[/hello.world/]#",
<mask> }, {
<mask> name: "non-private_arpa_address",
<mask> wantErr: `checking domain-specific upstreams: ` +
<mask> `arpa domain "1.2.3.4.in-addr.arpa." should point to a locally-served network`,
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> add }, {
name: "partial_good",
wantErr: "",
u: "[/a.1.2.3.10.in-addr.arpa/a.10.in-addr.arpa/]#", </s> remove `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
</s> add `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`, </s> remove `bad arpa domain name "non.arpa": not a reversed ip network`,
</s> add `bad arpa domain name "non.arpa.": not a reversed ip network`, </s> remove if !privateNets.Contains(subnet.IP) {
</s> add if !privateNets.Contains(subnet.Addr().AsSlice()) { </s> remove log.Debug("dnsforward: parsing reversed addr: %s", err)
</s> add if errors.Is(err, netutil.ErrNotAReversedSubnet) {
log.Debug("dnsforward: request is not for arpa domain") </s> remove // DNS-Based Service Discovery uses PTR records having not an ARPA
// format of the domain name in question. Those shouldn't be
// invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and
// RFC 2782.
name := strings.TrimSuffix(q.Name, ".")
if err = netutil.ValidateSRVDomainName(name); err != nil {
log.Debug("dnsforward: validating service domain: %s", err)
return resultCodeError
</s> add return resultCodeSuccess | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/http_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }, {
<mask> name: "several_bad",
<mask> wantErr: `checking domain-specific upstreams: 2 errors: ` +
<mask> `"arpa domain \"1.2.3.4.in-addr.arpa.\" should point to a locally-served network", ` +
<mask> `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
<mask> u: "[/non.arpa/1.2.3.4.in-addr.arpa/127.in-addr.arpa/]#",
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> set := []string{"192.168.0.1", tc.u}
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> add }, {
name: "partial_good",
wantErr: "",
u: "[/a.1.2.3.10.in-addr.arpa/a.10.in-addr.arpa/]#", </s> remove `bad arpa domain name "hello.world": not a reversed ip network`,
</s> add `bad arpa domain name "hello.world.": not a reversed ip network`, </s> remove `bad arpa domain name "non.arpa": not a reversed ip network`,
</s> add `bad arpa domain name "non.arpa.": not a reversed ip network`, </s> remove if !privateNets.Contains(subnet.IP) {
</s> add if !privateNets.Contains(subnet.Addr().AsSlice()) { </s> remove var subnet *net.IPNet
subnet, err = netutil.SubnetFromReversedAddr(domain)
</s> add var subnet netip.Prefix
subnet, err = extractARPASubnet(domain) </s> remove log.Debug("dnsforward: parsing reversed addr: %s", err)
</s> add if errors.Is(err, netutil.ErrNotAReversedSubnet) {
log.Debug("dnsforward: request is not for arpa domain") | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/http_test.go |
keep keep keep add keep keep keep keep | <mask> wantErr: `checking domain-specific upstreams: 2 errors: ` +
<mask> `"arpa domain \"1.2.3.4.in-addr.arpa.\" should point to a locally-served network", ` +
<mask> `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`,
<mask> u: "[/non.arpa/1.2.3.4.in-addr.arpa/127.in-addr.arpa/]#",
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> set := []string{"192.168.0.1", tc.u}
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
</s> add `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`, </s> remove `bad arpa domain name "hello.world": not a reversed ip network`,
</s> add `bad arpa domain name "hello.world.": not a reversed ip network`, </s> remove `bad arpa domain name "non.arpa": not a reversed ip network`,
</s> add `bad arpa domain name "non.arpa.": not a reversed ip network`, </s> remove if !privateNets.Contains(subnet.IP) {
</s> add if !privateNets.Contains(subnet.Addr().AsSlice()) { </s> remove var subnet *net.IPNet
subnet, err = netutil.SubnetFromReversedAddr(domain)
</s> add var subnet netip.Prefix
subnet, err = extractARPASubnet(domain) </s> remove ip, err := netutil.IPFromReversedAddr(q.Name)
</s> add subnet, err := extractARPASubnet(q.Name) | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/http_test.go |
keep keep keep add keep keep keep keep keep keep | <mask> host := fields[i]
<mask> if len(host) == 0 {
<mask> break
<mask> }
<mask> a.updateTable(table, host, ipAddr)
<mask> a.updateTableRev(tableRev, host, ipAddr)
<mask> if sharp >= 0 {
<mask> break // skip the rest of the line after #
<mask> }
<mask> }
</s> * auto-hosts: support '#' comments after ip and hosts
Close #1807
Squashed commit of the following:
commit 9d3e2809df056354bb6195abf8106616c1e214b1
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 19:23:15 2020 +0300
improve
commit 9b8c7104560c9c80f848f15818d49a065a38e498
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 11:07:56 2020 +0300
* auto-hosts: support '#' comments after ip and hosts </s> add if sharp >= 0 {
break // skip the rest of the line after #
} </s> remove _, _ = f.WriteString(" 127.0.0.1 host localhost \n")
_, _ = f.WriteString(" ::1 localhost \n")
</s> add _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n") </s> add // Unknown host (comment)
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
| https://github.com/AdguardTeam/AdGuardHome/commit/4870da7f94e040fea63f2ff99bf1b79ee5da457e | util/auto_hosts.go |
keep add keep keep keep keep keep | <mask> a.updateTable(table, host, ipAddr)
<mask> a.updateTableRev(tableRev, host, ipAddr)
<mask> }
<mask> }
<mask> }
<mask>
<mask> // Receive notifications from fsnotify package
</s> * auto-hosts: support '#' comments after ip and hosts
Close #1807
Squashed commit of the following:
commit 9d3e2809df056354bb6195abf8106616c1e214b1
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 19:23:15 2020 +0300
improve
commit 9b8c7104560c9c80f848f15818d49a065a38e498
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 11:07:56 2020 +0300
* auto-hosts: support '#' comments after ip and hosts </s> add // Unknown host (comment)
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
</s> add sharp := strings.IndexByte(host, '#')
if sharp == 0 {
break // skip the rest of the line after #
} else if sharp > 0 {
host = host[:sharp]
}
</s> remove _, _ = f.WriteString(" 127.0.0.1 host localhost \n")
_, _ = f.WriteString(" ::1 localhost \n")
</s> add _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n") | https://github.com/AdguardTeam/AdGuardHome/commit/4870da7f94e040fea63f2ff99bf1b79ee5da457e | util/auto_hosts.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> f, _ := ioutil.TempFile(dir, "")
<mask> defer func() { _ = os.Remove(f.Name()) }()
<mask> defer f.Close()
<mask>
<mask> _, _ = f.WriteString(" 127.0.0.1 host localhost \n")
<mask> _, _ = f.WriteString(" ::1 localhost \n")
<mask>
<mask> ah.Init(f.Name())
<mask>
<mask> // Update from the hosts file
<mask> ah.updateHosts()
</s> * auto-hosts: support '#' comments after ip and hosts
Close #1807
Squashed commit of the following:
commit 9d3e2809df056354bb6195abf8106616c1e214b1
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 19:23:15 2020 +0300
improve
commit 9b8c7104560c9c80f848f15818d49a065a38e498
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 11:07:56 2020 +0300
* auto-hosts: support '#' comments after ip and hosts </s> add sharp := strings.IndexByte(host, '#')
if sharp == 0 {
break // skip the rest of the line after #
} else if sharp > 0 {
host = host[:sharp]
}
</s> add // Unknown host (comment)
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
</s> add if sharp >= 0 {
break // skip the rest of the line after #
} | https://github.com/AdguardTeam/AdGuardHome/commit/4870da7f94e040fea63f2ff99bf1b79ee5da457e | util/auto_hosts_test.go |
keep keep add keep keep keep keep | <mask> ips = ah.Process("newhost", dns.TypeA)
<mask> assert.Nil(t, ips)
<mask>
<mask> // Test hosts file
<mask> table := ah.List()
<mask> name, ok := table["127.0.0.1"]
<mask> assert.True(t, ok)
</s> * auto-hosts: support '#' comments after ip and hosts
Close #1807
Squashed commit of the following:
commit 9d3e2809df056354bb6195abf8106616c1e214b1
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 19:23:15 2020 +0300
improve
commit 9b8c7104560c9c80f848f15818d49a065a38e498
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 11:07:56 2020 +0300
* auto-hosts: support '#' comments after ip and hosts </s> add sharp := strings.IndexByte(host, '#')
if sharp == 0 {
break // skip the rest of the line after #
} else if sharp > 0 {
host = host[:sharp]
}
</s> remove _, _ = f.WriteString(" 127.0.0.1 host localhost \n")
_, _ = f.WriteString(" ::1 localhost \n")
</s> add _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n") </s> add if sharp >= 0 {
break // skip the rest of the line after #
} | https://github.com/AdguardTeam/AdGuardHome/commit/4870da7f94e040fea63f2ff99bf1b79ee5da457e | util/auto_hosts_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> req *urlfilter.DNSRequest,
<mask> ) (res *urlfilter.DNSResult, ok bool) {
<mask> switch req.DNSType {
<mask> case dns.TypeA, dns.TypeAAAA, dns.TypePTR:
<mask> log.Debug("%s: handling the request for %s", hostsContainerPref, req.Hostname)
<mask> default:
<mask> return nil, false
<mask> }
<mask>
<mask> rm.stateLock.RLock()
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove ok, eventsCh := true, hc.w.Events()
</s> add ok, eventsCh := true, hc.watcher.Events() </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) </s> remove defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
</s> add defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPrefix)) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Debug("%s: %s is expected to exist but doesn't", hostsContainerPref, p)
</s> add log.Debug("%s: %s is expected to exist but doesn't", hostsContainerPrefix, p) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep replace keep keep keep | <mask>
<mask> rm.translator = tr
<mask> }
<mask>
<mask> // hostsContainerPref is a prefix for logging and wrapping errors in
<mask> // HostsContainer's methods.
<mask> const hostsContainerPref = "hosts container"
<mask>
<mask> // HostsContainer stores the relevant hosts database provided by the OS and
<mask> // processes both A/AAAA and PTR DNS requests for those.
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // w tracks the changes in specified files and directories.
w aghos.FSWatcher
</s> add // watcher tracks the changes in specified files and directories.
watcher aghos.FSWatcher </s> remove // Close implements the io.Closer interface for *HostsContainer. Close must
// only be called once. The returned err is always nil.
</s> add // Close implements the [io.Closer] interface for *HostsContainer. It closes
// both itself and its [aghos.FSWatcher]. Close must only be called once. </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove // etcHosts is an IP-hostname pairs set taken from system configuration
// (e.g. /etc/hosts) files.
</s> add // etcHosts contains IP-hostname mappings taken from the OS-specific hosts
// configuration files, for example /etc/hosts. </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask>
<mask> // fsys is the working file system to read hosts files from.
<mask> fsys fs.FS
<mask>
<mask> // w tracks the changes in specified files and directories.
<mask> w aghos.FSWatcher
<mask>
<mask> // patterns stores specified paths in the fs.Glob-compatible form.
<mask> patterns []string
<mask>
<mask> // listID is the identifier for the list of generated rules.
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // hostsWatcher is the watcher to detect changes in the hosts files.
hostsWatcher aghos.FSWatcher
</s> add </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove // etcHosts is an IP-hostname pairs set taken from system configuration
// (e.g. /etc/hosts) files.
</s> add // etcHosts contains IP-hostname mappings taken from the OS-specific hosts
// configuration files, for example /etc/hosts. </s> remove // hostsContainerPref is a prefix for logging and wrapping errors in
</s> add // hostsContainerPrefix is a prefix for logging and wrapping errors in </s> remove transport *http.Transport
</s> add </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> fsys fs.FS,
<mask> w aghos.FSWatcher,
<mask> paths ...string,
<mask> ) (hc *HostsContainer, err error) {
<mask> defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
<mask>
<mask> if len(paths) == 0 {
<mask> return nil, ErrNoHostsPaths
<mask> }
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove cerr := Context.hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
</s> add closeErr := hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && closeErr == nil { </s> remove Context.hostsWatcher,
</s> add hostsWatcher, </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep replace keep keep keep | <mask> listID: listID,
<mask> done: make(chan struct{}, 1),
<mask> updates: make(chan HostsRecords, 1),
<mask> fsys: fsys,
<mask> w: w,
<mask> patterns: patterns,
<mask> }
<mask>
<mask> log.Debug("%s: starting", hostsContainerPref)
<mask>
<mask> // Load initially.
<mask> if err = hc.refresh(); err != nil {
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> if !errors.Is(err, fs.ErrNotExist) {
<mask> return nil, fmt.Errorf("adding path: %w", err)
<mask> }
<mask>
<mask> log.Debug("%s: %s is expected to exist but doesn't", hostsContainerPref, p)
<mask> }
<mask> }
<mask>
<mask> go hc.handleEvents()
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() </s> remove log.Debug("%s: handling the request for %s", hostsContainerPref, req.Hostname)
</s> add log.Debug("%s: handling the request for %s", hostsContainerPrefix, req.Hostname) </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace replace keep keep keep keep keep keep keep keep replace keep | <mask>
<mask> return hc, nil
<mask> }
<mask>
<mask> // Close implements the io.Closer interface for *HostsContainer. Close must
<mask> // only be called once. The returned err is always nil.
<mask> func (hc *HostsContainer) Close() (err error) {
<mask> log.Debug("%s: closing", hostsContainerPref)
<mask>
<mask> close(hc.done)
<mask>
<mask> // Close implements the io.Closer interface for *HostsContainer. Close must
<mask> // only be called once. The returned err is always nil.
<mask> func (hc *HostsContainer) Close() (err error) {
<mask> log.Debug("%s: closing", hostsContainerPref)
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove return nil
</s> add return err </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
</s> add defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPrefix)) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Error("%s: the updates channel is broken", hostsContainerPref)
</s> add log.Error("%s: the updates channel is broken", hostsContainerPrefix) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> log.Debug("%s: closing", hostsContainerPref)
<mask>
<mask> close(hc.done)
<mask>
<mask> return nil
<mask> }
<mask>
<mask> // Upd returns the channel into which the updates are sent.
<mask> func (hc *HostsContainer) Upd() (updates <-chan HostsRecords) {
<mask> return hc.updates
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove // Close implements the io.Closer interface for *HostsContainer. Close must
// only be called once. The returned err is always nil.
</s> add // Close implements the [io.Closer] interface for *HostsContainer. It closes
// both itself and its [aghos.FSWatcher]. Close must only be called once. </s> remove log.Error("%s: the updates channel is broken", hostsContainerPref)
</s> add log.Error("%s: the updates channel is broken", hostsContainerPrefix) </s> remove log.Debug("%s: sending upd", hostsContainerPref)
</s> add log.Debug("%s: sending upd", hostsContainerPrefix) </s> remove log.Debug("%s: replaced the last update", hostsContainerPref)
</s> add log.Debug("%s: replaced the last update", hostsContainerPrefix) </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep replace keep keep keep replace keep keep keep keep | <mask> // within a separate goroutine.
<mask> func (hc *HostsContainer) handleEvents() {
<mask> defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
<mask>
<mask> defer close(hc.updates)
<mask>
<mask> ok, eventsCh := true, hc.w.Events()
<mask> for ok {
<mask> select {
<mask> case _, ok = <-eventsCh:
<mask> if !ok {
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) </s> remove log.Debug("%s: handling the request for %s", hostsContainerPref, req.Hostname)
</s> add log.Debug("%s: handling the request for %s", hostsContainerPrefix, req.Hostname) </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> for ok {
<mask> select {
<mask> case _, ok = <-eventsCh:
<mask> if !ok {
<mask> log.Debug("%s: watcher closed the events channel", hostsContainerPref)
<mask>
<mask> continue
<mask> }
<mask>
<mask> if err := hc.refresh(); err != nil {
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove ok, eventsCh := true, hc.w.Events()
</s> add ok, eventsCh := true, hc.watcher.Events() </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) </s> remove log.Debug("%s: handling the request for %s", hostsContainerPref, req.Hostname)
</s> add log.Debug("%s: handling the request for %s", hostsContainerPrefix, req.Hostname) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> continue
<mask> }
<mask>
<mask> if err := hc.refresh(); err != nil {
<mask> log.Error("%s: %s", hostsContainerPref, err)
<mask> }
<mask> case _, ok = <-hc.done:
<mask> // Go on.
<mask> }
<mask> }
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f)
</s> add log.Error("%s: host %q is invalid, ignoring", hostsContainerPrefix, f) </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) </s> remove log.Error("%s: the updates channel is broken", hostsContainerPref)
</s> add log.Error("%s: the updates channel is broken", hostsContainerPrefix) </s> remove log.Debug("%s: replaced the last update", hostsContainerPref)
</s> add log.Debug("%s: replaced the last update", hostsContainerPrefix) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> //
<mask> // TODO(e.burkov): Investigate if hosts may contain DNS-SD domains.
<mask> err = netutil.ValidateHostname(f)
<mask> if err != nil {
<mask> log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f)
<mask>
<mask> continue
<mask> }
<mask>
<mask> hosts = append(hosts, f)
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> func (hp *hostsParser) addRules(ip netip.Addr, host, line string) {
<mask> rule, rulePtr := hp.writeRules(host, ip)
<mask> hp.translations[rule], hp.translations[rulePtr] = line, line
<mask>
<mask> log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, host)
<mask> }
<mask>
<mask> // writeRules writes the actual rule for the qtype and the PTR for the host-ip
<mask> // pair into internal builders.
<mask> func (hp *hostsParser) writeRules(host string, ip netip.Addr) (rule, rulePtr string) {
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: sending upd", hostsContainerPref)
</s> add log.Debug("%s: sending upd", hostsContainerPrefix) </s> remove log.Error("%s: the updates channel is broken", hostsContainerPref)
</s> add log.Error("%s: the updates channel is broken", hostsContainerPrefix) </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove return nil
</s> add return err </s> remove // hostsContainerPref is a prefix for logging and wrapping errors in
</s> add // hostsContainerPrefix is a prefix for logging and wrapping errors in </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> // sendUpd tries to send the parsed data to the ch.
<mask> func (hp *hostsParser) sendUpd(ch chan HostsRecords) {
<mask> log.Debug("%s: sending upd", hostsContainerPref)
<mask>
<mask> upd := hp.table
<mask> select {
<mask> case ch <- upd:
<mask> // Updates are delivered. Go on.
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: replaced the last update", hostsContainerPref)
</s> add log.Debug("%s: replaced the last update", hostsContainerPrefix) </s> remove log.Error("%s: the updates channel is broken", hostsContainerPref)
</s> add log.Error("%s: the updates channel is broken", hostsContainerPrefix) </s> remove return nil
</s> add return err </s> remove log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, host)
</s> add log.Debug("%s: added ip-host pair %q-%q", hostsContainerPrefix, ip, host) </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep replace keep keep keep replace keep keep keep keep | <mask> case <-ch:
<mask> ch <- upd
<mask> log.Debug("%s: replaced the last update", hostsContainerPref)
<mask> case ch <- upd:
<mask> // The previous update was just read and the next one pushed. Go on.
<mask> default:
<mask> log.Error("%s: the updates channel is broken", hostsContainerPref)
<mask> }
<mask> }
<mask>
<mask> // newStrg creates a new rules storage from parsed data.
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: sending upd", hostsContainerPref)
</s> add log.Debug("%s: sending upd", hostsContainerPrefix) </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove return nil
</s> add return err </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove // hostsContainerPref is a prefix for logging and wrapping errors in
</s> add // hostsContainerPrefix is a prefix for logging and wrapping errors in | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // needed.
<mask> //
<mask> // TODO(e.burkov): Accept a parameter to specify the files to refresh.
<mask> func (hc *HostsContainer) refresh() (err error) {
<mask> log.Debug("%s: refreshing", hostsContainerPref)
<mask>
<mask> hp := hc.newHostsParser()
<mask> if _, err = aghos.FileWalker(hp.parseFile).Walk(hc.fsys, hc.patterns...); err != nil {
<mask> return fmt.Errorf("refreshing : %w", err)
<mask> }
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove return nil
</s> add return err </s> remove // Close implements the io.Closer interface for *HostsContainer. Close must
// only be called once. The returned err is always nil.
</s> add // Close implements the [io.Closer] interface for *HostsContainer. It closes
// both itself and its [aghos.FSWatcher]. Close must only be called once. </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
</s> add defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPrefix)) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> // hc.last is nil on the first refresh, so let that one through.
<mask> if hc.last != nil && maps.EqualFunc(hp.table, hc.last, (*HostsRecord).equal) {
<mask> log.Debug("%s: no changes detected", hostsContainerPref)
<mask>
<mask> return nil
<mask> }
<mask> defer hp.sendUpd(hc.updates)
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove cerr := Context.hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
</s> add closeErr := hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && closeErr == nil { </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) </s> remove Context.hostsWatcher,
</s> add hostsWatcher, </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> hc, err := NewHostsContainer(0, testFS, &aghtest.FSWatcher{
<mask> OnEvents: onEvents,
<mask> OnAdd: onAdd,
<mask> OnClose: func() (err error) { panic("not implemented") },
<mask> }, tc.paths...)
<mask> if tc.wantErr != nil {
<mask> require.ErrorIs(t, err, tc.wantErr)
<mask>
<mask> assert.Nil(t, hc)
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove Timeout: time.Minute * 5,
Transport: Context.transport,
</s> add Timeout: time.Minute * 5,
Transport: &http.Transport{
DialContext: customDialContext,
Proxy: getHTTPProxy,
TLSClientConfig: &tls.Config{
RootCAs: Context.tlsRoots,
CipherSuites: Context.tlsCipherIDs,
MinVersion: tls.VersionTLS12,
},
}, </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> errWatcher := &aghtest.FSWatcher{
<mask> OnEvents: func() (e <-chan struct{}) { panic("not implemented") },
<mask> OnAdd: func(name string) (err error) { return errOnAdd },
<mask> OnClose: func() (err error) { panic("not implemented") },
<mask> }
<mask>
<mask> hc, err := NewHostsContainer(0, testFS, errWatcher, p)
<mask> require.ErrorIs(t, err, errOnAdd)
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() </s> remove Timeout: time.Minute * 5,
Transport: Context.transport,
</s> add Timeout: time.Minute * 5,
Transport: &http.Transport{
DialContext: customDialContext,
Proxy: getHTTPProxy,
TLSClientConfig: &tls.Config{
RootCAs: Context.tlsRoots,
CipherSuites: Context.tlsCipherIDs,
MinVersion: tls.VersionTLS12,
},
}, | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> assert.Equal(t, "dir", name)
<mask>
<mask> return nil
<mask> },
<mask> OnClose: func() (err error) { panic("not implemented") },
<mask> }
<mask>
<mask> hc, err := NewHostsContainer(0, testFS, w, "dir")
<mask> require.NoError(t, err)
<mask> testutil.CleanupAndRequireSuccess(t, hc.Close)
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove Timeout: time.Minute * 5,
Transport: Context.transport,
</s> add Timeout: time.Minute * 5,
Transport: &http.Transport{
DialContext: customDialContext,
Proxy: getHTTPProxy,
TLSClientConfig: &tls.Config{
RootCAs: Context.tlsRoots,
CipherSuites: Context.tlsCipherIDs,
MinVersion: tls.VersionTLS12,
},
}, </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> func TestHostsContainer_Translate(t *testing.T) {
<mask> stubWatcher := aghtest.FSWatcher{
<mask> OnEvents: func() (e <-chan struct{}) { return nil },
<mask> OnAdd: func(name string) (err error) { return nil },
<mask> OnClose: func() (err error) { panic("not implemented") },
<mask> }
<mask>
<mask> require.NoError(t, fstest.TestFS(testdata, "etc_hosts"))
<mask>
<mask> hc, err := NewHostsContainer(0, testdata, &stubWatcher, "etc_hosts")
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> stubWatcher := aghtest.FSWatcher{
<mask> OnEvents: func() (e <-chan struct{}) { return nil },
<mask> OnAdd: func(name string) (err error) { return nil },
<mask> OnClose: func() (err error) { panic("not implemented") },
<mask> }
<mask>
<mask> hc, err := NewHostsContainer(listID, testdata, &stubWatcher, "etc_hosts")
<mask> require.NoError(t, err)
<mask> testutil.CleanupAndRequireSuccess(t, hc.Close)
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace replace keep replace replace keep keep keep keep | <mask> auth *Auth // HTTP authentication module
<mask> filters *filtering.DNSFilter // DNS filtering module
<mask> web *Web // Web (HTTP, HTTPS) module
<mask> tls *tlsManager // TLS module
<mask> // etcHosts is an IP-hostname pairs set taken from system configuration
<mask> // (e.g. /etc/hosts) files.
<mask> etcHosts *aghnet.HostsContainer
<mask> // hostsWatcher is the watcher to detect changes in the hosts files.
<mask> hostsWatcher aghos.FSWatcher
<mask>
<mask> updater *updater.Updater
<mask>
<mask> // mux is our custom http.ServeMux.
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // w tracks the changes in specified files and directories.
w aghos.FSWatcher
</s> add // watcher tracks the changes in specified files and directories.
watcher aghos.FSWatcher </s> remove // hostsContainerPref is a prefix for logging and wrapping errors in
</s> add // hostsContainerPrefix is a prefix for logging and wrapping errors in </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove transport *http.Transport
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
keep keep keep keep replace keep keep keep keep keep | <mask> workDir string // Location of our directory, used to protect against CWD being somewhere else
<mask> pidFileName string // PID file name. Empty if no PID file was created.
<mask> controlLock sync.Mutex
<mask> tlsRoots *x509.CertPool // list of root CAs for TLSv1.2
<mask> transport *http.Transport
<mask> client *http.Client
<mask> appSignalChannel chan os.Signal // Channel for receiving OS signals by the console app
<mask>
<mask> // tlsCipherIDs are the ID of the cipher suites that AdGuard Home must use.
<mask> tlsCipherIDs []uint16
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // w tracks the changes in specified files and directories.
w aghos.FSWatcher
</s> add // watcher tracks the changes in specified files and directories.
watcher aghos.FSWatcher </s> remove defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
</s> add defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPrefix)) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove // hostsContainerPref is a prefix for logging and wrapping errors in
</s> add // hostsContainerPrefix is a prefix for logging and wrapping errors in </s> remove log.Debug("%s: sending upd", hostsContainerPref)
</s> add log.Debug("%s: sending upd", hostsContainerPrefix) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
keep keep keep replace replace replace replace replace replace replace replace replace keep replace replace keep keep keep | <mask> setupContextFlags(opts)
<mask>
<mask> Context.tlsRoots = aghtls.SystemRootCAs()
<mask> Context.transport = &http.Transport{
<mask> DialContext: customDialContext,
<mask> Proxy: getHTTPProxy,
<mask> TLSClientConfig: &tls.Config{
<mask> RootCAs: Context.tlsRoots,
<mask> CipherSuites: Context.tlsCipherIDs,
<mask> MinVersion: tls.VersionTLS12,
<mask> },
<mask> }
<mask> Context.client = &http.Client{
<mask> Timeout: time.Minute * 5,
<mask> Transport: Context.transport,
<mask> }
<mask>
<mask> if !Context.firstRun {
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> // setupHostsContainer initializes the structures to keep up-to-date the hosts
<mask> // provided by the OS.
<mask> func setupHostsContainer() (err error) {
<mask> Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
<mask> if err != nil {
<mask> return fmt.Errorf("initing hosts watcher: %w", err)
<mask> }
<mask>
<mask> Context.etcHosts, err = aghnet.NewHostsContainer(
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove Context.hostsWatcher,
</s> add hostsWatcher, </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove cerr := Context.hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
</s> add closeErr := hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && closeErr == nil { | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
keep replace keep keep keep replace replace keep | <mask> aghos.RootDirFS(),
<mask> Context.hostsWatcher,
<mask> aghnet.DefaultHostsPaths()...,
<mask> )
<mask> if err != nil {
<mask> cerr := Context.hostsWatcher.Close()
<mask> if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
<mask> log.Info("warning: initing hosts container: %s", err)
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() </s> remove return errors.WithDeferred(fmt.Errorf("initing hosts container: %w", err), cerr)
</s> add return errors.WithDeferred(fmt.Errorf("initing hosts container: %w", err), closeErr) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> return nil
<mask> }
<mask>
<mask> return errors.WithDeferred(fmt.Errorf("initing hosts container: %w", err), cerr)
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove cerr := Context.hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
</s> add closeErr := hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && closeErr == nil { </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove log.Debug("%s: no changes detected", hostsContainerPref)
</s> add log.Debug("%s: no changes detected", hostsContainerPrefix) </s> remove log.Debug("%s: %s is expected to exist but doesn't", hostsContainerPref, p)
</s> add log.Debug("%s: %s is expected to exist but doesn't", hostsContainerPrefix, p) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep | <mask> }
<mask> }
<mask>
<mask> if Context.etcHosts != nil {
<mask> // Currently Context.hostsWatcher is only used in Context.etcHosts and
<mask> // needs closing only in case of the successful initialization of
<mask> // Context.etcHosts.
<mask> if err = Context.hostsWatcher.Close(); err != nil {
<mask> log.Error("closing hosts watcher: %s", err)
<mask> }
<mask>
<mask> if err = Context.etcHosts.Close(); err != nil {
<mask> log.Error("closing hosts container: %s", err)
<mask> }
<mask> }
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove cerr := Context.hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
</s> add closeErr := hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && closeErr == nil { </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f)
</s> add log.Error("%s: host %q is invalid, ignoring", hostsContainerPrefix, f) </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
keep replace keep keep keep replace keep | <mask>
<mask> // maxDomainNameLen is the maximum allowed length of a full domain name
<mask> // according to RFC 1035.
<mask> //
<mask> // See https://stackoverflow.com/a/32294443/1892060.
<mask> const maxDomainNameLen = 253
<mask>
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> add const (
// recursionTTL is the time recursive request is cached for.
recursionTTL = 5 * time.Second
// cachedRecurrentReqNum is the maximum number of cached recurrent
// requests.
cachedRecurrentReqNum = 1000
)
</s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) </s> remove func processUpstream(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
</s> add func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { </s> add s.processRecursion, </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/aghnet/addr.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask>
<mask> l := len(name)
<mask> if l == 0 {
<mask> return errors.Error("domain name is empty")
<mask> } else if l > maxDomainNameLen {
<mask> return fmt.Errorf("too long, max: %d", maxDomainNameLen)
<mask> }
<mask>
<mask> labels := strings.Split(name, ".")
<mask> for i, l := range labels {
<mask> err = ValidateDomainNameLabel(l)
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove resp = ctx.Res
</s> add resp := ctx.Res </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> add req := d.Req </s> remove opt := d.Req.IsEdns0()
</s> add opt := req.IsEdns0() </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) </s> add s.recDetector.add(*d.Req) | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/aghnet/addr.go |
keep keep keep add keep keep keep keep keep keep | <mask> // out of range checking in any of the following functions, because the
<mask> // (*proxy.Proxy).handleDNSRequest method performs it before calling the
<mask> // appropriate handler.
<mask> mods := []modProcessFunc{
<mask> processInitial,
<mask> s.processDetermineLocal,
<mask> s.processInternalHosts,
<mask> s.processRestrictLocal,
<mask> s.processInternalIPAddrs,
<mask> processClientID,
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove // maxDomainNameLen is the maximum allowed length of a full domain name
</s> add // MaxDomainNameLen is the maximum allowed length of a full domain name </s> remove processUpstream,
</s> add s.processUpstream, </s> add const (
// recursionTTL is the time recursive request is cached for.
recursionTTL = 5 * time.Second
// cachedRecurrentReqNum is the maximum number of cached recurrent
// requests.
cachedRecurrentReqNum = 1000
)
</s> remove const maxDomainNameLen = 253
</s> add const MaxDomainNameLen = 253 </s> add // processRecursion checks the incoming request and halts it's handling if s
// have tried to resolve it recently.
func (s *Server) processRecursion(dctx *dnsContext) (rc resultCode) {
pctx := dctx.proxyCtx
if msg := pctx.Req; msg != nil && s.recDetector.check(*msg) {
log.Debug("recursion detected resolving %q", msg.Question[0].Name)
pctx.Res = s.genNXDomain(pctx.Req)
return resultCodeFinish
}
return resultCodeSuccess
}
</s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> s.processInternalIPAddrs,
<mask> processClientID,
<mask> processFilteringBeforeRequest,
<mask> s.processLocalPTR,
<mask> processUpstream,
<mask> processDNSSECAfterResponse,
<mask> processFilteringAfterResponse,
<mask> s.ipset.process,
<mask> processQueryLogsAndStats,
<mask> }
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> add s.processRecursion, </s> add s.recDetector.add(*d.Req) </s> add req := d.Req </s> remove opt := d.Req.IsEdns0()
</s> add opt := req.IsEdns0() </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
keep keep add keep keep keep keep keep keep | <mask> return nil
<mask> }
<mask>
<mask> // Perform initial checks; process WHOIS & rDNS
<mask> func processInitial(ctx *dnsContext) (rc resultCode) {
<mask> s := ctx.srv
<mask> d := ctx.proxyCtx
<mask> if s.conf.AAAADisabled && d.Req.Question[0].Qtype == dns.TypeAAAA {
<mask> _ = proxy.CheckDisabledAAAARequest(d, true)
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove func processUpstream(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
</s> add func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> add req := d.Req </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) </s> remove opt := d.Req.IsEdns0()
</s> add opt := req.IsEdns0() | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
keep keep add keep keep keep keep keep keep | <mask> }
<mask>
<mask> if s.conf.UsePrivateRDNS {
<mask> if err := s.localResolvers.Resolve(d); err != nil {
<mask> ctx.err = err
<mask>
<mask> return resultCodeError
<mask> }
<mask> }
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { </s> remove var resp *dns.Msg
err = resolver.Resolve(ctx)
if err != nil {
</s> add s.recDetector.add(*req)
if err = resolver.Resolve(ctx); err != nil { </s> remove resp = ctx.Res
</s> add resp := ctx.Res </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) </s> add req := d.Req | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> return resultCodeSuccess
<mask> }
<mask>
<mask> // processUpstream passes request to upstream servers and handles the response.
<mask> func processUpstream(ctx *dnsContext) (rc resultCode) {
<mask> s := ctx.srv
<mask> d := ctx.proxyCtx
<mask> if d.Res != nil {
<mask> return resultCodeSuccess // response is already set - nothing to do
<mask> }
<mask>
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> add // processRecursion checks the incoming request and halts it's handling if s
// have tried to resolve it recently.
func (s *Server) processRecursion(dctx *dnsContext) (rc resultCode) {
pctx := dctx.proxyCtx
if msg := pctx.Req; msg != nil && s.recDetector.check(*msg) {
log.Debug("recursion detected resolving %q", msg.Question[0].Name)
pctx.Res = s.genNXDomain(pctx.Req)
return resultCodeFinish
}
return resultCodeSuccess
}
</s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> add s.recDetector.add(*d.Req) </s> add req := d.Req | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
keep keep keep keep replace replace replace replace keep keep keep keep keep | <mask> }
<mask>
<mask> if d.Addr != nil && s.conf.GetCustomUpstreamByClient != nil {
<mask> clientIP := IPStringFromAddr(d.Addr)
<mask> upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
<mask> if upstreamsConf != nil {
<mask> log.Debug("Using custom upstreams for %s", clientIP)
<mask> d.CustomUpstreamConfig = upstreamsConf
<mask> }
<mask> }
<mask>
<mask> if s.conf.EnableDNSSEC {
<mask> opt := d.Req.IsEdns0()
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove opt := d.Req.IsEdns0()
</s> add opt := req.IsEdns0() </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) </s> add req := d.Req </s> remove resp = ctx.Res
</s> add resp := ctx.Res </s> add s.recDetector.add(*d.Req) </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
keep keep add keep keep keep keep keep keep | <mask> }
<mask> }
<mask>
<mask> if s.conf.EnableDNSSEC {
<mask> opt := req.IsEdns0()
<mask> if opt == nil {
<mask> log.Debug("dns: adding OPT record with DNSSEC flag")
<mask> req.SetEdns0(4096, true)
<mask> } else if !opt.Do() {
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) </s> remove opt := d.Req.IsEdns0()
</s> add opt := req.IsEdns0() </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) </s> add s.recDetector.add(*d.Req) </s> remove resp = ctx.Res
</s> add resp := ctx.Res | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
keep replace keep replace replace keep keep | <mask> if s.conf.EnableDNSSEC {
<mask> opt := d.Req.IsEdns0()
<mask> if opt == nil {
<mask> log.Debug("dns: Adding OPT record with DNSSEC flag")
<mask> d.Req.SetEdns0(4096, true)
<mask> } else if !opt.Do() {
<mask> opt.SetDo(true)
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> add req := d.Req </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) </s> add s.recDetector.add(*d.Req) </s> remove resp = ctx.Res
</s> add resp := ctx.Res | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
keep keep keep keep replace replace replace keep keep keep keep keep | <mask> }
<mask> }
<mask>
<mask> // request was not filtered so let it be processed further
<mask> err := s.dnsProxy.Resolve(d)
<mask> if err != nil {
<mask> ctx.err = err
<mask> return resultCodeError
<mask> }
<mask>
<mask> ctx.responseFromUpstream = true
<mask> return resultCodeSuccess
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> add s.recDetector.add(*d.Req) </s> remove var resp *dns.Msg
err = resolver.Resolve(ctx)
if err != nil {
</s> add s.recDetector.add(*req)
if err = resolver.Resolve(ctx); err != nil { </s> remove resp = ctx.Res
</s> add resp := ctx.Res </s> add // processRecursion checks the incoming request and halts it's handling if s
// have tried to resolve it recently.
func (s *Server) processRecursion(dctx *dnsContext) (rc resultCode) {
pctx := dctx.proxyCtx
if msg := pctx.Req; msg != nil && s.recDetector.check(*msg) {
log.Debug("recursion detected resolving %q", msg.Question[0].Name)
pctx.Res = s.genNXDomain(pctx.Req)
return resultCodeFinish
}
return resultCodeSuccess
}
</s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) </s> remove func processUpstream(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
</s> add func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
keep keep add keep keep keep keep keep keep | <mask> ipset ipsetCtx
<mask> subnetDetector *aghnet.SubnetDetector
<mask> localResolvers *proxy.Proxy
<mask>
<mask> tableHostToIP hostToIPTable
<mask> tableHostToIPLock sync.Mutex
<mask>
<mask> tableIPToHost ipToHostTable
<mask> tableIPToHostLock sync.Mutex
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> add s.recDetector.clear()
</s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove const maxDomainNameLen = 253
</s> add const MaxDomainNameLen = 253 </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) </s> add s.processRecursion, </s> remove processUpstream,
</s> add s.processUpstream, | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
keep keep keep add keep keep keep keep keep keep | <mask>
<mask> return string(b)
<mask> }
<mask>
<mask> // NewServer creates a new instance of the dnsforward.Server
<mask> // Note: this function must be called only once
<mask> func NewServer(p DNSCreateParams) (s *Server, err error) {
<mask> var localDomainSuffix string
<mask> if p.LocalDomain == "" {
<mask> localDomainSuffix = defaultLocalDomainSuffix
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} </s> remove const maxDomainNameLen = 253
</s> add const MaxDomainNameLen = 253 </s> remove var resp *dns.Msg
err = resolver.Resolve(ctx)
if err != nil {
</s> add s.recDetector.add(*req)
if err = resolver.Resolve(ctx); err != nil { </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { </s> add // processRecursion checks the incoming request and halts it's handling if s
// have tried to resolve it recently.
func (s *Server) processRecursion(dctx *dnsContext) (rc resultCode) {
pctx := dctx.proxyCtx
if msg := pctx.Req; msg != nil && s.recDetector.check(*msg) {
log.Debug("recursion detected resolving %q", msg.Question[0].Name)
pctx.Res = s.genNXDomain(pctx.Req)
return resultCodeFinish
}
return resultCodeSuccess
}
</s> remove func processUpstream(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
</s> add func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
keep keep add keep keep keep keep keep keep | <mask> queryLog: p.QueryLog,
<mask> subnetDetector: p.SubnetDetector,
<mask> localDomainSuffix: localDomainSuffix,
<mask> }
<mask>
<mask> if p.DHCPServer != nil {
<mask> s.dhcpServer = p.DHCPServer
<mask> s.dhcpServer.SetOnLeaseChanged(s.onDHCPLeaseChanged)
<mask> s.onDHCPLeaseChanged(dhcpd.LeaseChangedAdded)
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> add s.recDetector.add(*d.Req) </s> remove var resp *dns.Msg
err = resolver.Resolve(ctx)
if err != nil {
</s> add s.recDetector.add(*req)
if err = resolver.Resolve(ctx); err != nil { </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { </s> remove resp = ctx.Res
</s> add resp := ctx.Res </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> // NewCustomServer creates a new instance of *Server with custom internal proxy.
<mask> func NewCustomServer(internalProxy *proxy.Proxy) *Server {
<mask> s := &Server{}
<mask> if internalProxy != nil {
<mask> s.internalProxy = internalProxy
<mask> }
<mask>
<mask> return s
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> add const (
// recursionTTL is the time recursive request is cached for.
recursionTTL = 5 * time.Second
// cachedRecurrentReqNum is the maximum number of cached recurrent
// requests.
cachedRecurrentReqNum = 1000
)
</s> add // processRecursion checks the incoming request and halts it's handling if s
// have tried to resolve it recently.
func (s *Server) processRecursion(dctx *dnsContext) (rc resultCode) {
pctx := dctx.proxyCtx
if msg := pctx.Req; msg != nil && s.recDetector.check(*msg) {
log.Debug("recursion detected resolving %q", msg.Question[0].Name)
pctx.Res = s.genNXDomain(pctx.Req)
return resultCodeFinish
}
return resultCodeSuccess
}
</s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove func processUpstream(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
</s> add func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) </s> add req := d.Req | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
keep keep keep keep replace replace replace keep keep keep replace replace keep keep keep keep | <mask> Proto: "udp",
<mask> Req: req,
<mask> StartTime: time.Now(),
<mask> }
<mask> var resp *dns.Msg
<mask> err = resolver.Resolve(ctx)
<mask> if err != nil {
<mask> return "", err
<mask> }
<mask>
<mask> resp = ctx.Res
<mask>
<mask> if len(resp.Answer) == 0 {
<mask> return "", fmt.Errorf("lookup for %q: %w", arpa, rDNSEmptyAnswerErr)
<mask> }
<mask>
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> add s.recDetector.add(*d.Req) </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
keep keep add keep keep keep keep keep keep | <mask> return fmt.Errorf("setting up resolvers: %w", err)
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
<mask> // Stop stops the DNS server.
<mask> func (s *Server) Stop() error {
<mask> s.serverLock.Lock()
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove func processUpstream(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
</s> add func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { </s> add // processRecursion checks the incoming request and halts it's handling if s
// have tried to resolve it recently.
func (s *Server) processRecursion(dctx *dnsContext) (rc resultCode) {
pctx := dctx.proxyCtx
if msg := pctx.Req; msg != nil && s.recDetector.check(*msg) {
log.Debug("recursion detected resolving %q", msg.Question[0].Name)
pctx.Res = s.genNXDomain(pctx.Req)
return resultCodeFinish
}
return resultCodeSuccess
}
</s> remove const maxDomainNameLen = 253
</s> add const MaxDomainNameLen = 253 </s> remove resp = ctx.Res
</s> add resp := ctx.Res </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} </s> add const (
// recursionTTL is the time recursive request is cached for.
recursionTTL = 5 * time.Second
// cachedRecurrentReqNum is the maximum number of cached recurrent
// requests.
cachedRecurrentReqNum = 1000
)
| https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
keep add keep keep keep keep | <mask> "fmt"
<mask> "os/exec"
<mask> "syscall"
<mask> )
<mask>
<mask> // UnsupportedError is returned by functions and methods when a particular
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove "fmt"
</s> add </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
RlimitNoFile uint64 `yaml:"rlimit_nofile"` // Maximum number of opened fd's per process (0: default)
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060
</s> add ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 </s> remove const currentSchemaVersion = 10
</s> add const currentSchemaVersion = 11 | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> import (
<mask> "fmt"
<mask> "os/exec"
<mask> "syscall"
<mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> )
<mask>
<mask> // ErrUnsupported is returned when the functionality is unsupported on the
<mask> // current operating system.
<mask> //
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> add "runtime" </s> remove "fmt"
</s> add </s> remove const currentSchemaVersion = 10
</s> add const currentSchemaVersion = 11 </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> add // osConfig contains OS-related configuration.
type osConfig struct {
// Group is the name of the group which AdGuard Home must switch to on
// startup. Empty string means no switching.
Group string `yaml:"group"`
// User is the name of the user which AdGuard Home must switch to on
// startup. Empty string means no switching.
User string `yaml:"user"`
// RlimitNoFile is the maximum number of opened fd's per process. Zero
// means use the default value.
RlimitNoFile uint64 `yaml:"rlimit_nofile"`
}
| https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os.go |
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep | <mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> )
<mask>
<mask> // ErrUnsupported is returned when the functionality is unsupported on the
<mask> // current operating system.
<mask> //
<mask> // TODO(a.garipov): Make a structured error and use it everywhere instead of
<mask> // a bunch of fmt.Errorf and all that.
<mask> const ErrUnsupported errors.Error = "unsupported"
<mask>
<mask> // CanBindPrivilegedPorts checks if current process can bind to privileged
<mask> // ports.
<mask> func CanBindPrivilegedPorts() (can bool, err error) {
<mask> return canBindPrivilegedPorts()
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> add "runtime" </s> remove const currentSchemaVersion = 10
</s> add const currentSchemaVersion = 11 </s> add // osConfig contains OS-related configuration.
type osConfig struct {
// Group is the name of the group which AdGuard Home must switch to on
// startup. Empty string means no switching.
Group string `yaml:"group"`
// User is the name of the user which AdGuard Home must switch to on
// startup. Empty string means no switching.
User string `yaml:"user"`
// RlimitNoFile is the maximum number of opened fd's per process. Zero
// means use the default value.
RlimitNoFile uint64 `yaml:"rlimit_nofile"`
}
</s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> remove ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
RlimitNoFile uint64 `yaml:"rlimit_nofile"` // Maximum number of opened fd's per process (0: default)
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060
</s> add ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> package aghos
<mask>
<mask> import (
<mask> "fmt"
<mask> "syscall"
<mask>
<mask> "golang.org/x/sys/windows"
<mask> )
<mask>
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove import "fmt"
</s> add import "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> add "runtime" </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove const currentSchemaVersion = 10
</s> add const currentSchemaVersion = 11 | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os_windows.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return HaveAdminRights()
<mask> }
<mask>
<mask> func setRlimit(val uint64) (err error) {
<mask> return ErrUnsupported
<mask> }
<mask>
<mask> func haveAdminRights() (bool, error) {
<mask> var token windows.Token
<mask> h := windows.CurrentProcess()
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV6") </s> remove import "fmt"
</s> add import "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") </s> add upgradeSchema10to11, | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os_windows.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return true, nil
<mask> }
<mask>
<mask> func sendProcessSignal(pid int, sig syscall.Signal) error {
<mask> return fmt.Errorf("not supported on Windows")
<mask> }
<mask>
<mask> func isOpenWrt() (ok bool) {
<mask> return false
<mask> }
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV6") </s> remove if config.RlimitNoFile != 0 {
err = aghos.SetRlimit(config.RlimitNoFile)
if err != nil && !errors.Is(err, aghos.ErrUnsupported) {
return fmt.Errorf("setting rlimit: %w", err)
}
}
</s> add </s> remove import "fmt"
</s> add import "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove return ErrUnsupported
</s> add return Unsupported("setrlimit") | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os_windows.go |
keep keep keep add keep keep keep keep keep keep | <mask> "runtime"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/insomniacslk/dhcp/dhcpv4"
<mask> "github.com/insomniacslk/dhcp/dhcpv4/nclient4"
<mask> "github.com/insomniacslk/dhcp/dhcpv6"
<mask> "github.com/insomniacslk/dhcp/dhcpv6/nclient6"
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> add "runtime" </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove "fmt"
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/checkother.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> // TODO(a.garipov): Find out what this is about. Perhaps this
<mask> // information is outdated or at least incomplete.
<mask> if runtime.GOOS == "darwin" {
<mask> return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
<mask> }
<mask>
<mask> srcIP := ifaceIPNet[0]
<mask> src := aghnet.JoinHostPort(srcIP.String(), 68)
<mask> dst := "255.255.255.255:67"
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> add upgradeSchema10to11, </s> remove return ErrUnsupported
</s> add return Unsupported("setrlimit") </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") </s> remove if config.RlimitNoFile != 0 {
err = aghos.SetRlimit(config.RlimitNoFile)
if err != nil && !errors.Is(err, aghos.ErrUnsupported) {
return fmt.Errorf("setting rlimit: %w", err)
}
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/checkother.go |
keep replace keep keep keep keep keep keep keep keep replace keep keep keep keep | <mask>
<mask> import "fmt"
<mask>
<mask> func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) {
<mask> return false, fmt.Errorf("not supported")
<mask> }
<mask>
<mask> import "fmt"
<mask>
<mask> func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) {
<mask> return false, fmt.Errorf("not supported")
<mask> }
<mask>
<mask> func CheckIfOtherDHCPServersPresentV6(ifaceName string) (bool, error) {
<mask> return false, fmt.Errorf("not supported")
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV6") </s> remove return ErrUnsupported
</s> add return Unsupported("setrlimit") </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") </s> remove return fmt.Errorf("not supported on Windows")
</s> add return Unsupported("kill") </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/checkother_windows.go |
keep keep keep keep replace keep | <mask> return false, fmt.Errorf("not supported")
<mask> }
<mask>
<mask> func CheckIfOtherDHCPServersPresentV6(ifaceName string) (bool, error) {
<mask> return false, fmt.Errorf("not supported")
<mask> }
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove import "fmt"
</s> add import "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove return fmt.Errorf("not supported on Windows")
</s> add return Unsupported("kill") </s> remove return ErrUnsupported
</s> add return Unsupported("setrlimit") </s> remove return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/checkother_windows.go |
keep keep replace keep keep keep keep replace replace | <mask> "net"
<mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "golang.org/x/net/ipv4"
<mask> )
<mask>
<mask> // Create a socket for receiving broadcast packets
<mask> func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
<mask> return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return fmt.Errorf("not supported on Windows")
</s> add return Unsupported("kill") </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> remove return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
RlimitNoFile uint64 `yaml:"rlimit_nofile"` // Maximum number of opened fd's per process (0: default)
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060
</s> add ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/os_windows.go |
keep keep keep add keep keep keep keep keep | <mask> LogFile string `yaml:"log_file"` // Path to the log file. If empty, write to stdout. If "syslog", writes to syslog
<mask> Verbose bool `yaml:"verbose"` // If true, verbose logging is enabled
<mask> }
<mask>
<mask> // configuration is loaded from YAML
<mask> // field ordering is important -- yaml fields will mirror ordering from here
<mask> type configuration struct {
<mask> // Raw file data to avoid re-reading of configuration file
<mask> // It's reset after config is parsed
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
RlimitNoFile uint64 `yaml:"rlimit_nofile"` // Maximum number of opened fd's per process (0: default)
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060
</s> add ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 </s> add err = configureOS(&config)
fatalOnError(err)
</s> add OSConfig *osConfig `yaml:"os"`
</s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> add OSConfig: &osConfig{}, | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/config.go |
keep keep keep keep replace replace replace replace keep keep keep keep keep | <mask> AuthAttempts uint `yaml:"auth_attempts"`
<mask> // AuthBlockMin is the duration, in minutes, of the block of new login
<mask> // attempts after AuthAttempts unsuccessful login attempts.
<mask> AuthBlockMin uint `yaml:"block_auth_min"`
<mask> ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
<mask> Language string `yaml:"language"` // two-letter ISO 639-1 language code
<mask> RlimitNoFile uint64 `yaml:"rlimit_nofile"` // Maximum number of opened fd's per process (0: default)
<mask> DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060
<mask>
<mask> // TTL for a web session (in hours)
<mask> // An active session is automatically refreshed once a day.
<mask> WebSessionTTLHours uint32 `yaml:"web_session_ttl"`
<mask>
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> add // osConfig contains OS-related configuration.
type osConfig struct {
// Group is the name of the group which AdGuard Home must switch to on
// startup. Empty string means no switching.
Group string `yaml:"group"`
// User is the name of the user which AdGuard Home must switch to on
// startup. Empty string means no switching.
User string `yaml:"user"`
// RlimitNoFile is the maximum number of opened fd's per process. Zero
// means use the default value.
RlimitNoFile uint64 `yaml:"rlimit_nofile"`
}
</s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> add "runtime" | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/config.go |
keep keep add keep keep keep keep | <mask>
<mask> logSettings `yaml:",inline"`
<mask>
<mask> sync.RWMutex `yaml:"-"`
<mask>
<mask> SchemaVersion int `yaml:"schema_version"` // keeping last so that users will be less tempted to change it -- used when upgrading between versions
<mask> }
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> add // osConfig contains OS-related configuration.
type osConfig struct {
// Group is the name of the group which AdGuard Home must switch to on
// startup. Empty string means no switching.
Group string `yaml:"group"`
// User is the name of the user which AdGuard Home must switch to on
// startup. Empty string means no switching.
User string `yaml:"user"`
// RlimitNoFile is the maximum number of opened fd's per process. Zero
// means use the default value.
RlimitNoFile uint64 `yaml:"rlimit_nofile"`
}
</s> add err = configureOS(&config)
fatalOnError(err)
</s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> add "runtime" | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/config.go |
keep keep keep add keep keep keep keep keep | <mask> LogMaxBackups: 0,
<mask> LogMaxSize: 100,
<mask> LogMaxAge: 3,
<mask> },
<mask> SchemaVersion: currentSchemaVersion,
<mask> }
<mask>
<mask> // initConfig initializes default configuration for the current OS&ARCH
<mask> func initConfig() {
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> add // osConfig contains OS-related configuration.
type osConfig struct {
// Group is the name of the group which AdGuard Home must switch to on
// startup. Empty string means no switching.
Group string `yaml:"group"`
// User is the name of the user which AdGuard Home must switch to on
// startup. Empty string means no switching.
User string `yaml:"user"`
// RlimitNoFile is the maximum number of opened fd's per process. Zero
// means use the default value.
RlimitNoFile uint64 `yaml:"rlimit_nofile"`
}
</s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove const currentSchemaVersion = 10
</s> add const currentSchemaVersion = 11 </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") </s> remove if config.RlimitNoFile != 0 {
err = aghos.SetRlimit(config.RlimitNoFile)
if err != nil && !errors.Is(err, aghos.ErrUnsupported) {
return fmt.Errorf("setting rlimit: %w", err)
}
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/config.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // TODO(a.garipov): github.com/kardianos/service doesn't seem to
<mask> // support OpenBSD currently. Either patch it to do so or make
<mask> // our own implementation of the service.System interface.
<mask> if runtime.GOOS == "openbsd" {
<mask> log.Fatal("service actions are not supported on openbsd")
<mask> }
<mask>
<mask> handleServiceControlAction(args, clientBuildFS)
<mask>
<mask> return
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> add // osConfig contains OS-related configuration.
type osConfig struct {
// Group is the name of the group which AdGuard Home must switch to on
// startup. Empty string means no switching.
Group string `yaml:"group"`
// User is the name of the user which AdGuard Home must switch to on
// startup. Empty string means no switching.
User string `yaml:"user"`
// RlimitNoFile is the maximum number of opened fd's per process. Zero
// means use the default value.
RlimitNoFile uint64 `yaml:"rlimit_nofile"`
}
</s> add OSConfig *osConfig `yaml:"os"`
</s> add err = configureOS(&config)
fatalOnError(err)
</s> remove ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
RlimitNoFile uint64 `yaml:"rlimit_nofile"` // Maximum number of opened fd's per process (0: default)
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060
</s> add ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/home.go |
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep | <mask> }
<mask> Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts)
<mask> config.Clients = nil
<mask>
<mask> if config.RlimitNoFile != 0 {
<mask> err = aghos.SetRlimit(config.RlimitNoFile)
<mask> if err != nil && !errors.Is(err, aghos.ErrUnsupported) {
<mask> return fmt.Errorf("setting rlimit: %w", err)
<mask> }
<mask> }
<mask>
<mask> // override bind host/port from the console
<mask> if args.bindHost != nil {
<mask> config.BindHost = args.bindHost
<mask> }
<mask> if args.bindPort != 0 {
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return fmt.Errorf("not supported on Windows")
</s> add return Unsupported("kill") </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> add upgradeSchema10to11, </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> remove return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove const currentSchemaVersion = 10
</s> add const currentSchemaVersion = 11 | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/home.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.