docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
listlengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
req := dnsConfig{} dec := json.NewDecoder(r.Body) if err := dec.Decode(&req); err != nil { httpError(r, w, http.StatusBadRequest, "json Encode: %s", err)
<mask> } <mask> <mask> // nolint(gocyclo) - we need to check each JSON field separately <mask> func (s *Server) handleSetConfig(w http.ResponseWriter, r *http.Request) { <mask> req := dnsConfigJSON{} <mask> js, err := jsonutil.DecodeObject(&req, r.Body) <mask> if err != nil { <mask> httpError(r, w, http.S...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if req.Upstreams != nil { if err := ValidateUpstreams(*req.Upstreams); err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "json.Decode: %s", err) <mask> return <mask> } <mask> <mask> if js.Exists("upstream_dns") { <mask> err = ValidateUpstreams(req.Upstreams) <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) <m...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if errBoot, err := req.checkBootstrap(); err != nil { httpError(r, w, http.StatusBadRequest, "%s can not be used as bootstrap dns cause: %s", errBoot, err) return
<mask> return <mask> } <mask> } <mask> <mask> if js.Exists("bootstrap_dns") { <mask> for _, boot := range req.Bootstraps { <mask> if err := checkBootstrap(boot); err != nil { <mask> httpError(r, w, http.StatusBadRequest, "%s can not be used as bootstrap dns cause: %s", boot, err) <mask> re...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if !req.checkBlockingMode() {
<mask> } <mask> } <mask> } <mask> <mask> if js.Exists("blocking_mode") && !checkBlockingMode(req) { <mask> httpError(r, w, http.StatusBadRequest, "blocking_mode: incorrect value") <mask> return <mask> } <mask> <mask> if js.Exists("upstream_mode") && </s> Pull request: 2271 handle nolint Merge...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if !req.checkUpstreamsMode() {
<mask> httpError(r, w, http.StatusBadRequest, "blocking_mode: incorrect value") <mask> return <mask> } <mask> <mask> if js.Exists("upstream_mode") && <mask> !(req.UpstreamMode == "" || req.UpstreamMode == "fastest_addr" || req.UpstreamMode == "parallel") { <mask> httpError(r, w, http.StatusBadRequest,...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if !req.checkCacheTTL() {
<mask> httpError(r, w, http.StatusBadRequest, "upstream_mode: incorrect value") <mask> return <mask> } <mask> <mask> if req.CacheMinTTL > req.CacheMaxTTL { <mask> httpError(r, w, http.StatusBadRequest, "cache_ttl_min must be less or equal than cache_ttl_max") <mask> return <mask> } <mask> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if s.setConfig(req) { if err := s.Reconfigure(nil); err != nil { httpError(r, w, http.StatusInternalServerError, "%s", err) return } } } func (s *Server) setConfig(dc dnsConfig) (restart bool) {
<mask> httpError(r, w, http.StatusBadRequest, "cache_ttl_min must be less or equal than cache_ttl_max") <mask> return <mask> } <mask> <mask> restart := false <mask> s.Lock() <mask> <mask> if js.Exists("upstream_dns") { <mask> s.conf.UpstreamDNS = req.Upstreams <mask> restart = true </s> Pull re...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.Upstreams != nil { s.conf.UpstreamDNS = *dc.Upstreams
<mask> <mask> restart := false <mask> s.Lock() <mask> <mask> if js.Exists("upstream_dns") { <mask> s.conf.UpstreamDNS = req.Upstreams <mask> restart = true <mask> } <mask> <mask> if js.Exists("upstream_dns_file") { <mask> s.conf.UpstreamDNSFileName = req.UpstreamsFile </s> Pull request: 2271 h...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.UpstreamsFile != nil { s.conf.UpstreamDNSFileName = *dc.UpstreamsFile
<mask> s.conf.UpstreamDNS = req.Upstreams <mask> restart = true <mask> } <mask> <mask> if js.Exists("upstream_dns_file") { <mask> s.conf.UpstreamDNSFileName = req.UpstreamsFile <mask> restart = true <mask> } <mask> <mask> if js.Exists("bootstrap_dns") { <mask> s.conf.BootstrapDNS = req.Bootst...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.Bootstraps != nil { s.conf.BootstrapDNS = *dc.Bootstraps
<mask> s.conf.UpstreamDNSFileName = req.UpstreamsFile <mask> restart = true <mask> } <mask> <mask> if js.Exists("bootstrap_dns") { <mask> s.conf.BootstrapDNS = req.Bootstraps <mask> restart = true <mask> } <mask> <mask> if js.Exists("protection_enabled") { <mask> s.conf.ProtectionEnabled = re...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.ProtectionEnabled != nil { s.conf.ProtectionEnabled = *dc.ProtectionEnabled
<mask> s.conf.BootstrapDNS = req.Bootstraps <mask> restart = true <mask> } <mask> <mask> if js.Exists("protection_enabled") { <mask> s.conf.ProtectionEnabled = req.ProtectionEnabled <mask> } <mask> <mask> if js.Exists("blocking_mode") { <mask> s.conf.BlockingMode = req.BlockingMode <mask> if ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.BlockingMode != nil { s.conf.BlockingMode = *dc.BlockingMode if *dc.BlockingMode == "custom_ip" { s.conf.BlockingIPv4 = *dc.BlockingIPv4 s.conf.BlockingIPAddrv4 = net.ParseIP(*dc.BlockingIPv4) s.conf.BlockingIPv6 = *dc.BlockingIPv6 s.conf.BlockingIPAddrv6 = net.ParseIP(*dc.BlockingIPv6)
<mask> if js.Exists("protection_enabled") { <mask> s.conf.ProtectionEnabled = req.ProtectionEnabled <mask> } <mask> <mask> if js.Exists("blocking_mode") { <mask> s.conf.BlockingMode = req.BlockingMode <mask> if req.BlockingMode == "custom_ip" { <mask> if js.Exists("blocking_ipv4") { <mask> s.c...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.RateLimit != nil { if s.conf.Ratelimit != *dc.RateLimit {
<mask> } <mask> } <mask> } <mask> <mask> if js.Exists("ratelimit") { <mask> if s.conf.Ratelimit != req.RateLimit { <mask> restart = true <mask> } <mask> s.conf.Ratelimit = req.RateLimit <mask> } <mask> </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolin...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
s.conf.Ratelimit = *dc.RateLimit
<mask> if js.Exists("ratelimit") { <mask> if s.conf.Ratelimit != req.RateLimit { <mask> restart = true <mask> } <mask> s.conf.Ratelimit = req.RateLimit <mask> } <mask> <mask> if js.Exists("edns_cs_enabled") { <mask> s.conf.EnableEDNSClientSubnet = req.EDNSCSEnabled <mask> restart = true </s>...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.EDNSCSEnabled != nil { s.conf.EnableEDNSClientSubnet = *dc.EDNSCSEnabled
<mask> } <mask> s.conf.Ratelimit = req.RateLimit <mask> } <mask> <mask> if js.Exists("edns_cs_enabled") { <mask> s.conf.EnableEDNSClientSubnet = req.EDNSCSEnabled <mask> restart = true <mask> } <mask> <mask> if js.Exists("dnssec_enabled") { <mask> s.conf.EnableDNSSEC = req.DNSSECEnabled </s>...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.DNSSECEnabled != nil { s.conf.EnableDNSSEC = *dc.DNSSECEnabled
<mask> s.conf.EnableEDNSClientSubnet = req.EDNSCSEnabled <mask> restart = true <mask> } <mask> <mask> if js.Exists("dnssec_enabled") { <mask> s.conf.EnableDNSSEC = req.DNSSECEnabled <mask> } <mask> <mask> if js.Exists("disable_ipv6") { <mask> s.conf.AAAADisabled = req.DisableIPv6 <mask> } </s...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.DisableIPv6 != nil { s.conf.AAAADisabled = *dc.DisableIPv6
<mask> if js.Exists("dnssec_enabled") { <mask> s.conf.EnableDNSSEC = req.DNSSECEnabled <mask> } <mask> <mask> if js.Exists("disable_ipv6") { <mask> s.conf.AAAADisabled = req.DisableIPv6 <mask> } <mask> <mask> if js.Exists("cache_size") { <mask> s.conf.CacheSize = req.CacheSize <mask> restart =...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.CacheSize != nil { s.conf.CacheSize = *dc.CacheSize
<mask> if js.Exists("disable_ipv6") { <mask> s.conf.AAAADisabled = req.DisableIPv6 <mask> } <mask> <mask> if js.Exists("cache_size") { <mask> s.conf.CacheSize = req.CacheSize <mask> restart = true <mask> } <mask> <mask> if js.Exists("cache_ttl_min") { <mask> s.conf.CacheMinTTL = req.CacheMinTT...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.CacheMinTTL != nil { s.conf.CacheMinTTL = *dc.CacheMinTTL
<mask> s.conf.CacheSize = req.CacheSize <mask> restart = true <mask> } <mask> <mask> if js.Exists("cache_ttl_min") { <mask> s.conf.CacheMinTTL = req.CacheMinTTL <mask> restart = true <mask> } <mask> <mask> if js.Exists("cache_ttl_max") { <mask> s.conf.CacheMaxTTL = req.CacheMaxTTL </s> Pull ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.CacheMaxTTL != nil { s.conf.CacheMaxTTL = *dc.CacheMaxTTL
<mask> s.conf.CacheMinTTL = req.CacheMinTTL <mask> restart = true <mask> } <mask> <mask> if js.Exists("cache_ttl_max") { <mask> s.conf.CacheMaxTTL = req.CacheMaxTTL <mask> restart = true <mask> } <mask> <mask> if js.Exists("upstream_mode") { <mask> s.conf.FastestAddr = false </s> Pull reques...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
if dc.UpstreamMode != nil { switch *dc.UpstreamMode {
<mask> s.conf.CacheMaxTTL = req.CacheMaxTTL <mask> restart = true <mask> } <mask> <mask> if js.Exists("upstream_mode") { <mask> s.conf.FastestAddr = false <mask> s.conf.AllServers = false <mask> switch req.UpstreamMode { <mask> case "": <mask> // <mask> <mask> case "parallel": <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
s.conf.FastestAddr = false
<mask> // <mask> <mask> case "parallel": <mask> s.conf.AllServers = true <mask> <mask> case "fastest_addr": <mask> s.conf.FastestAddr = true <mask> } <mask> } <mask> </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to master Closes #2271. Squashed ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
s.conf.AllServers = false
<mask> s.conf.FastestAddr = false <mask> case "fastest_addr": <mask> s.conf.FastestAddr = true <mask> default: <mask> s.conf.AllServers = false <mask> s.conf.FastestAddr = false <mask> } <mask> } </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to mast...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
default: s.conf.AllServers = false s.conf.FastestAddr = false
<mask> case "fastest_addr": <mask> s.conf.AllServers = false <mask> s.conf.FastestAddr = true <mask> } <mask> } <mask> s.Unlock() <mask> s.conf.ConfigModified() <mask> return restart </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to master Closes #2271. ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
return restart
<mask> } <mask> <mask> s.Unlock() <mask> s.conf.ConfigModified() <mask> <mask> if restart { <mask> err = s.Reconfigure(nil) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "%s", err) <mask> return <mask> } <mask> } <mask> } <mask> <mask> type upstreamJSON...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http.go
want: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec...
<mask> name: "all_right", <mask> conf: func() ServerConfig { <mask> return defaultConf <mask> }, <mask> want: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
want: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec...
<mask> conf := defaultConf <mask> conf.FastestAddr = true <mask> return conf <mask> }, <mask> want: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelim...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
want: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec...
<mask> conf := defaultConf <mask> conf.AllServers = true <mask> return conf <mask> }, <mask> want: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimi...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
const defaultConfJSON = "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled...
<mask> }() <mask> <mask> w := httptest.NewRecorder() <mask> <mask> const defaultConfJSON = "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
wantGet: "{\"upstream_dns\":[\"8.8.8.8:77\",\"8.8.4.4:77\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dns...
<mask> }{{ <mask> name: "upstream_dns", <mask> req: "{\"upstream_dns\":[\"8.8.8.8:77\",\"8.8.4.4:77\"]}", <mask> wantSet: "", <mask> wantGet: "{\"upstream_dns\":[\"8.8.8.8:77\",\"8.8.4.4:77\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::f...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_...
<mask> }, { <mask> name: "bootstraps", <mask> req: "{\"bootstrap_dns\":[\"9.9.9.10\"]}", <mask> wantSet: "", <mask> wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"refused\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":fals...
<mask> }, { <mask> name: "blocking_mode_good", <mask> req: "{\"blocking_mode\":\"refused\"}", <mask> wantSet: "", <mask> wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"pr...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dns...
<mask> }, { <mask> name: "blocking_mode_bad", <mask> req: "{\"blocking_mode\":\"custom_ip\"}", <mask> wantSet: "blocking_mode: incorrect value\n", <mask> wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":6,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dns...
<mask> }, { <mask> name: "ratelimit", <mask> req: "{\"ratelimit\":6}", <mask> wantSet: "", <mask> wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":true,\"dnss...
<mask> }, { <mask> name: "edns_cs_enabled", <mask> req: "{\"edns_cs_enabled\":true}", <mask> wantSet: "", <mask> wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dns...
<mask> }, { <mask> name: "dnssec_enabled", <mask> req: "{\"dnssec_enabled\":true}", <mask> wantSet: "", <mask> wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_e...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dns...
<mask> }, { <mask> name: "cache_size", <mask> req: "{\"cache_size\":1024}", <mask> wantSet: "", <mask> wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\"...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dns...
<mask> }, { <mask> name: "upstream_mode_parallel", <mask> req: "{\"upstream_mode\":\"parallel\"}", <mask> wantSet: "", <mask> wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"]...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dns...
<mask> }, { <mask> name: "upstream_mode_fastest_addr", <mask> req: "{\"upstream_mode\":\"fastest_addr\"}", <mask> wantSet: "", <mask> wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/dnsforward/dnsforward_http_test.go
"crypto/rand"
<mask> package home <mask> <mask> import ( <mask> "crypto/sha256" <mask> "encoding/binary" <mask> "encoding/hex" <mask> "encoding/json" </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to master Closes #2271. Squashed commit of the following: commit fde5c8795ac79e...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
"math" "math/big"
<mask> "encoding/binary" <mask> "encoding/hex" <mask> "encoding/json" <mask> "fmt" <mask> "math/rand" <mask> "net/http" <mask> "strings" <mask> "sync" <mask> "time" <mask> </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to master Closes #2271. Squashed com...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
<mask> <mask> a := Auth{} <mask> a.sessionTTL = sessionTTL <mask> a.sessions = make(map[string]*session) <mask> rand.Seed(time.Now().UTC().Unix()) <mask> var err error <mask> a.db, err = bbolt.Open(dbFilename, 0o644, nil) <mask> if err != nil { <mask> log.Error("Auth: open DB: %s: %s", dbFilename, er...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
func getSession(u *User) ([]byte, error) { maxSalt := big.NewInt(math.MaxUint32) salt, err := rand.Int(rand.Reader, maxSalt) if err != nil { return nil, err } d := []byte(fmt.Sprintf("%s%s%s", salt, u.Name, u.PasswordHash))
<mask> Name string `json:"name"` <mask> Password string `json:"password"` <mask> } <mask> <mask> func getSession(u *User) []byte { <mask> // the developers don't currently believe that using a <mask> // non-cryptographic RNG for the session hash salt is <mask> // insecure <mask> salt := rand.Uint32(...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
return hash[:], nil
<mask> // insecure <mask> salt := rand.Uint32() //nolint:gosec <mask> d := []byte(fmt.Sprintf("%d%s%s", salt, u.Name, u.PasswordHash)) <mask> hash := sha256.Sum256(d) <mask> return hash[:] <mask> } <mask> <mask> func (a *Auth) httpCookie(req loginJSON) string { <mask> u := a.UserFind(req.Name, req.Passw...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
func (a *Auth) httpCookie(req loginJSON) (string, error) {
<mask> hash := sha256.Sum256(d) <mask> return hash[:] <mask> } <mask> <mask> func (a *Auth) httpCookie(req loginJSON) string { <mask> u := a.UserFind(req.Name, req.Password) <mask> if len(u.Name) == 0 { <mask> return "" <mask> } <mask> </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
return "", nil
<mask> <mask> func (a *Auth) httpCookie(req loginJSON) string { <mask> u := a.UserFind(req.Name, req.Password) <mask> if len(u.Name) == 0 { <mask> return "" <mask> } <mask> <mask> sess := getSession(&u) <mask> <mask> now := time.Now().UTC() </s> Pull request: 2271 handle nolint Merge in DNS/adguar...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
sess, err := getSession(&u) if err != nil { return "", err }
<mask> if len(u.Name) == 0 { <mask> return "" <mask> } <mask> <mask> sess := getSession(&u) <mask> <mask> now := time.Now().UTC() <mask> expire := now.Add(cookieTTL * time.Hour) <mask> expstr := expire.Format(time.RFC1123) <mask> expstr = expstr[:len(expstr)-len("UTC")] // "UTC" -> "GMT" </s> Pull...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
sessionCookieName, hex.EncodeToString(sess), expstr), nil
<mask> s.expire = uint32(now.Unix()) + a.sessionTTL <mask> a.addSession(sess, &s) <mask> <mask> return fmt.Sprintf("%s=%s; Path=/; HttpOnly; Expires=%s", <mask> sessionCookieName, hex.EncodeToString(sess), expstr) <mask> } <mask> <mask> func handleLogin(w http.ResponseWriter, r *http.Request) { <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
cookie, err := Context.auth.httpCookie(req) if err != nil { httpError(w, http.StatusBadRequest, "crypto rand reader: %s", err) return }
<mask> httpError(w, http.StatusBadRequest, "json decode: %s", err) <mask> return <mask> } <mask> <mask> cookie := Context.auth.httpCookie(req) <mask> if len(cookie) == 0 { <mask> log.Info("Auth: invalid user name or password: name=%q", req.Name) <mask> time.Sleep(1 * time.Second) <mask> http.Erro...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
// optionalAuthThird return true if user should authenticate first. func optionalAuthThird(w http.ResponseWriter, r *http.Request) (authFirst bool) { authFirst = false // redirect to login page if not authenticated ok := false cookie, err := r.Cookie(sessionCookieName) if glProcessCookie(r) { log.Debug("Auth: ...
<mask> } <mask> return "" <mask> } <mask> <mask> // nolint(gocyclo) <mask> func optionalAuth(handler func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) { <mask> return func(w http.ResponseWriter, r *http.Request) { <mask> if r.URL.Path == "/login.html" { <mask> // redir...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
if optionalAuthThird(w, r) {
<mask> strings.HasPrefix(r.URL.Path, "/login.") { <mask> // process as usual <mask> // no additional auth requirements <mask> } else if Context.auth != nil && Context.auth.AuthRequired() { <mask> // redirect to login page if not authenticated <mask> ok := false <mask> cookie, err := r.Cookie(...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth.go
sess, err := getSession(&users[0]) assert.Nil(t, err)
<mask> <mask> assert.True(t, a.CheckSession("notfound") == -1) <mask> a.RemoveSession("notfound") <mask> <mask> sess := getSession(&users[0]) <mask> sessStr := hex.EncodeToString(sess) <mask> <mask> now := time.Now().UTC().Unix() <mask> // check expiration <mask> s.expire = uint32(now) </s> Pull re...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth_test.go
cookie, err := Context.auth.httpCookie(loginJSON{Name: "name", Password: "password"}) assert.Nil(t, err)
<mask> handler2(&w, &r) <mask> assert.True(t, handlerCalled) <mask> <mask> // perform login <mask> cookie := Context.auth.httpCookie(loginJSON{Name: "name", Password: "password"}) <mask> assert.True(t, cookie != "") <mask> <mask> // get / <mask> handler2 = optionalAuth(handler) <mask> w.hdr = make(h...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/auth_test.go
<mask> func isRunning() bool { <mask> return Context.dnsServer != nil && Context.dnsServer.IsRunning() <mask> } <mask> <mask> // nolint (gocyclo) <mask> // Return TRUE if IP is within public Internet IP range <mask> func isPublicIP(ip net.IP) bool { <mask> ip4 := ip.To4() <mask> if ip4 != nil { <mask> s...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/dns.go
if !Context.ipDetector.detectSpecialNetwork(ipAddr) {
<mask> ipAddr := net.ParseIP(ip) <mask> if !ipAddr.IsLoopback() { <mask> Context.rdns.Begin(ip) <mask> } <mask> if isPublicIP(ipAddr) { <mask> Context.whois.Begin(ip) <mask> } <mask> } <mask> <mask> func generateServerConfig() dnsforward.ServerConfig { </s> Pull request: 2271 handle nolint Merge i...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/dns.go
if !Context.ipDetector.detectSpecialNetwork(ipAddr) {
<mask> ipAddr := net.ParseIP(ip) <mask> if !ipAddr.IsLoopback() { <mask> Context.rdns.Begin(ip) <mask> } <mask> if isPublicIP(ipAddr) { <mask> Context.whois.Begin(ip) <mask> } <mask> } <mask> <mask> return nil </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handl...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/dns.go
"net/http"
<mask> "hash/crc32" <mask> "io" <mask> "io/ioutil" <mask> "os" <mask> "path/filepath" <mask> "regexp" <mask> "strconv" <mask> "strings" <mask> "sync" </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to master Closes #2271. Squashed commit of the following: c...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/filter.go
func (f *Filtering) read(reader io.Reader, tmpFile *os.File, filter *filter) (int, error) {
<mask> } <mask> return b, err <mask> } <mask> <mask> // nolint(gocyclo) <mask> func (f *Filtering) updateIntl(filter *filter) (bool, error) { <mask> log.Tracef("Downloading update for filter %d from %s", filter.ID, filter.URL) <mask> <mask> tmpFile, err := ioutil.TempFile(filepath.Join(Context.getDataDir...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/filter.go
return total, fmt.Errorf("data contains non-printable characters")
<mask> firstChunkLen += copied <mask> <mask> if firstChunkLen == len(firstChunk) || err == io.EOF { <mask> if !isPrintableText(firstChunk, firstChunkLen) { <mask> return false, fmt.Errorf("data contains non-printable characters") <mask> } <mask> <mask> s := strings.ToLower(string(firstC...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/filter.go
return total, fmt.Errorf("data is HTML, not plain text")
<mask> } <mask> <mask> s := strings.ToLower(string(firstChunk)) <mask> if strings.Contains(s, "<html") || strings.Contains(s, "<!doctype") { <mask> return false, fmt.Errorf("data is HTML, not plain text") <mask> } <mask> <mask> htmlTest = false <mask> firstChunk = nil <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/filter.go
return total, err2
<mask> } <mask> <mask> _, err2 := tmpFile.Write(buf[:n]) <mask> if err2 != nil { <mask> return false, err2 <mask> } <mask> <mask> if err == io.EOF { <mask> break <mask> } </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to master Closes #2271. Squ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/filter.go
return total, nil
<mask> return false, err2 <mask> } <mask> <mask> if err == io.EOF { <mask> break <mask> } <mask> if err != nil { <mask> log.Printf("Couldn't fetch filter contents from URL %s, skipping: %s", filter.URL, err) <mask> return false, err <mask> } </s> Pull request: 2271 handle nolint Merge...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/filter.go
return total, err } } } // updateIntl returns true if filter update performed successfully. func (f *Filtering) updateIntl(filter *filter) (updated bool, err error) { updated = false log.Tracef("Downloading update for filter %d from %s", filter.ID, filter.URL) tmpFile, err := ioutil.TempFile(filepath.Join(Co...
<mask> break <mask> } <mask> if err != nil { <mask> log.Printf("Couldn't fetch filter contents from URL %s, skipping: %s", filter.URL, err) <mask> return false, err <mask> } <mask> } <mask> <mask> // Extract filter name and count number of rules <mask> _, _ = tmpFile.Seek(0, io.SeekStart) ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/filter.go
return updated, nil
<mask> rulesCount, checksum, filterName := f.parseFilterContents(tmpFile) <mask> // Check if the filter has been really changed <mask> if filter.checksum == checksum { <mask> log.Tracef("Filter #%d at URL %s hasn't changed, not updating it", filter.ID, filter.URL) <mask> return false, nil <mask> } <mask>...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/filter.go
return updated, err
<mask> // Closing the file before renaming it is necessary on Windows <mask> _ = tmpFile.Close() <mask> err = os.Rename(tmpFile.Name(), filterFilePath) <mask> if err != nil { <mask> return false, err <mask> } <mask> tmpFile = nil <mask> <mask> return true, nil <mask> } </s> Pull request: 2271 handl...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/filter.go
updated = true
<mask> return updated, err <mask> } <mask> tmpFile = nil <mask> <mask> return updated, nil <mask> } <mask> <mask> // loads filter contents from the file in dataDir </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to master Closes #2271. Squashed commit of the fo...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/filter.go
return updated, nil
<mask> return false, err <mask> } <mask> tmpFile = nil <mask> <mask> return true, nil <mask> } <mask> <mask> // loads filter contents from the file in dataDir <mask> func (f *Filtering) load(filter *filter) error { <mask> filterFilePath := filter.Path() </s> Pull request: 2271 handle nolint Merge in...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/filter.go
ipDetector *ipDetector
<mask> tls *TLSMod // TLS module <mask> autoHosts util.AutoHosts // IP-hostname pairs taken from system configuration (e.g. /etc/hosts) files <mask> updater *update.Updater <mask> <mask> // Runtime properties <mask> // -- <mask> <mask> configFilename string // Config file...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/home.go
func setupContext(args options) {
<mask> } <mask> return fmt.Sprintf(msg, versionString, updateChannel, runtime.GOOS, runtime.GOARCH) <mask> } <mask> <mask> // run initializes configuration and runs the AdGuard Home <mask> // run is a blocking method! <mask> // nolint <mask> func run(args options) { <mask> // configure config filename <ma...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/home.go
RootCAs: Context.tlsRoots, MinVersion: tls.VersionTLS12,
<mask> Context.transport = &http.Transport{ <mask> DialContext: customDialContext, <mask> Proxy: getHTTPProxy, <mask> TLSClientConfig: &tls.Config{ <mask> RootCAs: Context.tlsRoots, <mask> }, <mask> } <mask> Context.client = &http.Client{ <mask> Timeout: time.Minute * 5, <mask> Trans...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/home.go
}
<mask> } <mask> } <mask> <mask> func setupConfig(args options) { <mask> config.DHCP.WorkDir = Context.workDir <mask> config.DHCP.HTTPRegister = httpRegister </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to master Closes #2271. Squashed commit of the following: ...
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/home.go
func setupConfig(args options) {
<mask> os.Exit(0) <mask> } <mask> } <mask> <mask> // 'clients' module uses 'dnsfilter' module's static data (dnsfilter.BlockedSvcKnown()), <mask> // so we have to initialize dnsfilter's static data first, <mask> // but also avoid relying on automatic Go init() function <mask> dnsfilter.InitModule()...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/home.go
Context.ipDetector, err = newIPDetector() if err != nil { log.Fatal(err) }
<mask> _ = Context.dhcpServer.Start() <mask> } <mask> } <mask> <mask> Context.web.Start() <mask> <mask> // wait indefinitely for other go-routines to complete their job <mask> select {} <mask> } </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to master Clos...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/home/home.go
"encoding/json"
<mask> package querylog <mask> <mask> import ( <mask> "encoding/base64" <mask> "strconv" <mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" <mask> "github.com/AdguardTeam/golibs/log" </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home fro...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/querylog/decode.go
var logEntryHandlers = map[string](func(t json.Token, ent *logEntry) error){ "IP": func(t json.Token, ent *logEntry) error { v, ok := t.(string) if !ok { return nil } if len(ent.IP) == 0 { ent.IP = v } return nil }, "T": func(t json.Token, ent *logEntry) error { v, ok := t.(string) if !ok { ...
<mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> // decodeLogEntry - decodes query log entry from a line <mask> // nolint (gocyclo) <mask> func decodeLogEntry(ent *logEntry, str string) { <mask> var b bool <mask> var i int <mask> var err error <mask> for ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/querylog/decode.go
func decodeLogEntry(ent *logEntry, str string) { dec := json.NewDecoder(strings.NewReader(str)) for dec.More() { keyToken, err := dec.Token()
<mask> return err <mask> }, <mask> } <mask> <mask> if err != nil { <mask> log.Debug("decodeLogEntry err: %s", err) <mask> return <mask> } </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to master Closes #2271. Squashed commit of the following: commit fd...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/querylog/decode.go
return } if _, ok := keyToken.(json.Delim); ok { continue } key := keyToken.(string) handler, ok := logEntryHandlers[key] value, err := dec.Token() if err != nil { return } if ok { if err := handler(value, ent); err != nil { log.Debug("decodeLogEntry err: %s", err) return }
<mask> } <mask> <mask> if err != nil { <mask> log.Debug("decodeLogEntry err: %s", err) <mask> break <mask> } <mask> } <mask> } <mask> <mask> // Get value from "key":"value" </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handle-nolint to master Closes #2271. Squash...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/querylog/decode.go
<mask> } <mask> end := start + i <mask> return s[start:end] <mask> } <mask> <mask> const ( <mask> jsonTErr = iota <mask> jsonTObj <mask> jsonTStr <mask> jsonTNum <mask> jsonTBool <mask> ) <mask> <mask> // Parse JSON key-value pair <mask> // e.g.: "key":VALUE where VALUE is "string", true|false...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/querylog/decode.go
<mask> logOutput.Reset() <mask> }) <mask> } <mask> } <mask> <mask> func TestJSON(t *testing.T) { <mask> s := ` <mask> {"keystr":"val","obj":{"keybool":true,"keyint":123456}} <mask> ` <mask> k, v, jtype := readJSON(&s) <mask> assert.Equal(t, jtype, int32(jsonTStr)) <mask> assert.Equal(t, "keystr...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/querylog/decode_test.go
<mask> return false <mask> } <mask> <mask> // match - checks if the log entry matches this search criteria <mask> // nolint (gocyclo) <mask> func (c *searchCriteria) match(entry *logEntry) bool { <mask> switch c.criteriaType { <mask> case ctDomainOrClient: <mask> qhost := strings.ToLower(entry.QHost) <m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/querylog/search_criteria.go
return c.ctDomainOrClientCase(entry) case ctFilteringStatus: return c.ctFilteringStatusCase(entry.Result) }
<mask> // nolint (gocyclo) <mask> func (c *searchCriteria) match(entry *logEntry) bool { <mask> switch c.criteriaType { <mask> case ctDomainOrClient: <mask> qhost := strings.ToLower(entry.QHost) <mask> searchVal := strings.ToLower(c.value) <mask> if c.strict && qhost == searchVal { <mask> return true...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/querylog/search_criteria.go
return false }
<mask> if !c.strict && strings.Contains(entry.IP, c.value) { <mask> return true <mask> } <mask> <mask> return false <mask> <mask> case ctFilteringStatus: <mask> res := entry.Result <mask> <mask> switch c.value { </s> Pull request: 2271 handle nolint Merge in DNS/adguard-home from 2271-handl...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/querylog/search_criteria.go
func (c *searchCriteria) ctDomainOrClientCase(entry *logEntry) bool { qhost := strings.ToLower(entry.QHost) searchVal := strings.ToLower(c.value) if c.strict && qhost == searchVal { return true } if !c.strict && strings.Contains(qhost, searchVal) { return true
<mask> } <mask> <mask> return false <mask> <mask> case ctFilteringStatus: <mask> res := entry.Result <mask> <mask> switch c.value { <mask> case filteringStatusAll: <mask> return true <mask> case filteringStatusFiltered: <mask> return res.IsFiltered || <mask> res.Reason == dnsfilte...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/querylog/search_criteria.go
if c.strict && entry.IP == c.value { return true } if !c.strict && strings.Contains(entry.IP, c.value) { return true }
<mask> if !c.strict && strings.Contains(qhost, searchVal) { <mask> return true <mask> } <mask> <mask> return false <mask> } <mask> <mask> func (c *searchCriteria) ctFilteringStatusCase(res dnsfilter.Result) bool { <mask> switch c.value { <mask> case filteringStatusAll: </s> Pull request: 2271 handle...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/querylog/search_criteria.go
<mask> * safesearch-blocked <mask> * parental-blocked <mask> These values are just the sum of data for all units. <mask> */ <mask> // nolint (gocyclo) <mask> func (s *statsCtx) getData() map[string]interface{} { <mask> limit := s.conf.limit <mask> <mask> d := map[string]interface{}{} <mask> timeUnit...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
statsCollector := func(numsGetter func(u *unitDB) (num uint64)) (nums []uint64) { if timeUnit == Hours { for _, u := range units { nums = append(nums, numsGetter(u))
<mask> <mask> // 720 hours may span 31 days, so we skip data for the first day in this case <mask> firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24) <mask> <mask> a := []uint64{} <mask> if timeUnit == Hours { <mask> for _, u := range units { <mask> a = append(a, u.NTotal) <mask> } <mas...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
} else { var sum uint64 id := firstDayID nextDayID := firstDayID + 24 for i := int(firstDayID - firstID); i != len(units); i++ { sum += numsGetter(units[i]) if id == nextDayID { nums = append(nums, sum) sum = 0 nextDayID += 24 } id++
<mask> a = append(a, sum) <mask> sum = 0 <mask> nextDayID += 24 <mask> } <mask> id++ <mask> } <mask> if id <= nextDayID { <mask> a = append(a, sum) <mask> } <mask> if len(a) != int(limit/24) { <mask> log.Fatalf("len(a) != limit: %d %d", len(a), limit) <mask> } <mask> } <...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
if id <= nextDayID { nums = append(nums, sum)
<mask> a = append(a, sum) <mask> sum = 0 <mask> nextDayID += 24 <mask> } <mask> id++ <mask> } <mask> if id <= nextDayID { <mask> a = append(a, sum) <mask> } <mask> } <mask> d["blocked_filtering"] = a <mask> <mask> a = []uint64{} <mask> if timeUnit == Hours { <mask> for _...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
<mask> a = append(a, sum) <mask> sum = 0 <mask> nextDayID += 24 <mask> } <mask> id++ <mask> } <mask> if id <= nextDayID { <mask> a = append(a, sum) <mask> } <mask> } <mask> d["replaced_safebrowsing"] = a <mask> <mask> a = []uint64{} </s> Pull request: 2271 handle nolint Mer...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
return nums
<mask> if id <= nextDayID { <mask> nums = append(nums, sum) <mask> } <mask> } <mask> } <mask> <mask> topsCollector := func(max int, pairsGetter func(u *unitDB) (pairs []countPair)) []map[string]uint64 { <mask> m := map[string]uint64{} <mask> for _, u := range units { </s> Pull request: 2271...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
<mask> if id <= nextDayID { <mask> a = append(a, sum) <mask> } <mask> } <mask> d["replaced_safebrowsing"] = a <mask> <mask> a = []uint64{} <mask> if timeUnit == Hours { <mask> for _, u := range units { <mask> a = append(a, u.NResult[RParental]) </s> Pull request: 2271 handle nolint Merge in...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
topsCollector := func(max int, pairsGetter func(u *unitDB) (pairs []countPair)) []map[string]uint64 { m := map[string]uint64{}
<mask> } <mask> } <mask> d["replaced_safebrowsing"] = a <mask> <mask> a = []uint64{} <mask> if timeUnit == Hours { <mask> for _, u := range units { <mask> a = append(a, u.NResult[RParental]) <mask> } <mask> } else { <mask> var sum uint64 </s> Pull request: 2271 handle nolint Merge in DNS/a...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
for _, it := range pairsGetter(u) { m[it.Name] += it.Count
<mask> <mask> a = []uint64{} <mask> if timeUnit == Hours { <mask> for _, u := range units { <mask> a = append(a, u.NResult[RParental]) <mask> } <mask> } else { <mask> var sum uint64 <mask> id := firstDayID <mask> nextDayID := firstDayID + 24 <mask> for i := firstDayID - firstID; int(i) != ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
<mask> a = append(a, sum) <mask> sum = 0 <mask> nextDayID += 24 <mask> } <mask> id++ <mask> } <mask> if id <= nextDayID { <mask> a = append(a, sum) <mask> } <mask> } <mask> d["replaced_parental"] = a <mask> <mask> // top counters: </s> Pull request: 2271 handle nolint Merge...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
a2 := convertMapToArray(m, max) return convertTopArray(a2)
<mask> for _, it := range pairsGetter(u) { <mask> m[it.Name] += it.Count <mask> } <mask> } <mask> } <mask> <mask> dnsQueries := statsCollector(func(u *unitDB) (num uint64) { return u.NTotal }) <mask> if timeUnit != Hours && len(dnsQueries) != int(limit/24) { <mask> log.Fatalf("len(dnsQueries)...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
<mask> if id <= nextDayID { <mask> a = append(a, sum) <mask> } <mask> } <mask> d["replaced_parental"] = a <mask> <mask> // top counters: <mask> <mask> m := map[string]uint64{} <mask> for _, u := range units { <mask> for _, it := range u.Domains { <mask> m[it.Name] += it.Count </s> Pull r...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
dnsQueries := statsCollector(func(u *unitDB) (num uint64) { return u.NTotal }) if timeUnit != Hours && len(dnsQueries) != int(limit/24) { log.Fatalf("len(dnsQueries) != limit: %d %d", len(dnsQueries), limit)
<mask> d["replaced_parental"] = a <mask> <mask> // top counters: <mask> <mask> m := map[string]uint64{} <mask> for _, u := range units { <mask> for _, it := range u.Domains { <mask> m[it.Name] += it.Count <mask> } <mask> } <mask> a2 := convertMapToArray(m, maxDomains) <mask> d["top_queried_d...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
<mask> for _, it := range u.Domains { <mask> m[it.Name] += it.Count <mask> } <mask> } <mask> a2 := convertMapToArray(m, maxDomains) <mask> d["top_queried_domains"] = convertTopArray(a2) <mask> <mask> m = map[string]uint64{} <mask> for _, u := range units { <mask> for _, it := range u.BlockedDom...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
statsData := map[string]interface{}{ "dns_queries": dnsQueries, "blocked_filtering": statsCollector(func(u *unitDB) (num uint64) { return u.NResult[RFiltered] }), "replaced_safebrowsing": statsCollector(func(u *unitDB) (num uint64) { return u.NResult[RSafeBrowsing] }), "replaced_parental": st...
<mask> } <mask> a2 := convertMapToArray(m, maxDomains) <mask> d["top_queried_domains"] = convertTopArray(a2) <mask> <mask> m = map[string]uint64{} <mask> for _, u := range units { <mask> for _, it := range u.BlockedDomains { <mask> m[it.Name] += it.Count <mask> } <mask> } <mask> a2 = convertMa...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go
<mask> for _, it := range u.BlockedDomains { <mask> m[it.Name] += it.Count <mask> } <mask> } <mask> a2 = convertMapToArray(m, maxDomains) <mask> d["top_blocked_domains"] = convertTopArray(a2) <mask> <mask> m = map[string]uint64{} <mask> for _, u := range units { <mask> for _, it := range u.Clie...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4
internal/stats/stats_unit.go