docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
sequencelengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
// UseDNS64 defines if DNS64 is enabled for incoming requests. UseDNS64 bool
<mask> // locally-served networks should be resolved via private PTR resolvers. <mask> UsePrivateRDNS bool <mask> <mask> // ServeHTTP3 defines if HTTP/3 is be allowed for incoming requests. <mask> ServeHTTP3 bool <mask> <mask> // UseHTTP3Upstreams defines if HTTP/3 is be allowed for DNS-over-HTTPS </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // isLocalClient shows if client's IP address is from locally-served </s> add // isLocalClient shows if client's IP address is from locally served </s> remove // assume that all the DHCP leases we give are locally-served or at least // don't need to be accessible externally. </s> add // assume that all the DHCP leases we give are locally served or at least // shouldn't be accessible externally.
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/config.go
// unreversedReqIP stores an IP address obtained from a PTR request if it // was parsed successfully and belongs to one of the locally served IP // ranges. It is also filled with unmapped version of the address if it's // within DNS64 prefixes.
<mask> // origResp is the response received from upstream. It is set when the <mask> // response is modified by filters. <mask> origResp *dns.Msg <mask> <mask> // unreversedReqIP stores an IP address obtained from PTR request if it <mask> // parsed successfully and belongs to one of locally-served IP ranges as per <mask> // RFC 6303. <mask> unreversedReqIP net.IP <mask> <mask> // err is the error returned from a processing function. <mask> err error <mask> </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // isLocalClient shows if client's IP address is from locally-served </s> add // isLocalClient shows if client's IP address is from locally served </s> remove // the server. </s> add // the server. It responds with a mapped IP address if the DNS64 is enabled and // the request is for AAAA. </s> remove // processDetermineLocal determines if the client's IP address is from // locally-served network and saves the result into the context. </s> add // processDetermineLocal determines if the client's IP address is from locally // served network and saves the result into the context. </s> remove // code is only executed when the request is for locally-served ARPA </s> add // code is only executed when the request is for locally served ARPA
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
// isLocalClient shows if client's IP address is from locally served
<mask> <mask> // responseAD shows if the response had the AD bit set. <mask> responseAD bool <mask> <mask> // isLocalClient shows if client's IP address is from locally-served <mask> // network. <mask> isLocalClient bool <mask> } <mask> <mask> // resultCode is the result of a request processing function. </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // unreversedReqIP stores an IP address obtained from PTR request if it // parsed successfully and belongs to one of locally-served IP ranges as per // RFC 6303. </s> add // unreversedReqIP stores an IP address obtained from a PTR request if it // was parsed successfully and belongs to one of the locally served IP // ranges. It is also filled with unmapped version of the address if it's // within DNS64 prefixes. </s> remove // processDetermineLocal determines if the client's IP address is from // locally-served network and saves the result into the context. </s> add // processDetermineLocal determines if the client's IP address is from locally // served network and saves the result into the context. </s> remove // the server. </s> add // the server. It responds with a mapped IP address if the DNS64 is enabled and // the request is for AAAA.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
// processRecursion checks the incoming request and halts its handling by // answering NXDOMAIN if s has tried to resolve it recently.
<mask> <mask> return nil <mask> } <mask> <mask> // processRecursion checks the incoming request and halts it's handling if s <mask> // have tried to resolve it recently. <mask> func (s *Server) processRecursion(dctx *dnsContext) (rc resultCode) { <mask> pctx := dctx.proxyCtx <mask> <mask> if msg := pctx.Req; msg != nil && s.recDetector.check(*msg) { <mask> log.Debug("recursion detected resolving %q", msg.Question[0].Name) </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // the server. </s> add // the server. It responds with a mapped IP address if the DNS64 is enabled and // the request is for AAAA. </s> remove // in locally-served network from external clients. </s> add // in locally served network from external clients. </s> remove // processDetermineLocal determines if the client's IP address is from // locally-served network and saves the result into the context. </s> add // processDetermineLocal determines if the client's IP address is from locally // served network and saves the result into the context. </s> remove if !webRegistered && s.conf.HTTPRegister != nil { webRegistered = true s.registerHandlers() </s> add s.registerHandlers() err = s.setupDNS64() if err != nil { return fmt.Errorf("preparing DNS64: %w", err) </s> remove if req.AuthenticatedData { origReqAD = true } else { </s> add origReqAD = req.AuthenticatedData if !req.AuthenticatedData {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
// processDetermineLocal determines if the client's IP address is from locally // served network and saves the result into the context.
<mask> <mask> return resp <mask> } <mask> <mask> // processDetermineLocal determines if the client's IP address is from <mask> // locally-served network and saves the result into the context. <mask> func (s *Server) processDetermineLocal(dctx *dnsContext) (rc resultCode) { <mask> rc = resultCodeSuccess <mask> <mask> var ip net.IP <mask> if ip, _ = netutil.IPAndPortFromAddr(dctx.proxyCtx.Addr); ip == nil { </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // the server. </s> add // the server. It responds with a mapped IP address if the DNS64 is enabled and // the request is for AAAA. </s> remove // in locally-served network from external clients. </s> add // in locally served network from external clients. </s> remove // processRecursion checks the incoming request and halts it's handling if s // have tried to resolve it recently. </s> add // processRecursion checks the incoming request and halts its handling by // answering NXDOMAIN if s has tried to resolve it recently. </s> remove // isLocalClient shows if client's IP address is from locally-served </s> add // isLocalClient shows if client's IP address is from locally served </s> remove // TODO(a.garipov): Remove once we switch to netip.Addr more fully. </s> add // TODO(a.garipov): Remove once we switch to [netip.Addr] more fully.
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
// the server. It responds with a mapped IP address if the DNS64 is enabled and // the request is for AAAA.
<mask> return ip, ok <mask> } <mask> <mask> // processDHCPHosts respond to A requests if the target hostname is known to <mask> // the server. <mask> // <mask> // TODO(a.garipov): Adapt to AAAA as well. <mask> func (s *Server) processDHCPHosts(dctx *dnsContext) (rc resultCode) { <mask> pctx := dctx.proxyCtx <mask> req := pctx.Req </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // in locally-served network from external clients. </s> add // in locally served network from external clients. </s> remove // processRecursion checks the incoming request and halts it's handling if s // have tried to resolve it recently. </s> add // processRecursion checks the incoming request and halts its handling by // answering NXDOMAIN if s has tried to resolve it recently. </s> remove // processDetermineLocal determines if the client's IP address is from // locally-served network and saves the result into the context. </s> add // processDetermineLocal determines if the client's IP address is from locally // served network and saves the result into the context. </s> remove // TODO(a.garipov): Remove once we switch to netip.Addr more fully. </s> add // TODO(a.garipov): Remove once we switch to [netip.Addr] more fully.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
switch q.Qtype { case dns.TypeA:
<mask> <mask> log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) <mask> <mask> resp := s.makeResponse(req) <mask> if q.Qtype == dns.TypeA { <mask> a := &dns.A{ <mask> Hdr: s.hdr(req, dns.TypeA), <mask> A: ip.AsSlice(), <mask> } <mask> resp.Answer = append(resp.Answer, a) </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // TODO(a.garipov): Remove once we switch to netip.Addr more fully. </s> add // TODO(a.garipov): Remove once we switch to [netip.Addr] more fully. </s> remove log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> add </s> remove // in locally-served network from external clients. </s> add // in locally served network from external clients.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
case dns.TypeAAAA: if len(s.dns64Prefs) > 0 { // Respond with DNS64-mapped address for IPv4 host if DNS64 is // enabled. aaaa := &dns.AAAA{ Hdr: s.hdr(req, dns.TypeAAAA), AAAA: s.mapDNS64(ip), } resp.Answer = append(resp.Answer, aaaa) } default: // Go on.
<mask> } <mask> resp.Answer = append(resp.Answer, a) <mask> } <mask> <mask> dctx.proxyCtx.Res = resp <mask> <mask> return resultCodeSuccess </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove if q.Qtype == dns.TypeA { </s> add switch q.Qtype { case dns.TypeA: </s> remove // processDetermineLocal determines if the client's IP address is from // locally-served network and saves the result into the context. </s> add // processDetermineLocal determines if the client's IP address is from locally // served network and saves the result into the context. </s> remove if !s.privateNets.Contains(ip) { return resultCodeSuccess } </s> add </s> remove // assume that all the DHCP leases we give are locally-served or at least // don't need to be accessible externally. </s> add // assume that all the DHCP leases we give are locally served or at least // shouldn't be accessible externally.
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
// in locally served network from external clients.
<mask> return resultCodeSuccess <mask> } <mask> <mask> // processRestrictLocal responds with NXDOMAIN to PTR requests for IP addresses <mask> // in locally-served network from external clients. <mask> func (s *Server) processRestrictLocal(dctx *dnsContext) (rc resultCode) { <mask> pctx := dctx.proxyCtx <mask> req := pctx.Req <mask> q := req.Question[0] <mask> if q.Qtype != dns.TypePTR { </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // the server. </s> add // the server. It responds with a mapped IP address if the DNS64 is enabled and // the request is for AAAA. </s> remove // processRecursion checks the incoming request and halts it's handling if s // have tried to resolve it recently. </s> add // processRecursion checks the incoming request and halts its handling by // answering NXDOMAIN if s has tried to resolve it recently. </s> remove // processDetermineLocal determines if the client's IP address is from // locally-served network and saves the result into the context. </s> add // processDetermineLocal determines if the client's IP address is from locally // served network and saves the result into the context. </s> remove log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> add </s> remove // TODO(a.garipov): Remove once we switch to netip.Addr more fully. </s> add // TODO(a.garipov): Remove once we switch to [netip.Addr] more fully.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
if s.shouldStripDNS64(ip) { // Strip the prefix from the address to get the original IPv4. ip = ip[nat64PrefixLen:] // Treat a DNS64-prefixed address as a locally served one since those // queries should never be sent to the global DNS. dctx.unreversedReqIP = ip }
<mask> } <mask> <mask> // Restrict an access to local addresses for external clients. We also <mask> // assume that all the DHCP leases we give are locally served or at least <mask> // shouldn't be accessible externally. <mask> if !s.privateNets.Contains(ip) { <mask> return resultCodeSuccess <mask> } </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // assume that all the DHCP leases we give are locally-served or at least // don't need to be accessible externally. </s> add // assume that all the DHCP leases we give are locally served or at least // shouldn't be accessible externally. </s> remove log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> add </s> remove // in locally-served network from external clients. </s> add // in locally served network from external clients. </s> remove // TODO(a.garipov): Remove once we switch to netip.Addr more fully. </s> add // TODO(a.garipov): Remove once we switch to [netip.Addr] more fully. </s> remove // processDetermineLocal determines if the client's IP address is from // locally-served network and saves the result into the context. </s> add // processDetermineLocal determines if the client's IP address is from locally // served network and saves the result into the context.
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
// assume that all the DHCP leases we give are locally served or at least // shouldn't be accessible externally.
<mask> return resultCodeSuccess <mask> } <mask> <mask> // Restrict an access to local addresses for external clients. We also <mask> // assume that all the DHCP leases we give are locally-served or at least <mask> // don't need to be accessible externally. <mask> if !s.privateNets.Contains(ip) { <mask> log.Debug("dnsforward: addr %s is not from locally-served network", ip) <mask> <mask> return resultCodeSuccess <mask> } </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> add </s> remove // in locally-served network from external clients. </s> add // in locally served network from external clients. </s> remove // TODO(a.garipov): Remove once we switch to netip.Addr more fully. </s> add // TODO(a.garipov): Remove once we switch to [netip.Addr] more fully.
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
<mask> // Restrict an access to local addresses for external clients. We also <mask> // assume that all the DHCP leases we give are locally-served or at least <mask> // don't need to be accessible externally. <mask> if !s.privateNets.Contains(ip) { <mask> log.Debug("dnsforward: addr %s is not from locally-served network", ip) <mask> <mask> return resultCodeSuccess <mask> } <mask> <mask> if !dctx.isLocalClient { <mask> log.Debug("dnsforward: %q requests an internal ip", pctx.Addr) </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // assume that all the DHCP leases we give are locally-served or at least // don't need to be accessible externally. </s> add // assume that all the DHCP leases we give are locally served or at least // shouldn't be accessible externally. </s> remove // in locally-served network from external clients. </s> add // in locally served network from external clients. </s> remove // TODO(a.garipov): Remove once we switch to netip.Addr more fully. </s> add // TODO(a.garipov): Remove once we switch to [netip.Addr] more fully.
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
log.Debug("dnsforward: addr %s is from locally served network", ip)
<mask> } <mask> <mask> if !dctx.isLocalClient { <mask> log.Debug("dnsforward: %q requests an internal ip", pctx.Addr) <mask> pctx.Res = s.genNXDomain(req) <mask> </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> add </s> remove if q.Qtype == dns.TypeA { </s> add switch q.Qtype { case dns.TypeA: </s> remove // assume that all the DHCP leases we give are locally-served or at least // don't need to be accessible externally. </s> add // assume that all the DHCP leases we give are locally served or at least // shouldn't be accessible externally. </s> remove // TODO(a.garipov): Remove once we switch to netip.Addr more fully. </s> add // TODO(a.garipov): Remove once we switch to [netip.Addr] more fully. </s> remove if req.AuthenticatedData { origReqAD = true } else { </s> add origReqAD = req.AuthenticatedData if !req.AuthenticatedData {
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
// code is only executed when the request is for locally served ARPA
<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 <mask> dctx.setts.SafeBrowsingEnabled = false <mask> dctx.setts.SafeSearchEnabled = false <mask> dctx.setts.ServicesRules = nil </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove if req.AuthenticatedData { origReqAD = true } else { </s> add origReqAD = req.AuthenticatedData if !req.AuthenticatedData { </s> remove // unreversedReqIP stores an IP address obtained from PTR request if it // parsed successfully and belongs to one of locally-served IP ranges as per // RFC 6303. </s> add // unreversedReqIP stores an IP address obtained from a PTR request if it // was parsed successfully and belongs to one of the locally served IP // ranges. It is also filled with unmapped version of the address if it's // within DNS64 prefixes. </s> remove // the server. </s> add // the server. It responds with a mapped IP address if the DNS64 is enabled and // the request is for AAAA.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
// TODO(a.garipov): Remove once we switch to [netip.Addr] more fully.
<mask> if ip == nil { <mask> return resultCodeSuccess <mask> } <mask> <mask> // TODO(a.garipov): Remove once we switch to netip.Addr more fully. <mask> ipAddr, err := netutil.IPToAddrNoMapped(ip) <mask> if err != nil { <mask> log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) <mask> <mask> return resultCodeSuccess </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove if !webRegistered && s.conf.HTTPRegister != nil { webRegistered = true s.registerHandlers() </s> add s.registerHandlers() err = s.setupDNS64() if err != nil { return fmt.Errorf("preparing DNS64: %w", err) </s> remove if !s.privateNets.Contains(ip) { return resultCodeSuccess } </s> add </s> remove // processDetermineLocal determines if the client's IP address is from // locally-served network and saves the result into the context. </s> add // processDetermineLocal determines if the client's IP address is from locally // served network and saves the result into the context. </s> remove if q.Qtype == dns.TypeA { </s> add switch q.Qtype { case dns.TypeA:
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
<mask> <mask> s.serverLock.RLock() <mask> defer s.serverLock.RUnlock() <mask> <mask> if !s.privateNets.Contains(ip) { <mask> return resultCodeSuccess <mask> } <mask> <mask> if s.conf.UsePrivateRDNS { <mask> s.recDetector.add(*pctx.Req) <mask> if err := s.localResolvers.Resolve(pctx); err != nil { <mask> dctx.err = err <mask> </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove if !webRegistered && s.conf.HTTPRegister != nil { webRegistered = true s.registerHandlers() </s> add s.registerHandlers() err = s.setupDNS64() if err != nil { return fmt.Errorf("preparing DNS64: %w", err) </s> remove // TODO(a.garipov): Remove once we switch to netip.Addr more fully. </s> add // TODO(a.garipov): Remove once we switch to [netip.Addr] more fully. </s> remove // processRecursion checks the incoming request and halts it's handling if s // have tried to resolve it recently. </s> add // processRecursion checks the incoming request and halts its handling by // answering NXDOMAIN if s has tried to resolve it recently. </s> remove // in locally-served network from external clients. </s> add // in locally served network from external clients. </s> remove if req.AuthenticatedData { origReqAD = true } else { </s> add origReqAD = req.AuthenticatedData if !req.AuthenticatedData {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
origReqAD = req.AuthenticatedData if !req.AuthenticatedData {
<mask> s.setCustomUpstream(pctx, dctx.clientID) <mask> <mask> origReqAD := false <mask> if s.conf.EnableDNSSEC { <mask> if req.AuthenticatedData { <mask> origReqAD = true <mask> } else { <mask> req.AuthenticatedData = true <mask> } <mask> } <mask> <mask> // Process the request further since it wasn't filtered. </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // processRecursion checks the incoming request and halts it's handling if s // have tried to resolve it recently. </s> add // processRecursion checks the incoming request and halts its handling by // answering NXDOMAIN if s has tried to resolve it recently. </s> remove if !webRegistered && s.conf.HTTPRegister != nil { webRegistered = true s.registerHandlers() </s> add s.registerHandlers() err = s.setupDNS64() if err != nil { return fmt.Errorf("preparing DNS64: %w", err) </s> remove if !s.privateNets.Contains(ip) { return resultCodeSuccess } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
if s.performDNS64(prx, dctx) == resultCodeError { return resultCodeError }
<mask> return resultCodeError <mask> } <mask> <mask> dctx.responseFromUpstream = true <mask> dctx.responseAD = pctx.Res.AuthenticatedData <mask> <mask> if s.conf.EnableDNSSEC && !origReqAD { </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove if req.AuthenticatedData { origReqAD = true } else { </s> add origReqAD = req.AuthenticatedData if !req.AuthenticatedData { </s> remove if !webRegistered && s.conf.HTTPRegister != nil { webRegistered = true s.registerHandlers() </s> add s.registerHandlers() err = s.setupDNS64() if err != nil { return fmt.Errorf("preparing DNS64: %w", err) </s> remove // processRecursion checks the incoming request and halts it's handling if s // have tried to resolve it recently. </s> add // processRecursion checks the incoming request and halts its handling by // answering NXDOMAIN if s has tried to resolve it recently. </s> remove if !s.privateNets.Contains(ip) { return resultCodeSuccess } </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dns.go
// dns64Prefix is the set of NAT64 prefixes used for DNS64 handling. dns64Prefs []netip.Prefix
<mask> localResolvers *proxy.Proxy <mask> sysResolvers aghnet.SystemResolvers <mask> recDetector *recursionDetector <mask> <mask> // anonymizer masks the client's IP addresses if needed. <mask> anonymizer *aghnet.IPMut <mask> <mask> tableHostToIP hostToIPTable </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // isLocalClient shows if client's IP address is from locally-served </s> add // isLocalClient shows if client's IP address is from locally served </s> remove // processDetermineLocal determines if the client's IP address is from // locally-served network and saves the result into the context. </s> add // processDetermineLocal determines if the client's IP address is from locally // served network and saves the result into the context. </s> remove // unreversedReqIP stores an IP address obtained from PTR request if it // parsed successfully and belongs to one of locally-served IP ranges as per // RFC 6303. </s> add // unreversedReqIP stores an IP address obtained from a PTR request if it // was parsed successfully and belongs to one of the locally served IP // ranges. It is also filled with unmapped version of the address if it's // within DNS64 prefixes. </s> remove // the server. </s> add // the server. It responds with a mapped IP address if the DNS64 is enabled and // the request is for AAAA.
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dnsforward.go
s.registerHandlers() err = s.setupDNS64() if err != nil { return fmt.Errorf("preparing DNS64: %w", err)
<mask> if err != nil { <mask> return fmt.Errorf("preparing access: %w", err) <mask> } <mask> <mask> if !webRegistered && s.conf.HTTPRegister != nil { <mask> webRegistered = true <mask> s.registerHandlers() <mask> } <mask> <mask> s.dnsProxy = &proxy.Proxy{Config: proxyConfig} <mask> <mask> err = s.setupResolvers(s.conf.LocalPTRResolvers) </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove if !s.privateNets.Contains(ip) { return resultCodeSuccess } </s> add </s> remove // TODO(a.garipov): Remove once we switch to netip.Addr more fully. </s> add // TODO(a.garipov): Remove once we switch to [netip.Addr] more fully. </s> remove // processRecursion checks the incoming request and halts it's handling if s // have tried to resolve it recently. </s> add // processRecursion checks the incoming request and halts its handling by // answering NXDOMAIN if s has tried to resolve it recently.
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/dnsforward.go
if webRegistered || s.conf.HTTPRegister == nil { return }
<mask> s.ServeHTTP(w, r) <mask> } <mask> <mask> func (s *Server) registerHandlers() { <mask> s.conf.HTTPRegister(http.MethodGet, "/control/dns_info", s.handleGetConfig) <mask> s.conf.HTTPRegister(http.MethodPost, "/control/dns_config", s.handleSetConfig) <mask> s.conf.HTTPRegister(http.MethodPost, "/control/test_upstream_dns", s.handleTestUpstreamDNS) <mask> <mask> s.conf.HTTPRegister(http.MethodGet, "/control/access/list", s.handleAccessList) <mask> s.conf.HTTPRegister(http.MethodPost, "/control/access/set", s.handleAccessSet) </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // in locally-served network from external clients. </s> add // in locally served network from external clients. </s> remove // processDetermineLocal determines if the client's IP address is from // locally-served network and saves the result into the context. </s> add // processDetermineLocal determines if the client's IP address is from locally // served network and saves the result into the context. </s> remove // processRecursion checks the incoming request and halts it's handling if s // have tried to resolve it recently. </s> add // processRecursion checks the incoming request and halts its handling by // answering NXDOMAIN if s has tried to resolve it recently. </s> remove // the server. </s> add // the server. It responds with a mapped IP address if the DNS64 is enabled and // the request is for AAAA. </s> remove if req.AuthenticatedData { origReqAD = true } else { </s> add origReqAD = req.AuthenticatedData if !req.AuthenticatedData {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/http.go
webRegistered = true
<mask> // See also https://github.com/AdguardTeam/AdGuardHome/issues/2628. <mask> s.conf.HTTPRegister("", "/dns-query", s.handleDoH) <mask> s.conf.HTTPRegister("", "/dns-query/", s.handleDoH) <mask> } </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // assume that all the DHCP leases we give are locally-served or at least // don't need to be accessible externally. </s> add // assume that all the DHCP leases we give are locally served or at least // shouldn't be accessible externally. </s> remove log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> add </s> remove // unreversedReqIP stores an IP address obtained from PTR request if it // parsed successfully and belongs to one of locally-served IP ranges as per // RFC 6303. </s> add // unreversedReqIP stores an IP address obtained from a PTR request if it // was parsed successfully and belongs to one of the locally served IP // ranges. It is also filled with unmapped version of the address if it's // within DNS64 prefixes.
[ "keep", "keep", "add", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/dnsforward/http.go
// UseDNS64 defines if DNS64 should be used for incoming requests. UseDNS64 bool `yaml:"use_dns64"` // DNS64Prefixes is the list of NAT64 prefixes to be used for DNS64. DNS64Prefixes []string `yaml:"dns64_prefixes"`
<mask> // LocalPTRResolvers is the slice of addresses to be used as upstreams <mask> // for PTR queries for locally-served networks. <mask> LocalPTRResolvers []string `yaml:"local_ptr_upstreams"` <mask> <mask> // ServeHTTP3 defines if HTTP/3 is be allowed for incoming requests. <mask> // <mask> // TODO(a.garipov): Add to the UI when HTTP/3 support is no longer <mask> // experimental. <mask> ServeHTTP3 bool `yaml:"serve_http3"` <mask> </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove // unreversedReqIP stores an IP address obtained from PTR request if it // parsed successfully and belongs to one of locally-served IP ranges as per // RFC 6303. </s> add // unreversedReqIP stores an IP address obtained from a PTR request if it // was parsed successfully and belongs to one of the locally served IP // ranges. It is also filled with unmapped version of the address if it's // within DNS64 prefixes. </s> remove // code is only executed when the request is for locally-served ARPA </s> add // code is only executed when the request is for locally served ARPA </s> remove // isLocalClient shows if client's IP address is from locally-served </s> add // isLocalClient shows if client's IP address is from locally served
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/home/config.go
UseDNS64: config.DNS.UseDNS64, DNS64Prefixes: config.DNS.DNS64Prefixes,
<mask> HTTPRegister: httpReg, <mask> OnDNSRequest: onDNSRequest, <mask> } <mask> <mask> if tlsConf.Enabled { <mask> newConf.TLSConfig = tlsConf.TLSConfig <mask> newConf.TLSConfig.ServerName = tlsConf.ServerName <mask> </s> Pull request: 5117-dns64 Merge in DNS/adguard-home from 5117-dns64 to master Updates #5117. Squashed commit of the following: commit 757d689134b85bdac9a6f5e43249866ec09ab7e3 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 19:06:18 2023 +0300 all: imp fmt commit b7a73c68c0b40bd3bda520c045c8110975c1827a Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 17:49:21 2023 +0300 all: rm unused, imp code commit 548feb6bd27b9774a9453d0570d37cdf557d4c3a Merge: de3e84b5 54a141ab Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 14:08:12 2023 +0300 Merge branch 'master' into 5117-dns64 commit de3e84b52b8dbff70df3ca0ac3315c3d33576334 Author: Eugene Burkov <[email protected]> Date: Mon Jan 23 12:04:48 2023 +0300 dnsforward: imp code commit a580e92119e3dbadc8b1a6572dbecc679f69db40 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:24:33 2023 +0400 dnsforward: try again commit 67b7a365194939fe15e4907a3dc2fee44b019d08 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 18:08:23 2023 +0400 dnsforward: fix test on linux commit ca83e4178a3383e326bf528d209d8766fb3c60d3 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:37:48 2023 +0400 dnsforward: imp naming commit c4e477c7a12af4966cbcd4e5f003a72966dc5d61 Merge: 42aa42a8 6e803375 Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:30:03 2023 +0400 Merge branch 'master' into 5117-dns64 commit 42aa42a8149b6bb42eb0da6e88ede4b5065bbf2f Author: Eugene Burkov <[email protected]> Date: Fri Jan 20 17:26:54 2023 +0400 dnsforward: imp test commit 4e91c675703f1453456ef9eea08157009ce6237a Author: Eugene Burkov <[email protected]> Date: Wed Jan 18 12:32:55 2023 +0400 dnsforward: imp code, docs, add test commit 766ef757f61e7a555b8151b4783fa7aba5f566f7 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 16:36:35 2023 +0400 dnsforward: imp docs commit 6825f372389988597d1879cf66342c410f3cfd47 Author: Eugene Burkov <[email protected]> Date: Tue Jan 17 14:33:33 2023 +0400 internal: imp code, docs commit 1215316a338496b5bea2b20d697c7451bfbcc84b Author: Eugene Burkov <[email protected]> Date: Fri Jan 13 21:24:50 2023 +0400 all: add dns64 support </s> remove if req.AuthenticatedData { origReqAD = true } else { </s> add origReqAD = req.AuthenticatedData if !req.AuthenticatedData { </s> remove if !s.privateNets.Contains(ip) { return resultCodeSuccess } </s> add </s> remove if !webRegistered && s.conf.HTTPRegister != nil { webRegistered = true s.registerHandlers() </s> add s.registerHandlers() err = s.setupDNS64() if err != nil { return fmt.Errorf("preparing DNS64: %w", err)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ecf2a4c42fbd7ea61573d35271ee65f335c7c4f
internal/home/dns.go
// If ipsetConf is empty, msg and err are nil. The error is of type // *aghos.UnsupportedError if the OS is not supported.
<mask> // The syntax of the ipsetConf is: <mask> // <mask> // DOMAIN[,DOMAIN].../IPSET_NAME[,IPSET_NAME]... <mask> // <mask> // The error is of type *aghos.UnsupportedError if the OS is not supported. <mask> func NewIpsetManager(ipsetConf []string) (mgr IpsetManager, err error) { <mask> return newIpsetMgr(ipsetConf) <mask> } </s> Pull request: aghnet: fix ipset init errors Updates #4027. Squashed commit of the following: commit 9ac0cc27ca94e630cc321c90b60b271499af4d9b Author: Ainar Garipov <[email protected]> Date: Mon Dec 27 20:26:22 2021 +0300 aghnet: fix ipset init errors </s> remove dial := func(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { return ipset.Dial(pf, conf) </s> add return newIpsetMgrWithDialer(ipsetConf, defaultDial) } // defaultDial is the default netfilter dialing function. func defaultDial(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { conn, err = ipset.Dial(pf, conf) if err != nil { return nil, err </s> remove return newIpsetMgrWithDialer(ipsetConf, dial) </s> add return conn, nil </s> remove // ipset cannot currently be initialized if the server was // installed from Snap or when the user or the binary doesn't // have the required permissions, or when the kernel doesn't // support netfilter. </s> add // ipset cannot currently be initialized if the server was installed // from Snap or when the user or the binary doesn't have the required // permissions, or when the kernel doesn't support netfilter.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ed1f939b59591335447d8b445c9d3832c772f09
internal/aghnet/ipset.go
if len(ipsetConf) == 0 { return nil, nil }
<mask> // *aghos.UnsupportedError if the OS is not supported. <mask> func NewIpsetManager(ipsetConf []string) (mgr IpsetManager, err error) { <mask> return newIpsetMgr(ipsetConf) <mask> } </s> Pull request: aghnet: fix ipset init errors Updates #4027. Squashed commit of the following: commit 9ac0cc27ca94e630cc321c90b60b271499af4d9b Author: Ainar Garipov <[email protected]> Date: Mon Dec 27 20:26:22 2021 +0300 aghnet: fix ipset init errors </s> remove // The error is of type *aghos.UnsupportedError if the OS is not supported. </s> add // If ipsetConf is empty, msg and err are nil. The error is of type // *aghos.UnsupportedError if the OS is not supported. </s> remove dial := func(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { return ipset.Dial(pf, conf) </s> add return newIpsetMgrWithDialer(ipsetConf, defaultDial) } // defaultDial is the default netfilter dialing function. func defaultDial(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { conn, err = ipset.Dial(pf, conf) if err != nil { return nil, err </s> remove return newIpsetMgrWithDialer(ipsetConf, dial) </s> add return conn, nil </s> remove // TODO(a.garipov): Perhaps we can ditch package ipset altogether and // just use packages netfilter and netlink. </s> add // TODO(a.garipov): Perhaps we can ditch package ipset altogether and just // use packages netfilter and netlink.
[ "keep", "add", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ed1f939b59591335447d8b445c9d3832c772f09
internal/aghnet/ipset.go
"golang.org/x/sys/unix"
<mask> "github.com/digineo/go-ipset/v2" <mask> "github.com/mdlayher/netlink" <mask> "github.com/ti-mo/netfilter" <mask> ) <mask> <mask> // How to test on a real Linux machine: <mask> // <mask> // 1. Run: </s> Pull request: aghnet: fix ipset init errors Updates #4027. Squashed commit of the following: commit 9ac0cc27ca94e630cc321c90b60b271499af4d9b Author: Ainar Garipov <[email protected]> Date: Mon Dec 27 20:26:22 2021 +0300 aghnet: fix ipset init errors </s> remove dial := func(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { return ipset.Dial(pf, conf) </s> add return newIpsetMgrWithDialer(ipsetConf, defaultDial) } // defaultDial is the default netfilter dialing function. func defaultDial(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { conn, err = ipset.Dial(pf, conf) if err != nil { return nil, err </s> remove // ipset cannot currently be initialized if the server was // installed from Snap or when the user or the binary doesn't // have the required permissions, or when the kernel doesn't // support netfilter. </s> add // ipset cannot currently be initialized if the server was installed // from Snap or when the user or the binary doesn't have the required // permissions, or when the kernel doesn't support netfilter. </s> remove // The error is of type *aghos.UnsupportedError if the OS is not supported. </s> add // If ipsetConf is empty, msg and err are nil. The error is of type // *aghos.UnsupportedError if the OS is not supported. </s> remove // TODO(a.garipov): The Snap problem can probably be solved if // we add the netlink-connector interface plug. log.Info("warning: cannot initialize ipset: %s", err) </s> add // TODO(a.garipov): The Snap problem can probably be solved if we add // the netlink-connector interface plug. log.Info("ipset: warning: cannot initialize: %s", err) </s> remove // TODO(a.garipov): Perhaps we can ditch package ipset altogether and // just use packages netfilter and netlink. </s> add // TODO(a.garipov): Perhaps we can ditch package ipset altogether and just // use packages netfilter and netlink.
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ed1f939b59591335447d8b445c9d3832c772f09
internal/aghnet/ipset_linux.go
return newIpsetMgrWithDialer(ipsetConf, defaultDial) } // defaultDial is the default netfilter dialing function. func defaultDial(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { conn, err = ipset.Dial(pf, conf) if err != nil { return nil, err
<mask> // The Members field should contain the resolved IP addresses. <mask> <mask> // newIpsetMgr returns a new Linux ipset manager. <mask> func newIpsetMgr(ipsetConf []string) (set IpsetManager, err error) { <mask> dial := func(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { <mask> return ipset.Dial(pf, conf) <mask> } <mask> <mask> return newIpsetMgrWithDialer(ipsetConf, dial) <mask> } <mask> </s> Pull request: aghnet: fix ipset init errors Updates #4027. Squashed commit of the following: commit 9ac0cc27ca94e630cc321c90b60b271499af4d9b Author: Ainar Garipov <[email protected]> Date: Mon Dec 27 20:26:22 2021 +0300 aghnet: fix ipset init errors </s> remove return newIpsetMgrWithDialer(ipsetConf, dial) </s> add return conn, nil </s> remove // The error is of type *aghos.UnsupportedError if the OS is not supported. </s> add // If ipsetConf is empty, msg and err are nil. The error is of type // *aghos.UnsupportedError if the OS is not supported. </s> remove // TODO(a.garipov): Perhaps we can ditch package ipset altogether and // just use packages netfilter and netlink. </s> add // TODO(a.garipov): Perhaps we can ditch package ipset altogether and just // use packages netfilter and netlink.
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ed1f939b59591335447d8b445c9d3832c772f09
internal/aghnet/ipset_linux.go
return conn, nil
<mask> dial := func(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { <mask> return ipset.Dial(pf, conf) <mask> } <mask> <mask> return newIpsetMgrWithDialer(ipsetConf, dial) <mask> } <mask> <mask> // ipsetConn is the ipset conn interface. <mask> type ipsetConn interface { <mask> Add(name string, entries ...*ipset.Entry) (err error) </s> Pull request: aghnet: fix ipset init errors Updates #4027. Squashed commit of the following: commit 9ac0cc27ca94e630cc321c90b60b271499af4d9b Author: Ainar Garipov <[email protected]> Date: Mon Dec 27 20:26:22 2021 +0300 aghnet: fix ipset init errors </s> remove dial := func(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { return ipset.Dial(pf, conf) </s> add return newIpsetMgrWithDialer(ipsetConf, defaultDial) } // defaultDial is the default netfilter dialing function. func defaultDial(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { conn, err = ipset.Dial(pf, conf) if err != nil { return nil, err </s> remove // The error is of type *aghos.UnsupportedError if the OS is not supported. </s> add // If ipsetConf is empty, msg and err are nil. The error is of type // *aghos.UnsupportedError if the OS is not supported. </s> remove // TODO(a.garipov): Perhaps we can ditch package ipset altogether and // just use packages netfilter and netlink. </s> add // TODO(a.garipov): Perhaps we can ditch package ipset altogether and just // use packages netfilter and netlink. </s> remove // ipset cannot currently be initialized if the server was // installed from Snap or when the user or the binary doesn't // have the required permissions, or when the kernel doesn't // support netfilter. </s> add // ipset cannot currently be initialized if the server was installed // from Snap or when the user or the binary doesn't have the required // permissions, or when the kernel doesn't support netfilter.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ed1f939b59591335447d8b445c9d3832c772f09
internal/aghnet/ipset_linux.go
// TODO(a.garipov): Perhaps we can ditch package ipset altogether and just // use packages netfilter and netlink.
<mask> func (m *ipsetMgr) dialNetfilter(conf *netlink.Config) (err error) { <mask> // The kernel API does not actually require two sockets but package <mask> // github.com/digineo/go-ipset does. <mask> // <mask> // TODO(a.garipov): Perhaps we can ditch package ipset altogether and <mask> // just use packages netfilter and netlink. <mask> m.ipv4Conn, err = m.dial(netfilter.ProtoIPv4, conf) <mask> if err != nil { <mask> return fmt.Errorf("dialing v4: %w", err) <mask> } <mask> </s> Pull request: aghnet: fix ipset init errors Updates #4027. Squashed commit of the following: commit 9ac0cc27ca94e630cc321c90b60b271499af4d9b Author: Ainar Garipov <[email protected]> Date: Mon Dec 27 20:26:22 2021 +0300 aghnet: fix ipset init errors </s> remove dial := func(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { return ipset.Dial(pf, conf) </s> add return newIpsetMgrWithDialer(ipsetConf, defaultDial) } // defaultDial is the default netfilter dialing function. func defaultDial(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { conn, err = ipset.Dial(pf, conf) if err != nil { return nil, err </s> remove // ipset cannot currently be initialized if the server was // installed from Snap or when the user or the binary doesn't // have the required permissions, or when the kernel doesn't // support netfilter. </s> add // ipset cannot currently be initialized if the server was installed // from Snap or when the user or the binary doesn't have the required // permissions, or when the kernel doesn't support netfilter. </s> remove // TODO(a.garipov): The Snap problem can probably be solved if // we add the netlink-connector interface plug. log.Info("warning: cannot initialize ipset: %s", err) </s> add // TODO(a.garipov): The Snap problem can probably be solved if we add // the netlink-connector interface plug. log.Info("ipset: warning: cannot initialize: %s", err) </s> remove return newIpsetMgrWithDialer(ipsetConf, dial) </s> add return conn, nil
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ed1f939b59591335447d8b445c9d3832c772f09
internal/aghnet/ipset_linux.go
if errors.Is(err, unix.EPROTONOSUPPORT) { // The implementation doesn't support this protocol version. Just // issue a warning. log.Info("ipset: dialing netfilter: warning: %s", err) return nil, nil }
<mask> err = m.dialNetfilter(&netlink.Config{}) <mask> if err != nil { <mask> return nil, fmt.Errorf("dialing netfilter: %w", err) <mask> } <mask> <mask> for i, confStr := range ipsetConf { <mask> var hosts, ipsetNames []string </s> Pull request: aghnet: fix ipset init errors Updates #4027. Squashed commit of the following: commit 9ac0cc27ca94e630cc321c90b60b271499af4d9b Author: Ainar Garipov <[email protected]> Date: Mon Dec 27 20:26:22 2021 +0300 aghnet: fix ipset init errors </s> remove log.Info("warning: %s", err) </s> add log.Info("ipset: warning: %s", err) </s> remove // TODO(a.garipov): Perhaps we can ditch package ipset altogether and // just use packages netfilter and netlink. </s> add // TODO(a.garipov): Perhaps we can ditch package ipset altogether and just // use packages netfilter and netlink. </s> remove dial := func(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { return ipset.Dial(pf, conf) </s> add return newIpsetMgrWithDialer(ipsetConf, defaultDial) } // defaultDial is the default netfilter dialing function. func defaultDial(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { conn, err = ipset.Dial(pf, conf) if err != nil { return nil, err </s> remove // The error is of type *aghos.UnsupportedError if the OS is not supported. </s> add // If ipsetConf is empty, msg and err are nil. The error is of type // *aghos.UnsupportedError if the OS is not supported.
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ed1f939b59591335447d8b445c9d3832c772f09
internal/aghnet/ipset_linux.go
// ipset cannot currently be initialized if the server was installed // from Snap or when the user or the binary doesn't have the required // permissions, or when the kernel doesn't support netfilter.
<mask> // TODO(a.garipov): Rewrite into a simple constructor? <mask> func (c *ipsetCtx) init(ipsetConf []string) (err error) { <mask> c.ipsetMgr, err = aghnet.NewIpsetManager(ipsetConf) <mask> if errors.Is(err, os.ErrInvalid) || errors.Is(err, os.ErrPermission) { <mask> // ipset cannot currently be initialized if the server was <mask> // installed from Snap or when the user or the binary doesn't <mask> // have the required permissions, or when the kernel doesn't <mask> // support netfilter. <mask> // <mask> // Log and go on. <mask> // <mask> // TODO(a.garipov): The Snap problem can probably be solved if <mask> // we add the netlink-connector interface plug. </s> Pull request: aghnet: fix ipset init errors Updates #4027. Squashed commit of the following: commit 9ac0cc27ca94e630cc321c90b60b271499af4d9b Author: Ainar Garipov <[email protected]> Date: Mon Dec 27 20:26:22 2021 +0300 aghnet: fix ipset init errors </s> remove // TODO(a.garipov): The Snap problem can probably be solved if // we add the netlink-connector interface plug. log.Info("warning: cannot initialize ipset: %s", err) </s> add // TODO(a.garipov): The Snap problem can probably be solved if we add // the netlink-connector interface plug. log.Info("ipset: warning: cannot initialize: %s", err) </s> remove // TODO(a.garipov): Perhaps we can ditch package ipset altogether and // just use packages netfilter and netlink. </s> add // TODO(a.garipov): Perhaps we can ditch package ipset altogether and just // use packages netfilter and netlink. </s> remove // The error is of type *aghos.UnsupportedError if the OS is not supported. </s> add // If ipsetConf is empty, msg and err are nil. The error is of type // *aghos.UnsupportedError if the OS is not supported. </s> remove dial := func(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { return ipset.Dial(pf, conf) </s> add return newIpsetMgrWithDialer(ipsetConf, defaultDial) } // defaultDial is the default netfilter dialing function. func defaultDial(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { conn, err = ipset.Dial(pf, conf) if err != nil { return nil, err
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ed1f939b59591335447d8b445c9d3832c772f09
internal/dnsforward/ipset.go
// TODO(a.garipov): The Snap problem can probably be solved if we add // the netlink-connector interface plug. log.Info("ipset: warning: cannot initialize: %s", err)
<mask> // support netfilter. <mask> // <mask> // Log and go on. <mask> // <mask> // TODO(a.garipov): The Snap problem can probably be solved if <mask> // we add the netlink-connector interface plug. <mask> log.Info("warning: cannot initialize ipset: %s", err) <mask> <mask> return nil <mask> } else if unsupErr := (&aghos.UnsupportedError{}); errors.As(err, &unsupErr) { <mask> log.Info("warning: %s", err) <mask> </s> Pull request: aghnet: fix ipset init errors Updates #4027. Squashed commit of the following: commit 9ac0cc27ca94e630cc321c90b60b271499af4d9b Author: Ainar Garipov <[email protected]> Date: Mon Dec 27 20:26:22 2021 +0300 aghnet: fix ipset init errors </s> remove log.Info("warning: %s", err) </s> add log.Info("ipset: warning: %s", err) </s> remove // ipset cannot currently be initialized if the server was // installed from Snap or when the user or the binary doesn't // have the required permissions, or when the kernel doesn't // support netfilter. </s> add // ipset cannot currently be initialized if the server was installed // from Snap or when the user or the binary doesn't have the required // permissions, or when the kernel doesn't support netfilter. </s> remove // TODO(a.garipov): Perhaps we can ditch package ipset altogether and // just use packages netfilter and netlink. </s> add // TODO(a.garipov): Perhaps we can ditch package ipset altogether and just // use packages netfilter and netlink. </s> remove // The error is of type *aghos.UnsupportedError if the OS is not supported. </s> add // If ipsetConf is empty, msg and err are nil. The error is of type // *aghos.UnsupportedError if the OS is not supported.
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ed1f939b59591335447d8b445c9d3832c772f09
internal/dnsforward/ipset.go
log.Info("ipset: warning: %s", err)
<mask> log.Info("warning: cannot initialize ipset: %s", err) <mask> <mask> return nil <mask> } else if unsupErr := (&aghos.UnsupportedError{}); errors.As(err, &unsupErr) { <mask> log.Info("warning: %s", err) <mask> <mask> return nil <mask> } else if err != nil { <mask> return fmt.Errorf("initializing ipset: %w", err) <mask> } </s> Pull request: aghnet: fix ipset init errors Updates #4027. Squashed commit of the following: commit 9ac0cc27ca94e630cc321c90b60b271499af4d9b Author: Ainar Garipov <[email protected]> Date: Mon Dec 27 20:26:22 2021 +0300 aghnet: fix ipset init errors </s> remove // TODO(a.garipov): The Snap problem can probably be solved if // we add the netlink-connector interface plug. log.Info("warning: cannot initialize ipset: %s", err) </s> add // TODO(a.garipov): The Snap problem can probably be solved if we add // the netlink-connector interface plug. log.Info("ipset: warning: cannot initialize: %s", err) </s> remove dial := func(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { return ipset.Dial(pf, conf) </s> add return newIpsetMgrWithDialer(ipsetConf, defaultDial) } // defaultDial is the default netfilter dialing function. func defaultDial(pf netfilter.ProtoFamily, conf *netlink.Config) (conn ipsetConn, err error) { conn, err = ipset.Dial(pf, conf) if err != nil { return nil, err </s> remove // TODO(a.garipov): Perhaps we can ditch package ipset altogether and // just use packages netfilter and netlink. </s> add // TODO(a.garipov): Perhaps we can ditch package ipset altogether and just // use packages netfilter and netlink.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2ed1f939b59591335447d8b445c9d3832c772f09
internal/dnsforward/ipset.go
// maximum entries to parse when searching maxSearchEntries = 50000
<mask> logBufferCap = 5000 // maximum capacity of buffer before it's flushed to disk <mask> queryLogFileName = "querylog.json" // .gz added during compression <mask> getDataLimit = 500 // GetData(): maximum log entries to return <mask> <mask> // maximum data chunks to parse when filtering entries <mask> maxFilteringChunks = 10 <mask> ) <mask> <mask> // queryLog is a structure that writes and reads the DNS query log <mask> type queryLog struct { <mask> conf Config </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove func (r *Reader) BeginRead(olderThan time.Time, count uint64) { </s> add func (r *Reader) BeginRead(olderThan time.Time, count uint64, search *getDataParams) { </s> remove func (l *queryLog) getData(params getDataParams) []map[string]interface{} { </s> add func (l *queryLog) getData(params getDataParams) map[string]interface{} { </s> remove if len(params.Domain) != 0 && params.StrictMatchDomain { params.Domain = params.Domain + "." } </s> add var oldest time.Time </s> remove log.Debug("QueryLog: Failed to decode: %s", err) </s> add log.Debug("QueryLog: failed to decode")
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
IP string `json:"IP"` Time time.Time `json:"T"` QHost string `json:"QH"` QType string `json:"QT"` QClass string `json:"QC"`
<mask> log.Debug("Query log: cleared") <mask> } <mask> <mask> type logEntry struct { <mask> Question []byte <mask> Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net <mask> Result dnsfilter.Result <mask> Time time.Time <mask> Elapsed time.Duration <mask> IP string </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove Time time.Time </s> add </s> remove IP string </s> add </s> remove QuestionType uint16 // filter by question type </s> add QuestionType string // filter by question type </s> remove return entries, total </s> add return entries, oldest, int(total) </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
<mask> type logEntry struct { <mask> Question []byte <mask> Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net <mask> Result dnsfilter.Result <mask> Time time.Time <mask> Elapsed time.Duration <mask> IP string <mask> Upstream string `json:",omitempty"` // if empty, means it was cached <mask> } <mask> </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove IP string </s> add </s> remove Question []byte </s> add IP string `json:"IP"` Time time.Time `json:"T"` QHost string `json:"QH"` QType string `json:"QT"` QClass string `json:"QC"` </s> remove QuestionType uint16 // filter by question type </s> add QuestionType string // filter by question type </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil { </s> remove return entries, total </s> add return entries, oldest, int(total)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
<mask> Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net <mask> Result dnsfilter.Result <mask> Time time.Time <mask> Elapsed time.Duration <mask> IP string <mask> Upstream string `json:",omitempty"` // if empty, means it was cached <mask> } <mask> <mask> // getIPString is a helper function that extracts IP address from net.Addr <mask> func getIPString(addr net.Addr) string { </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove Time time.Time </s> add </s> remove Question []byte </s> add IP string `json:"IP"` Time time.Time `json:"T"` QHost string `json:"QH"` QType string `json:"QT"` QClass string `json:"QC"` </s> remove QuestionType uint16 // filter by question type </s> add QuestionType string // filter by question type </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil { </s> remove if len(params.Domain) != 0 && params.StrictMatchDomain { params.Domain = params.Domain + "." } </s> add var oldest time.Time
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil {
<mask> if !l.conf.Enabled { <mask> return <mask> } <mask> <mask> var q []byte <mask> var a []byte <mask> var err error <mask> ip := getIPString(addr) <mask> <mask> if question == nil { <mask> return <mask> } <mask> <mask> q, err = question.Pack() <mask> if err != nil { </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr) </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add </s> remove strReader := strings.NewReader(string(b)) jd := json.NewDecoder(strReader) </s> add str := string(b) </s> remove log.Debug("QueryLog: Failed to decode: %s", err) </s> add log.Debug("QueryLog: failed to decode") </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
var a []byte var err error ip := getIPString(addr)
<mask> if question == nil { <mask> return <mask> } <mask> <mask> q, err = question.Pack() <mask> if err != nil { <mask> log.Printf("failed to pack question for querylog: %s", err) <mask> return <mask> } <mask> <mask> if answer != nil { <mask> a, err = answer.Pack() <mask> if err != nil { <mask> log.Printf("failed to pack answer for querylog: %s", err) </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil { </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add </s> remove log.Debug("Failed to unpack dns message answer: %s", err) </s> add log.Debug("Failed to unpack dns message answer: %s: %s", err, string(entry.Answer)) </s> remove log.Debug("QueryLog: Failed to decode: %s", err) </s> add log.Debug("QueryLog: failed to decode") </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
IP: ip, Time: now,
<mask> } <mask> <mask> now := time.Now() <mask> entry := logEntry{ <mask> Question: q, <mask> Answer: a, <mask> Result: *result, <mask> Time: now, <mask> Elapsed: elapsed, <mask> IP: ip, </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove Time: now, </s> add </s> remove IP: ip, </s> add </s> remove if len(params.Domain) != 0 && params.StrictMatchDomain { params.Domain = params.Domain + "." } </s> add var oldest time.Time </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
<mask> entry := logEntry{ <mask> Question: q, <mask> Answer: a, <mask> Result: *result, <mask> Time: now, <mask> Elapsed: elapsed, <mask> IP: ip, <mask> Upstream: upstream, <mask> } <mask> </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove Question: q, </s> add IP: ip, Time: now, </s> remove IP: ip, </s> add </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr) </s> remove log.Debug("querylog: read %d entries in %v, %v/entry, seek-reqs:%d", r.count, elapsed, perunit, r.nSeekRequests) </s> add log.Debug("querylog: read %d entries in %v, %v/entry, seek-reqs:%d time:%dus (%d%%)", r.count, elapsed, perunit, r.nSeekRequests, r.timecnt/1000, r.timecnt*100/uint64(elapsed.Nanoseconds()))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
<mask> Answer: a, <mask> Result: *result, <mask> Time: now, <mask> Elapsed: elapsed, <mask> IP: ip, <mask> Upstream: upstream, <mask> } <mask> <mask> l.bufferLock.Lock() <mask> l.buffer = append(l.buffer, &entry) </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove Time: now, </s> add </s> remove Question: q, </s> add IP: ip, Time: now, </s> remove log.Debug("querylog: read %d entries in %v, %v/entry, seek-reqs:%d", r.count, elapsed, perunit, r.nSeekRequests) </s> add log.Debug("querylog: read %d entries in %v, %v/entry, seek-reqs:%d time:%dus (%d%%)", r.count, elapsed, perunit, r.nSeekRequests, r.timecnt/1000, r.timecnt*100/uint64(elapsed.Nanoseconds())) </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
q := question.Question[0] entry.QHost = strings.ToLower(q.Name[:len(q.Name)-1]) // remove the last dot entry.QType = dns.Type(q.Qtype).String() entry.QClass = dns.Class(q.Qclass).String()
<mask> Result: *result, <mask> Elapsed: elapsed, <mask> Upstream: upstream, <mask> } <mask> <mask> l.bufferLock.Lock() <mask> l.buffer = append(l.buffer, &entry) <mask> needFlush := false <mask> if !l.flushPending { <mask> needFlush = len(l.buffer) >= logBufferCap </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove IP: ip, </s> add </s> remove Time: now, </s> add </s> remove Question: q, </s> add IP: ip, Time: now, </s> remove r.searching = false </s> add r.seeking = false
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
if len(params.QuestionType) != 0 { if entry.QType != params.QuestionType { return false
<mask> if params.ResponseStatus == responseStatusFiltered && !entry.Result.IsFiltered { <mask> return false <mask> } <mask> <mask> if len(params.Domain) != 0 || params.QuestionType != 0 { <mask> m := dns.Msg{} <mask> _ = m.Unpack(entry.Question) <mask> <mask> if params.QuestionType != 0 { <mask> if m.Question[0].Qtype != params.QuestionType { <mask> return false <mask> } <mask> } <mask> <mask> if len(params.Domain) != 0 && params.StrictMatchDomain { <mask> if m.Question[0].Name != params.Domain { <mask> return false <mask> } <mask> } else if len(params.Domain) != 0 { <mask> if strings.Index(m.Question[0].Name, params.Domain) == -1 { <mask> return false <mask> } <mask> } <mask> } <mask> <mask> if len(params.Client) != 0 && params.StrictMatchClient { <mask> if entry.IP != params.Client { </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if len(params.Client) != 0 && params.StrictMatchClient { if entry.IP != params.Client { </s> add if len(params.Domain) != 0 { if (params.StrictMatchDomain && entry.QHost != params.Domain) || (!params.StrictMatchDomain && strings.Index(entry.QHost, params.Domain) == -1) { </s> remove } else if len(params.Client) != 0 { if strings.Index(entry.IP, params.Client) == -1 { </s> add } if len(params.Client) != 0 { if (params.StrictMatchClient && entry.IP != params.Client) || (!params.StrictMatchClient && strings.Index(entry.IP, params.Client) == -1) { </s> remove params.QuestionType = qtype </s> add params.QuestionType = req.filterQuestionType </s> remove func (l *queryLog) getData(params getDataParams) []map[string]interface{} { </s> add func (l *queryLog) getData(params getDataParams) map[string]interface{} { </s> remove qtype, ok := dns.StringToType[req.filterQuestionType] </s> add _, ok := dns.StringToType[req.filterQuestionType]
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
if len(params.Domain) != 0 { if (params.StrictMatchDomain && entry.QHost != params.Domain) || (!params.StrictMatchDomain && strings.Index(entry.QHost, params.Domain) == -1) {
<mask> } <mask> } <mask> } <mask> <mask> if len(params.Client) != 0 && params.StrictMatchClient { <mask> if entry.IP != params.Client { <mask> return false <mask> } <mask> } else if len(params.Client) != 0 { <mask> if strings.Index(entry.IP, params.Client) == -1 { <mask> return false </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove } else if len(params.Client) != 0 { if strings.Index(entry.IP, params.Client) == -1 { </s> add } if len(params.Client) != 0 { if (params.StrictMatchClient && entry.IP != params.Client) || (!params.StrictMatchClient && strings.Index(entry.IP, params.Client) == -1) { </s> remove if len(params.Domain) != 0 || params.QuestionType != 0 { m := dns.Msg{} _ = m.Unpack(entry.Question) if params.QuestionType != 0 { if m.Question[0].Qtype != params.QuestionType { return false } } if len(params.Domain) != 0 && params.StrictMatchDomain { if m.Question[0].Name != params.Domain { return false } } else if len(params.Domain) != 0 { if strings.Index(m.Question[0].Name, params.Domain) == -1 { return false } </s> add if len(params.QuestionType) != 0 { if entry.QType != params.QuestionType { return false </s> remove qtype, ok := dns.StringToType[req.filterQuestionType] </s> add _, ok := dns.StringToType[req.filterQuestionType] </s> remove total++ if first { first = false olderThan = entry.Time } </s> add </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
} if len(params.Client) != 0 { if (params.StrictMatchClient && entry.IP != params.Client) || (!params.StrictMatchClient && strings.Index(entry.IP, params.Client) == -1) {
<mask> if len(params.Client) != 0 && params.StrictMatchClient { <mask> if entry.IP != params.Client { <mask> return false <mask> } <mask> } else if len(params.Client) != 0 { <mask> if strings.Index(entry.IP, params.Client) == -1 { <mask> return false <mask> } <mask> } <mask> <mask> return true </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if len(params.Client) != 0 && params.StrictMatchClient { if entry.IP != params.Client { </s> add if len(params.Domain) != 0 { if (params.StrictMatchDomain && entry.QHost != params.Domain) || (!params.StrictMatchDomain && strings.Index(entry.QHost, params.Domain) == -1) { </s> remove if len(params.Domain) != 0 || params.QuestionType != 0 { m := dns.Msg{} _ = m.Unpack(entry.Question) if params.QuestionType != 0 { if m.Question[0].Qtype != params.QuestionType { return false } } if len(params.Domain) != 0 && params.StrictMatchDomain { if m.Question[0].Name != params.Domain { return false } } else if len(params.Domain) != 0 { if strings.Index(m.Question[0].Name, params.Domain) == -1 { return false } </s> add if len(params.QuestionType) != 0 { if entry.QType != params.QuestionType { return false </s> remove qtype, ok := dns.StringToType[req.filterQuestionType] </s> add _, ok := dns.StringToType[req.filterQuestionType] </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil { </s> remove total++ if first { first = false olderThan = entry.Time } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, time.Time, int) {
<mask> <mask> return true <mask> } <mask> <mask> func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, int) { <mask> entries := []*logEntry{} <mask> olderThan := params.OlderThan <mask> totalChunks := 0 <mask> total := 0 <mask> </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove olderThan := params.OlderThan totalChunks := 0 total := 0 </s> add oldest := time.Time{} </s> remove func (l *queryLog) getData(params getDataParams) []map[string]interface{} { </s> add func (l *queryLog) getData(params getDataParams) map[string]interface{} { </s> remove if len(params.Domain) != 0 && params.StrictMatchDomain { params.Domain = params.Domain + "." } </s> add var oldest time.Time </s> remove entries, total = l.readFromFile(params) </s> add entries, oldest, total = l.readFromFile(params) </s> remove return entries, 0 </s> add return entries, time.Time{}, 0
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
oldest := time.Time{}
<mask> } <mask> <mask> func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, int) { <mask> entries := []*logEntry{} <mask> olderThan := params.OlderThan <mask> totalChunks := 0 <mask> total := 0 <mask> <mask> r := l.OpenReader() <mask> if r == nil { <mask> return entries, 0 <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, int) { </s> add func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, time.Time, int) { </s> remove return entries, 0 </s> add return entries, time.Time{}, 0 </s> remove r.BeginRead(olderThan, getDataLimit) for totalChunks < maxFilteringChunks { first := true </s> add r.BeginRead(params.OlderThan, getDataLimit, &params) total := uint64(0) for total <= maxSearchEntries { </s> remove func (l *queryLog) getData(params getDataParams) []map[string]interface{} { </s> add func (l *queryLog) getData(params getDataParams) map[string]interface{} { </s> remove entries, total = l.readFromFile(params) </s> add entries, oldest, total = l.readFromFile(params)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
return entries, time.Time{}, 0
<mask> total := 0 <mask> <mask> r := l.OpenReader() <mask> if r == nil { <mask> return entries, 0 <mask> } <mask> r.BeginRead(olderThan, getDataLimit) <mask> for totalChunks < maxFilteringChunks { <mask> first := true <mask> newEntries := []*logEntry{} </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove r.BeginRead(olderThan, getDataLimit) for totalChunks < maxFilteringChunks { first := true </s> add r.BeginRead(params.OlderThan, getDataLimit, &params) total := uint64(0) for total <= maxSearchEntries { </s> remove olderThan := params.OlderThan totalChunks := 0 total := 0 </s> add oldest := time.Time{} </s> remove totalChunks++ r.BeginReadPrev(olderThan, getDataLimit) </s> add total += r.Total() oldest = r.Oldest() r.BeginReadPrev(getDataLimit) </s> remove func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, int) { </s> add func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, time.Time, int) { </s> remove entries, total = l.readFromFile(params) </s> add entries, oldest, total = l.readFromFile(params)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
r.BeginRead(params.OlderThan, getDataLimit, &params) total := uint64(0) for total <= maxSearchEntries {
<mask> r := l.OpenReader() <mask> if r == nil { <mask> return entries, 0 <mask> } <mask> r.BeginRead(olderThan, getDataLimit) <mask> for totalChunks < maxFilteringChunks { <mask> first := true <mask> newEntries := []*logEntry{} <mask> for { <mask> entry := r.Next() <mask> if entry == nil { <mask> break </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove return entries, 0 </s> add return entries, time.Time{}, 0 </s> remove olderThan := params.OlderThan totalChunks := 0 total := 0 </s> add oldest := time.Time{} </s> remove total++ if first { first = false olderThan = entry.Time } </s> add </s> remove if first || len(entries) == getDataLimit { </s> add if r.Total() == 0 || len(entries) == getDataLimit { </s> remove totalChunks++ r.BeginReadPrev(olderThan, getDataLimit) </s> add total += r.Total() oldest = r.Oldest() r.BeginReadPrev(getDataLimit)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
<mask> entry := r.Next() <mask> if entry == nil { <mask> break <mask> } <mask> total++ <mask> <mask> if first { <mask> first = false <mask> olderThan = entry.Time <mask> } <mask> <mask> if !isNeeded(entry, params) { <mask> continue <mask> } <mask> if len(newEntries) == getDataLimit { </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if first || len(entries) == getDataLimit { </s> add if r.Total() == 0 || len(entries) == getDataLimit { </s> remove r.BeginRead(olderThan, getDataLimit) for totalChunks < maxFilteringChunks { first := true </s> add r.BeginRead(params.OlderThan, getDataLimit, &params) total := uint64(0) for total <= maxSearchEntries { </s> remove totalChunks++ r.BeginReadPrev(olderThan, getDataLimit) </s> add total += r.Total() oldest = r.Oldest() r.BeginReadPrev(getDataLimit) </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
log.Debug("entries: +%d (%d) [%d]", len(newEntries), len(entries), r.Total())
<mask> } <mask> newEntries = append(newEntries, entry) <mask> } <mask> <mask> log.Debug("entries: +%d (%d) older-than:%s", len(newEntries), len(entries), olderThan) <mask> <mask> entries = append(newEntries, entries...) <mask> if len(entries) > getDataLimit { <mask> toremove := len(entries) - getDataLimit <mask> entries = entries[toremove:] </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if first || len(entries) == getDataLimit { </s> add if r.Total() == 0 || len(entries) == getDataLimit { </s> remove return data </s> add var result = map[string]interface{}{} if len(entries) == getDataLimit { oldest = entries[0].Time } result["oldest"] = "" if !oldest.IsZero() { result["oldest"] = oldest.Format(time.RFC3339Nano) } result["data"] = data return result </s> remove totalChunks++ r.BeginReadPrev(olderThan, getDataLimit) </s> add total += r.Total() oldest = r.Oldest() r.BeginReadPrev(getDataLimit) </s> remove total++ if first { first = false olderThan = entry.Time } </s> add </s> remove log.Debug("querylog: read %d entries in %v, %v/entry, seek-reqs:%d", r.count, elapsed, perunit, r.nSeekRequests) </s> add log.Debug("querylog: read %d entries in %v, %v/entry, seek-reqs:%d time:%dus (%d%%)", r.count, elapsed, perunit, r.nSeekRequests, r.timecnt/1000, r.timecnt*100/uint64(elapsed.Nanoseconds()))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
if r.Total() == 0 || len(entries) == getDataLimit {
<mask> toremove := len(entries) - getDataLimit <mask> entries = entries[toremove:] <mask> break <mask> } <mask> if first || len(entries) == getDataLimit { <mask> break <mask> } <mask> totalChunks++ <mask> r.BeginReadPrev(olderThan, getDataLimit) <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove totalChunks++ r.BeginReadPrev(olderThan, getDataLimit) </s> add total += r.Total() oldest = r.Oldest() r.BeginReadPrev(getDataLimit) </s> remove log.Debug("entries: +%d (%d) older-than:%s", len(newEntries), len(entries), olderThan) </s> add log.Debug("entries: +%d (%d) [%d]", len(newEntries), len(entries), r.Total()) </s> remove total++ if first { first = false olderThan = entry.Time } </s> add </s> remove return data </s> add var result = map[string]interface{}{} if len(entries) == getDataLimit { oldest = entries[0].Time } result["oldest"] = "" if !oldest.IsZero() { result["oldest"] = oldest.Format(time.RFC3339Nano) } result["data"] = data return result </s> remove r.BeginRead(olderThan, getDataLimit) for totalChunks < maxFilteringChunks { first := true </s> add r.BeginRead(params.OlderThan, getDataLimit, &params) total := uint64(0) for total <= maxSearchEntries {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
total += r.Total() oldest = r.Oldest() r.BeginReadPrev(getDataLimit)
<mask> } <mask> if first || len(entries) == getDataLimit { <mask> break <mask> } <mask> totalChunks++ <mask> r.BeginReadPrev(olderThan, getDataLimit) <mask> } <mask> <mask> r.Close() <mask> return entries, total <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if first || len(entries) == getDataLimit { </s> add if r.Total() == 0 || len(entries) == getDataLimit { </s> remove return entries, total </s> add return entries, oldest, int(total) </s> remove total++ if first { first = false olderThan = entry.Time } </s> add </s> remove r.BeginRead(olderThan, getDataLimit) for totalChunks < maxFilteringChunks { first := true </s> add r.BeginRead(params.OlderThan, getDataLimit, &params) total := uint64(0) for total <= maxSearchEntries { </s> remove return entries, 0 </s> add return entries, time.Time{}, 0
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
return entries, oldest, int(total)
<mask> r.BeginReadPrev(olderThan, getDataLimit) <mask> } <mask> <mask> r.Close() <mask> return entries, total <mask> } <mask> <mask> // Parameters for getData() <mask> type getDataParams struct { <mask> OlderThan time.Time // return entries that are older than this value </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove QuestionType uint16 // filter by question type </s> add QuestionType string // filter by question type </s> remove totalChunks++ r.BeginReadPrev(olderThan, getDataLimit) </s> add total += r.Total() oldest = r.Oldest() r.BeginReadPrev(getDataLimit) </s> remove return entries, 0 </s> add return entries, time.Time{}, 0 </s> remove r.BeginRead(olderThan, getDataLimit) for totalChunks < maxFilteringChunks { first := true </s> add r.BeginRead(params.OlderThan, getDataLimit, &params) total := uint64(0) for total <= maxSearchEntries {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
QuestionType string // filter by question type
<mask> type getDataParams struct { <mask> OlderThan time.Time // return entries that are older than this value <mask> Domain string // filter by domain name in question <mask> Client string // filter by client IP <mask> QuestionType uint16 // filter by question type <mask> ResponseStatus responseStatusType // filter by response status <mask> StrictMatchDomain bool // if Domain value must be matched strictly <mask> StrictMatchClient bool // if Client value must be matched strictly <mask> } <mask> </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove return entries, total </s> add return entries, oldest, int(total) </s> remove Question []byte </s> add IP string `json:"IP"` Time time.Time `json:"T"` QHost string `json:"QH"` QType string `json:"QT"` QClass string `json:"QC"` </s> remove ql *queryLog </s> add ql *queryLog search *getDataParams </s> remove Time time.Time </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
func (l *queryLog) getData(params getDataParams) map[string]interface{} {
<mask> responseStatusFiltered <mask> ) <mask> <mask> // Get log entries <mask> func (l *queryLog) getData(params getDataParams) []map[string]interface{} { <mask> var data = []map[string]interface{}{} <mask> <mask> if len(params.Domain) != 0 && params.StrictMatchDomain { <mask> params.Domain = params.Domain + "." <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if len(params.Domain) != 0 && params.StrictMatchDomain { params.Domain = params.Domain + "." } </s> add var oldest time.Time </s> remove if len(params.Domain) != 0 || params.QuestionType != 0 { m := dns.Msg{} _ = m.Unpack(entry.Question) if params.QuestionType != 0 { if m.Question[0].Qtype != params.QuestionType { return false } } if len(params.Domain) != 0 && params.StrictMatchDomain { if m.Question[0].Name != params.Domain { return false } } else if len(params.Domain) != 0 { if strings.Index(m.Question[0].Name, params.Domain) == -1 { return false } </s> add if len(params.QuestionType) != 0 { if entry.QType != params.QuestionType { return false </s> remove func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, int) { </s> add func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, time.Time, int) { </s> remove olderThan := params.OlderThan totalChunks := 0 total := 0 </s> add oldest := time.Time{} </s> remove return data </s> add var result = map[string]interface{}{} if len(entries) == getDataLimit { oldest = entries[0].Time } result["oldest"] = "" if !oldest.IsZero() { result["oldest"] = oldest.Format(time.RFC3339Nano) } result["data"] = data return result
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
var oldest time.Time
<mask> // Get log entries <mask> func (l *queryLog) getData(params getDataParams) []map[string]interface{} { <mask> var data = []map[string]interface{}{} <mask> <mask> if len(params.Domain) != 0 && params.StrictMatchDomain { <mask> params.Domain = params.Domain + "." <mask> } <mask> <mask> now := time.Now() <mask> entries := []*logEntry{} <mask> total := 0 <mask> <mask> // add from file </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove func (l *queryLog) getData(params getDataParams) []map[string]interface{} { </s> add func (l *queryLog) getData(params getDataParams) map[string]interface{} { </s> remove entries, total = l.readFromFile(params) </s> add entries, oldest, total = l.readFromFile(params) </s> remove func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, int) { </s> add func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, time.Time, int) { </s> remove if len(params.Domain) != 0 || params.QuestionType != 0 { m := dns.Msg{} _ = m.Unpack(entry.Question) if params.QuestionType != 0 { if m.Question[0].Qtype != params.QuestionType { return false } } if len(params.Domain) != 0 && params.StrictMatchDomain { if m.Question[0].Name != params.Domain { return false } } else if len(params.Domain) != 0 { if strings.Index(m.Question[0].Name, params.Domain) == -1 { return false } </s> add if len(params.QuestionType) != 0 { if entry.QType != params.QuestionType { return false </s> remove olderThan := params.OlderThan totalChunks := 0 total := 0 </s> add oldest := time.Time{}
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
entries, oldest, total = l.readFromFile(params)
<mask> entries := []*logEntry{} <mask> total := 0 <mask> <mask> // add from file <mask> entries, total = l.readFromFile(params) <mask> <mask> if params.OlderThan.IsZero() { <mask> params.OlderThan = now <mask> } <mask> </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if len(params.Domain) != 0 && params.StrictMatchDomain { params.Domain = params.Domain + "." } </s> add var oldest time.Time </s> remove olderThan := params.OlderThan totalChunks := 0 total := 0 </s> add oldest := time.Time{} </s> remove totalChunks++ r.BeginReadPrev(olderThan, getDataLimit) </s> add total += r.Total() oldest = r.Oldest() r.BeginReadPrev(getDataLimit) </s> remove func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, int) { </s> add func (l *queryLog) readFromFile(params getDataParams) ([]*logEntry, time.Time, int) { </s> remove return entries, 0 </s> add return entries, time.Time{}, 0
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
<mask> <mask> // process the elements from latest to oldest <mask> for i := len(entries) - 1; i >= 0; i-- { <mask> entry := entries[i] <mask> var q *dns.Msg <mask> var a *dns.Msg <mask> <mask> if len(entry.Question) == 0 { <mask> continue <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil { </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr) </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val) </s> remove return data </s> add var result = map[string]interface{}{} if len(entries) == getDataLimit { oldest = entries[0].Time } result["oldest"] = "" if !oldest.IsZero() { result["oldest"] = oldest.Format(time.RFC3339Nano) } result["data"] = data return result
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
<mask> entry := entries[i] <mask> var q *dns.Msg <mask> var a *dns.Msg <mask> <mask> if len(entry.Question) == 0 { <mask> continue <mask> } <mask> q = new(dns.Msg) <mask> if err := q.Unpack(entry.Question); err != nil { <mask> log.Tracef("q.Unpack(): %s", err) <mask> continue <mask> } <mask> if len(q.Question) != 1 { <mask> log.Tracef("len(q.Question) != 1") <mask> continue <mask> } <mask> <mask> if len(entry.Answer) > 0 { <mask> a = new(dns.Msg) <mask> if err := a.Unpack(entry.Answer); err != nil { <mask> log.Debug("Failed to unpack dns message answer: %s", err) <mask> a = nil </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove log.Debug("Failed to unpack dns message answer: %s", err) </s> add log.Debug("Failed to unpack dns message answer: %s: %s", err, string(entry.Answer)) </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr) </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil { </s> remove log.Debug("QueryLog: Failed to decode: %s", err) </s> add log.Debug("QueryLog: failed to decode") </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
log.Debug("Failed to unpack dns message answer: %s: %s", err, string(entry.Answer))
<mask> <mask> if len(entry.Answer) > 0 { <mask> a = new(dns.Msg) <mask> if err := a.Unpack(entry.Answer); err != nil { <mask> log.Debug("Failed to unpack dns message answer: %s", err) <mask> a = nil <mask> } <mask> } <mask> <mask> jsonEntry := map[string]interface{}{ </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr) </s> remove log.Debug("QueryLog: Failed to decode: %s", err) </s> add log.Debug("QueryLog: failed to decode") </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val) </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
"host": entry.QHost, "type": entry.QType, "class": entry.QClass,
<mask> "time": entry.Time.Format(time.RFC3339Nano), <mask> "client": entry.IP, <mask> } <mask> jsonEntry["question"] = map[string]interface{}{ <mask> "host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")), <mask> "type": dns.Type(q.Question[0].Qtype).String(), <mask> "class": dns.Class(q.Question[0].Qclass).String(), <mask> } <mask> <mask> if a != nil { <mask> jsonEntry["status"] = dns.RcodeToString[a.Rcode] <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove log.Debug("Failed to unpack dns message answer: %s", err) </s> add log.Debug("Failed to unpack dns message answer: %s: %s", err, string(entry.Answer)) </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr) </s> remove return data </s> add var result = map[string]interface{}{} if len(entries) == getDataLimit { oldest = entries[0].Time } result["oldest"] = "" if !oldest.IsZero() { result["oldest"] = oldest.Format(time.RFC3339Nano) } result["data"] = data return result </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
var result = map[string]interface{}{} if len(entries) == getDataLimit { oldest = entries[0].Time } result["oldest"] = "" if !oldest.IsZero() { result["oldest"] = oldest.Format(time.RFC3339Nano) } result["data"] = data return result
<mask> } <mask> <mask> log.Debug("QueryLog: prepared data (%d/%d) older than %s in %s", <mask> len(entries), total, params.OlderThan, time.Since(now)) <mask> return data <mask> } <mask> <mask> func answerToMap(a *dns.Msg) []map[string]interface{} { <mask> if a == nil || len(a.Answer) == 0 { <mask> return nil </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil { </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val) </s> remove log.Debug("QueryLog: Failed to decode: %s", err) </s> add log.Debug("QueryLog: failed to decode") </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog.go
_, ok := dns.StringToType[req.filterQuestionType]
<mask> params.StrictMatchClient = true <mask> } <mask> <mask> if len(req.filterQuestionType) != 0 { <mask> qtype, ok := dns.StringToType[req.filterQuestionType] <mask> if !ok { <mask> httpError(r, w, http.StatusBadRequest, "invalid question_type") <mask> return <mask> } <mask> params.QuestionType = qtype </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove params.QuestionType = qtype </s> add params.QuestionType = req.filterQuestionType </s> remove if len(params.Domain) != 0 || params.QuestionType != 0 { m := dns.Msg{} _ = m.Unpack(entry.Question) if params.QuestionType != 0 { if m.Question[0].Qtype != params.QuestionType { return false } } if len(params.Domain) != 0 && params.StrictMatchDomain { if m.Question[0].Name != params.Domain { return false } } else if len(params.Domain) != 0 { if strings.Index(m.Question[0].Name, params.Domain) == -1 { return false } </s> add if len(params.QuestionType) != 0 { if entry.QType != params.QuestionType { return false </s> remove } else if len(params.Client) != 0 { if strings.Index(entry.IP, params.Client) == -1 { </s> add } if len(params.Client) != 0 { if (params.StrictMatchClient && entry.IP != params.Client) || (!params.StrictMatchClient && strings.Index(entry.IP, params.Client) == -1) { </s> remove if len(params.Client) != 0 && params.StrictMatchClient { if entry.IP != params.Client { </s> add if len(params.Domain) != 0 { if (params.StrictMatchDomain && entry.QHost != params.Domain) || (!params.StrictMatchDomain && strings.Index(entry.QHost, params.Domain) == -1) { </s> remove // open decoder </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog_http.go
params.QuestionType = req.filterQuestionType
<mask> if !ok { <mask> httpError(r, w, http.StatusBadRequest, "invalid question_type") <mask> return <mask> } <mask> params.QuestionType = qtype <mask> } <mask> <mask> if len(req.filterResponseStatus) != 0 { <mask> switch req.filterResponseStatus { <mask> case "filtered": </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove qtype, ok := dns.StringToType[req.filterQuestionType] </s> add _, ok := dns.StringToType[req.filterQuestionType] </s> remove if len(params.Domain) != 0 || params.QuestionType != 0 { m := dns.Msg{} _ = m.Unpack(entry.Question) if params.QuestionType != 0 { if m.Question[0].Qtype != params.QuestionType { return false } } if len(params.Domain) != 0 && params.StrictMatchDomain { if m.Question[0].Name != params.Domain { return false } } else if len(params.Domain) != 0 { if strings.Index(m.Question[0].Name, params.Domain) == -1 { return false } </s> add if len(params.QuestionType) != 0 { if entry.QType != params.QuestionType { return false </s> remove if len(params.Client) != 0 && params.StrictMatchClient { if entry.IP != params.Client { </s> add if len(params.Domain) != 0 { if (params.StrictMatchDomain && entry.QHost != params.Domain) || (!params.StrictMatchDomain && strings.Index(entry.QHost, params.Domain) == -1) { </s> remove } else if len(params.Client) != 0 { if strings.Index(entry.IP, params.Client) == -1 { </s> add } if len(params.Client) != 0 { if (params.StrictMatchClient && entry.IP != params.Client) || (!params.StrictMatchClient && strings.Index(entry.IP, params.Client) == -1) { </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/qlog_http.go
"encoding/base64"
<mask> "bufio" <mask> "bytes" <mask> "compress/gzip" <mask> "encoding/json" <mask> "io" <mask> "os" <mask> "strconv" <mask> "strings" <mask> "time" </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove m := d[0] </s> add mdata := d["data"].([]map[string]interface{}) m := mdata[0] </s> remove return entries, 0 </s> add return entries, time.Time{}, 0 </s> remove entries, total = l.readFromFile(params) </s> add entries, oldest, total = l.readFromFile(params)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
"strconv"
<mask> "encoding/base64" <mask> "encoding/json" <mask> "io" <mask> "os" <mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/dnsfilter" </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove m := d[0] </s> add mdata := d["data"].([]map[string]interface{}) m := mdata[0] </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
<mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> const enableGzip = false <mask> const maxEntrySize = 1000 </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove r.searching = false </s> add r.seeking = false </s> remove if r.latest { r.olderThan = r.now.UnixNano() } </s> add r.count = 0 </s> remove r.searching = false </s> add r.seeking = false </s> remove func (l *queryLog) getData(params getDataParams) []map[string]interface{} { </s> add func (l *queryLog) getData(params getDataParams) map[string]interface{} {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
"github.com/miekg/dns"
<mask> "github.com/AdguardTeam/AdGuardHome/dnsfilter" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> const enableGzip = false <mask> const maxEntrySize = 1000 <mask> </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove r.searching = false </s> add r.seeking = false </s> remove if r.latest { r.olderThan = r.now.UnixNano() } </s> add r.count = 0 </s> remove r.searching = false </s> add r.seeking = false </s> remove func (l *queryLog) getData(params getDataParams) []map[string]interface{} { </s> add func (l *queryLog) getData(params getDataParams) map[string]interface{} {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
ql *queryLog search *getDataParams
<mask> } <mask> <mask> // Reader is the DB reader context <mask> type Reader struct { <mask> ql *queryLog <mask> <mask> f *os.File <mask> reader *bufio.Reader // reads file line by line <mask> now time.Time <mask> validFrom int64 // UNIX time (ns) </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove QuestionType uint16 // filter by question type </s> add QuestionType string // filter by question type </s> remove searching bool // we're seaching for an entry with exact time stamp </s> add seeking bool // we're seaching for an entry with exact time stamp </s> remove // maximum data chunks to parse when filtering entries maxFilteringChunks = 10 </s> add // maximum entries to parse when searching maxSearchEntries = 50000
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
oldest time.Time
<mask> now time.Time <mask> validFrom int64 // UNIX time (ns) <mask> olderThan int64 // UNIX time (ns) <mask> <mask> files []string <mask> ifile int <mask> </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove ql *queryLog </s> add ql *queryLog search *getDataParams </s> remove // Total returns the total number of items func (r *Reader) Total() int { return 0 </s> add // Total returns the total number of processed items func (r *Reader) Total() uint64 { return r.count } // Oldest returns the time of the oldest processed entry func (r *Reader) Oldest() time.Time { return r.oldest </s> remove searching bool // we're seaching for an entry with exact time stamp </s> add seeking bool // we're seaching for an entry with exact time stamp </s> remove func (r *Reader) BeginRead(olderThan time.Time, count uint64) { </s> add func (r *Reader) BeginRead(olderThan time.Time, count uint64, search *getDataParams) { </s> remove if len(params.Domain) != 0 && params.StrictMatchDomain { params.Domain = params.Domain + "." } </s> add var oldest time.Time
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
seeking bool // we're seaching for an entry with exact time stamp
<mask> count uint64 // counter for returned elements <mask> latest bool // return the latest entries <mask> filePrepared bool <mask> <mask> searching bool // we're seaching for an entry with exact time stamp <mask> fseeker fileSeeker // file seeker object <mask> fpos uint64 // current file offset <mask> nSeekRequests uint32 // number of Seek() requests made (finding a new line doesn't count) <mask> } <mask> </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove var q *dns.Msg </s> add </s> remove // Total returns the total number of items func (r *Reader) Total() int { return 0 </s> add // Total returns the total number of processed items func (r *Reader) Total() uint64 { return r.count } // Oldest returns the time of the oldest processed entry func (r *Reader) Oldest() time.Time { return r.oldest </s> remove func (r *Reader) BeginRead(olderThan time.Time, count uint64) { </s> add func (r *Reader) BeginRead(olderThan time.Time, count uint64, search *getDataParams) { </s> remove ql *queryLog </s> add ql *queryLog search *getDataParams
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
timecnt uint64
<mask> fpos uint64 // current file offset <mask> nSeekRequests uint32 // number of Seek() requests made (finding a new line doesn't count) <mask> } <mask> <mask> type fileSeeker struct { <mask> target uint64 // target value <mask> <mask> pos uint64 // current offset, may be adjusted by user for increased accuracy </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove searching bool // we're seaching for an entry with exact time stamp </s> add seeking bool // we're seaching for an entry with exact time stamp </s> remove QuestionType uint16 // filter by question type </s> add QuestionType string // filter by question type </s> remove ql *queryLog </s> add ql *queryLog search *getDataParams </s> remove // Total returns the total number of items func (r *Reader) Total() int { return 0 </s> add // Total returns the total number of processed items func (r *Reader) Total() uint64 { return r.count } // Oldest returns the time of the oldest processed entry func (r *Reader) Oldest() time.Time { return r.oldest </s> remove return entries, total </s> add return entries, oldest, int(total)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
log.Debug("querylog: read %d entries in %v, %v/entry, seek-reqs:%d time:%dus (%d%%)", r.count, elapsed, perunit, r.nSeekRequests, r.timecnt/1000, r.timecnt*100/uint64(elapsed.Nanoseconds()))
<mask> var perunit time.Duration <mask> if r.count > 0 { <mask> perunit = elapsed / time.Duration(r.count) <mask> } <mask> log.Debug("querylog: read %d entries in %v, %v/entry, seek-reqs:%d", <mask> r.count, elapsed, perunit, r.nSeekRequests) <mask> <mask> if r.f != nil { <mask> r.f.Close() <mask> } <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add </s> remove return data </s> add var result = map[string]interface{}{} if len(entries) == getDataLimit { oldest = entries[0].Time } result["oldest"] = "" if !oldest.IsZero() { result["oldest"] = oldest.Format(time.RFC3339Nano) } result["data"] = data return result </s> remove strReader := strings.NewReader(string(b)) jd := json.NewDecoder(strReader) </s> add str := string(b) </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val) </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
func (r *Reader) BeginRead(olderThan time.Time, count uint64, search *getDataParams) {
<mask> <mask> // BeginRead - start reading <mask> // olderThan: stop returning entries when an entry with this time is reached <mask> // count: minimum number of entries to return <mask> func (r *Reader) BeginRead(olderThan time.Time, count uint64) { <mask> r.olderThan = olderThan.UnixNano() <mask> r.latest = olderThan.IsZero() <mask> r.limit = count <mask> if r.latest { <mask> r.olderThan = r.now.UnixNano() </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { r.olderThan = olderThan.UnixNano() r.latest = olderThan.IsZero() </s> add func (r *Reader) BeginReadPrev(count uint64) { r.olderThan = r.oldest.UnixNano() r.oldest = time.Time{} r.latest = false </s> remove if r.latest { r.olderThan = r.now.UnixNano() } </s> add r.count = 0 </s> remove r.searching = false </s> add r.seeking = false </s> remove searching bool // we're seaching for an entry with exact time stamp </s> add seeking bool // we're seaching for an entry with exact time stamp
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
r.oldest = time.Time{} r.search = search
<mask> // count: minimum number of entries to return <mask> func (r *Reader) BeginRead(olderThan time.Time, count uint64, search *getDataParams) { <mask> r.olderThan = olderThan.UnixNano() <mask> r.latest = olderThan.IsZero() <mask> r.limit = count <mask> if r.latest { <mask> r.olderThan = r.now.UnixNano() <mask> } <mask> r.filePrepared = false </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove func (r *Reader) BeginRead(olderThan time.Time, count uint64) { </s> add func (r *Reader) BeginRead(olderThan time.Time, count uint64, search *getDataParams) { </s> remove func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { r.olderThan = olderThan.UnixNano() r.latest = olderThan.IsZero() </s> add func (r *Reader) BeginReadPrev(count uint64) { r.olderThan = r.oldest.UnixNano() r.oldest = time.Time{} r.latest = false </s> remove if r.latest { r.olderThan = r.now.UnixNano() } </s> add r.count = 0 </s> remove r.searching = false </s> add r.seeking = false </s> remove // Total returns the total number of items func (r *Reader) Total() int { return 0 </s> add // Total returns the total number of processed items func (r *Reader) Total() uint64 { return r.count } // Oldest returns the time of the oldest processed entry func (r *Reader) Oldest() time.Time { return r.oldest
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
r.seeking = false
<mask> if r.latest { <mask> r.olderThan = r.now.UnixNano() <mask> } <mask> r.filePrepared = false <mask> r.searching = false <mask> } <mask> <mask> // BeginReadPrev - start reading the previous data chunk <mask> func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { <mask> r.olderThan = olderThan.UnixNano() </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { r.olderThan = olderThan.UnixNano() r.latest = olderThan.IsZero() </s> add func (r *Reader) BeginReadPrev(count uint64) { r.olderThan = r.oldest.UnixNano() r.oldest = time.Time{} r.latest = false </s> remove if r.latest { r.olderThan = r.now.UnixNano() } </s> add r.count = 0 </s> remove func (r *Reader) BeginRead(olderThan time.Time, count uint64) { </s> add func (r *Reader) BeginRead(olderThan time.Time, count uint64, search *getDataParams) { </s> remove r.searching = false </s> add r.seeking = false
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
func (r *Reader) BeginReadPrev(count uint64) { r.olderThan = r.oldest.UnixNano() r.oldest = time.Time{} r.latest = false
<mask> r.searching = false <mask> } <mask> <mask> // BeginReadPrev - start reading the previous data chunk <mask> func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { <mask> r.olderThan = olderThan.UnixNano() <mask> r.latest = olderThan.IsZero() <mask> r.limit = count <mask> if r.latest { <mask> r.olderThan = r.now.UnixNano() <mask> } <mask> </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove r.searching = false </s> add r.seeking = false </s> remove if r.latest { r.olderThan = r.now.UnixNano() } </s> add r.count = 0 </s> remove func (r *Reader) BeginRead(olderThan time.Time, count uint64) { </s> add func (r *Reader) BeginRead(olderThan time.Time, count uint64, search *getDataParams) { </s> remove r.searching = false </s> add r.seeking = false
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
r.count = 0
<mask> func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { <mask> r.olderThan = olderThan.UnixNano() <mask> r.latest = olderThan.IsZero() <mask> r.limit = count <mask> if r.latest { <mask> r.olderThan = r.now.UnixNano() <mask> } <mask> <mask> off := r.fpos - maxEntrySize*(r.limit+1) <mask> if int64(off) < maxEntrySize { <mask> off = 0 <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { r.olderThan = olderThan.UnixNano() r.latest = olderThan.IsZero() </s> add func (r *Reader) BeginReadPrev(count uint64) { r.olderThan = r.oldest.UnixNano() r.oldest = time.Time{} r.latest = false </s> remove r.searching = false </s> add r.seeking = false </s> remove func (r *Reader) BeginRead(olderThan time.Time, count uint64) { </s> add func (r *Reader) BeginRead(olderThan time.Time, count uint64, search *getDataParams) { </s> remove r.searching = false </s> add r.seeking = false
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
r.seeking = false
<mask> r.seekToNewLine() <mask> r.fseeker.pos = r.fpos <mask> <mask> r.filePrepared = true <mask> r.searching = false <mask> } <mask> <mask> // Perform binary seek <mask> // Return 0: success; 1: seek reqiured; -1: error <mask> func (fs *fileSeeker) seekBinary(cur uint64) int32 { </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove r.searching = false </s> add r.seeking = false </s> remove r.searching = true </s> add r.seeking = true </s> remove func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { r.olderThan = olderThan.UnixNano() r.latest = olderThan.IsZero() </s> add func (r *Reader) BeginReadPrev(count uint64) { r.olderThan = r.oldest.UnixNano() r.oldest = time.Time{} r.latest = false </s> remove t := entry.Time.UnixNano() if r.searching { </s> add if r.seeking { </s> remove if r.latest { r.olderThan = r.now.UnixNano() } </s> add r.count = 0
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
r.seeking = true
<mask> return false <mask> } <mask> } else { <mask> // start searching in file: we'll read the first chunk of data from the middle of file <mask> r.searching = true <mask> r.fseeker = fileSeeker{} <mask> r.fseeker.target = uint64(r.olderThan) <mask> r.fseeker.hi = fsize <mask> rc := r.fseeker.seekBinary(0) <mask> r.fpos = r.fseeker.pos </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove r.searching = false </s> add r.seeking = false </s> remove r.searching = false </s> add r.seeking = false </s> remove func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { r.olderThan = olderThan.UnixNano() r.latest = olderThan.IsZero() </s> add func (r *Reader) BeginReadPrev(count uint64) { r.olderThan = r.oldest.UnixNano() r.oldest = time.Time{} r.latest = false </s> remove r.searching = false </s> add r.seeking = false </s> remove t := entry.Time.UnixNano() if r.searching { </s> add if r.seeking {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
<mask> } <mask> r.filePrepared = true <mask> } <mask> <mask> // open decoder <mask> b, err := r.reader.ReadBytes('\n') <mask> if err != nil { <mask> return nil <mask> } <mask> strReader := strings.NewReader(string(b)) </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove strReader := strings.NewReader(string(b)) jd := json.NewDecoder(strReader) </s> add str := string(b) </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val) </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr) </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add </s> remove var q []byte var a []byte var err error ip := getIPString(addr) if question == nil { </s> add if question == nil || len(question.Question) != 1 || len(question.Question[0].Name) == 0 || ip == nil {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
str := string(b)
<mask> b, err := r.reader.ReadBytes('\n') <mask> if err != nil { <mask> return nil <mask> } <mask> strReader := strings.NewReader(string(b)) <mask> jd := json.NewDecoder(strReader) <mask> <mask> // read data <mask> var entry logEntry <mask> err = jd.Decode(&entry) <mask> if err != nil { </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val) </s> remove // open decoder </s> add </s> remove log.Debug("QueryLog: Failed to decode: %s", err) </s> add log.Debug("QueryLog: failed to decode") </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr) </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val)
<mask> } <mask> strReader := strings.NewReader(string(b)) <mask> jd := json.NewDecoder(strReader) <mask> <mask> // read data <mask> var entry logEntry <mask> err = jd.Decode(&entry) <mask> if err != nil { <mask> log.Debug("QueryLog: Failed to decode: %s", err) <mask> continue <mask> } <mask> </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove log.Debug("QueryLog: Failed to decode: %s", err) </s> add log.Debug("QueryLog: failed to decode") </s> remove strReader := strings.NewReader(string(b)) jd := json.NewDecoder(strReader) </s> add str := string(b) </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add </s> remove t := entry.Time.UnixNano() if r.searching { </s> add if r.seeking { </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
log.Debug("QueryLog: failed to decode")
<mask> // read data <mask> var entry logEntry <mask> err = jd.Decode(&entry) <mask> if err != nil { <mask> log.Debug("QueryLog: Failed to decode: %s", err) <mask> continue <mask> } <mask> <mask> t := entry.Time.UnixNano() <mask> if r.searching { </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val) </s> remove t := entry.Time.UnixNano() if r.searching { </s> add if r.seeking { </s> remove strReader := strings.NewReader(string(b)) jd := json.NewDecoder(strReader) </s> add str := string(b) </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add </s> remove q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return } </s> add var a []byte var err error ip := getIPString(addr)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
t := tm.UnixNano()
<mask> log.Debug("QueryLog: failed to decode") <mask> continue <mask> } <mask> <mask> if r.seeking { <mask> <mask> r.reader = nil </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove log.Debug("QueryLog: Failed to decode: %s", err) </s> add log.Debug("QueryLog: failed to decode") </s> remove t := entry.Time.UnixNano() if r.searching { </s> add if r.seeking { </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val) </s> remove if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue } if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue } </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
if r.seeking {
<mask> log.Debug("QueryLog: Failed to decode: %s", err) <mask> continue <mask> } <mask> <mask> t := entry.Time.UnixNano() <mask> if r.searching { <mask> <mask> r.reader = nil <mask> rr := r.fseeker.seekBinary(uint64(t)) <mask> r.fpos = r.fseeker.pos <mask> if rr < 0 { </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove log.Debug("QueryLog: Failed to decode: %s", err) </s> add log.Debug("QueryLog: failed to decode") </s> remove // read data var entry logEntry err = jd.Decode(&entry) </s> add val := readJSONValue(str, "T") if len(val) == 0 { val = readJSONValue(str, "Time") } if len(val) == 0 { log.Debug("QueryLog: failed to decode") continue } tm, err := time.Parse(time.RFC3339, val) </s> remove r.searching = false </s> add r.seeking = false
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
r.seeking = false
<mask> return nil <mask> } else if rr == 0 { <mask> // We found the target entry. <mask> // We'll start reading the previous chunk of data. <mask> r.searching = false <mask> <mask> off := r.fpos - (maxEntrySize * (r.limit + 1)) <mask> if int64(off) < maxEntrySize { <mask> off = 0 <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if r.latest { r.olderThan = r.now.UnixNano() } </s> add r.count = 0 </s> remove r.searching = false </s> add r.seeking = false </s> remove func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { r.olderThan = olderThan.UnixNano() r.latest = olderThan.IsZero() </s> add func (r *Reader) BeginReadPrev(count uint64) { r.olderThan = r.oldest.UnixNano() r.oldest = time.Time{} r.latest = false </s> remove r.searching = true </s> add r.seeking = true </s> remove t := entry.Time.UnixNano() if r.searching { </s> add if r.seeking {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
if r.oldest.IsZero() { r.oldest = tm }
<mask> } <mask> <mask> if t < r.validFrom { <mask> continue <mask> } <mask> if t >= r.olderThan { <mask> return nil <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove t := entry.Time.UnixNano() if r.searching { </s> add if r.seeking { </s> remove log.Debug("QueryLog: Failed to decode: %s", err) </s> add log.Debug("QueryLog: failed to decode") </s> remove if r.latest { r.olderThan = r.now.UnixNano() } </s> add r.count = 0 </s> remove total++ if first { first = false olderThan = entry.Time } </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
if !r.applySearch(str) { continue } st := time.Now() var ent logEntry decode(&ent, str) r.timecnt += uint64(time.Now().Sub(st).Nanoseconds()) return &ent
<mask> return nil <mask> } <mask> <mask> r.count++ <mask> return &entry <mask> } <mask> } <mask> <mask> // Total returns the total number of items <mask> func (r *Reader) Total() int { </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove // Total returns the total number of items func (r *Reader) Total() int { return 0 </s> add // Total returns the total number of processed items func (r *Reader) Total() uint64 { return r.count } // Oldest returns the time of the oldest processed entry func (r *Reader) Oldest() time.Time { return r.oldest </s> remove func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { r.olderThan = olderThan.UnixNano() r.latest = olderThan.IsZero() </s> add func (r *Reader) BeginReadPrev(count uint64) { r.olderThan = r.oldest.UnixNano() r.oldest = time.Time{} r.latest = false </s> remove r.searching = false </s> add r.seeking = false </s> remove func (r *Reader) BeginRead(olderThan time.Time, count uint64) { </s> add func (r *Reader) BeginRead(olderThan time.Time, count uint64, search *getDataParams) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
// Total returns the total number of processed items func (r *Reader) Total() uint64 { return r.count } // Oldest returns the time of the oldest processed entry func (r *Reader) Oldest() time.Time { return r.oldest
<mask> return &entry <mask> } <mask> } <mask> <mask> // Total returns the total number of items <mask> func (r *Reader) Total() int { <mask> return 0 <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove return &entry </s> add if !r.applySearch(str) { continue } st := time.Now() var ent logEntry decode(&ent, str) r.timecnt += uint64(time.Now().Sub(st).Nanoseconds()) return &ent </s> remove func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) { r.olderThan = olderThan.UnixNano() r.latest = olderThan.IsZero() </s> add func (r *Reader) BeginReadPrev(count uint64) { r.olderThan = r.oldest.UnixNano() r.oldest = time.Time{} r.latest = false </s> remove r.searching = false </s> add r.seeking = false </s> remove func (r *Reader) BeginRead(olderThan time.Time, count uint64) { </s> add func (r *Reader) BeginRead(olderThan time.Time, count uint64, search *getDataParams) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_file.go
mdata := d["data"].([]map[string]interface{}) m := mdata[0]
<mask> params := getDataParams{ <mask> OlderThan: time.Now(), <mask> } <mask> d := l.getData(params) <mask> m := d[0] <mask> mq := m["question"].(map[string]interface{}) <mask> assert.True(t, mq["host"].(string) == "example.org") <mask> } </s> * querylog: major refactor: change on-disk format and API speed up decoding speed up search compatible with previous format (when not searching) </s> remove if len(params.Domain) != 0 || params.QuestionType != 0 { m := dns.Msg{} _ = m.Unpack(entry.Question) if params.QuestionType != 0 { if m.Question[0].Qtype != params.QuestionType { return false } } if len(params.Domain) != 0 && params.StrictMatchDomain { if m.Question[0].Name != params.Domain { return false } } else if len(params.Domain) != 0 { if strings.Index(m.Question[0].Name, params.Domain) == -1 { return false } </s> add if len(params.QuestionType) != 0 { if entry.QType != params.QuestionType { return false </s> remove if first || len(entries) == getDataLimit { </s> add if r.Total() == 0 || len(entries) == getDataLimit { </s> remove totalChunks++ r.BeginReadPrev(olderThan, getDataLimit) </s> add total += r.Total() oldest = r.Oldest() r.BeginReadPrev(getDataLimit) </s> remove total++ if first { first = false olderThan = entry.Time } </s> add </s> remove if len(params.Client) != 0 && params.StrictMatchClient { if entry.IP != params.Client { </s> add if len(params.Domain) != 0 { if (params.StrictMatchDomain && entry.QHost != params.Domain) || (!params.StrictMatchDomain && strings.Index(entry.QHost, params.Domain) == -1) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f5d6593f2d9841f9c18b9ac60a554af60a34a6b
querylog/querylog_test.go
github.com/AdguardTeam/dnsproxy v0.39.0
<mask> <mask> go 1.16 <mask> <mask> require ( <mask> github.com/AdguardTeam/dnsproxy v0.38.3 <mask> github.com/AdguardTeam/golibs v0.8.0 <mask> github.com/AdguardTeam/urlfilter v0.14.6 <mask> github.com/NYTimes/gziphandler v1.1.1 <mask> github.com/ameshkov/dnscrypt/v2 v2.1.3 <mask> github.com/digineo/go-ipset/v2 v2.2.1 </s> Pull request: 2799 trusted proxy Merge in DNS/adguard-home from 2799-trusted-proxy to master Updates #2799. Squashed commit of the following: commit 708a06b30116126a575767ea70865a6de90de774 Author: Eugene Burkov <[email protected]> Date: Fri Jul 23 18:56:16 2021 +0300 all: add trusted proxy mechanism
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f661df88cf4a11a86c1fbfb8dae9b2cd79ada09
go.mod
github.com/AdguardTeam/dnsproxy v0.39.0 h1:5/PN2mpUeCTWtvqXUbSPTMJSOad4lJscPzm+C2f4jB4= github.com/AdguardTeam/dnsproxy v0.39.0/go.mod h1:aNXKNdTyKfgAG2OS712SYSaGIM9AasZsZxfiY4YiR/0=
<mask> github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf h1:gc042VRSIRSUzZ+Px6xQCRWNJZTaPkomisDfUZmoFNk= <mask> github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf/go.mod h1:TKl4jN3Voofo4UJIicyNhWGp/nlQqQkFxmwIFTvBkKI= <mask> github.com/AdguardTeam/dnsproxy v0.38.3 h1:DvycTEOn2wuHmY+HE5XL4EnCV2EVbpREpbgZB06IJ0I= <mask> github.com/AdguardTeam/dnsproxy v0.38.3/go.mod h1:aNXKNdTyKfgAG2OS712SYSaGIM9AasZsZxfiY4YiR/0= <mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.8.0 h1:rHo+yIgT2fivFG0yW2Cwk/DPc2+t/Aw6QvzPpiIFre0= <mask> github.com/AdguardTeam/golibs v0.8.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU= </s> Pull request: 2799 trusted proxy Merge in DNS/adguard-home from 2799-trusted-proxy to master Updates #2799. Squashed commit of the following: commit 708a06b30116126a575767ea70865a6de90de774 Author: Eugene Burkov <[email protected]> Date: Fri Jul 23 18:56:16 2021 +0300 all: add trusted proxy mechanism </s> remove github.com/AdguardTeam/dnsproxy v0.38.3 </s> add github.com/AdguardTeam/dnsproxy v0.39.0
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f661df88cf4a11a86c1fbfb8dae9b2cd79ada09
go.sum
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
<mask> github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= <mask> github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714 h1:/jC7qQFrv8CrSJVmaolDVOxTfS9kc36uB6H40kdbQq8= <mask> github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714/go.mod h1:2Goc3h8EklBH5mspfHFxBnEoURQCGzQQH1ga9Myjvis= <mask> github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= <mask> github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= <mask> github.com/joomcode/errorx v1.0.1/go.mod h1:kgco15ekB6cs+4Xjzo7SPeXzx38PbJzBwbnu9qfVNHQ= <mask> github.com/joomcode/errorx v1.0.3 h1:3e1mi0u7/HTPNdg6d6DYyKGBhA5l9XpsfuVE29NxnWw= <mask> github.com/joomcode/errorx v1.0.3/go.mod h1:eQzdtdlNyN7etw6YCS4W4+lu442waxZYw5yvz0ULrRo= <mask> github.com/josharian/native v0.0.0-20200817173448-b6b71def0850 h1:uhL5Gw7BINiiPAo24A2sxkcDI0Jt/sqp1v5xQCniEFA= </s> Pull request: 2799 trusted proxy Merge in DNS/adguard-home from 2799-trusted-proxy to master Updates #2799. Squashed commit of the following: commit 708a06b30116126a575767ea70865a6de90de774 Author: Eugene Burkov <[email protected]> Date: Fri Jul 23 18:56:16 2021 +0300 all: add trusted proxy mechanism
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f661df88cf4a11a86c1fbfb8dae9b2cd79ada09
go.sum
// TrustedProxies is the list of IP addresses and CIDR networks to // detect proxy servers addresses the DoH requests from which should be // handled. The value of nil or an empty slice for this field makes // Proxy not trust any address. TrustedProxies []string `yaml:"trusted_proxies"`
<mask> DisallowedClients []string `yaml:"disallowed_clients"` // IP addresses of clients that should be blocked <mask> BlockedHosts []string `yaml:"blocked_hosts"` // hosts that should be blocked <mask> <mask> // DNS cache settings <mask> // -- <mask> <mask> CacheSize uint32 `yaml:"cache_size"` // DNS cache size (in bytes) </s> Pull request: 2799 trusted proxy Merge in DNS/adguard-home from 2799-trusted-proxy to master Updates #2799. Squashed commit of the following: commit 708a06b30116126a575767ea70865a6de90de774 Author: Eugene Burkov <[email protected]> Date: Fri Jul 23 18:56:16 2021 +0300 all: add trusted proxy mechanism
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f661df88cf4a11a86c1fbfb8dae9b2cd79ada09
internal/dnsforward/config.go
TrustedProxies: s.conf.TrustedProxies,
<mask> RatelimitWhitelist: s.conf.RatelimitWhitelist, <mask> RefuseAny: s.conf.RefuseAny, <mask> CacheMinTTL: s.conf.CacheMinTTL, <mask> CacheMaxTTL: s.conf.CacheMaxTTL, <mask> CacheOptimistic: s.conf.CacheOptimistic, <mask> UpstreamConfig: s.conf.UpstreamConfig, </s> Pull request: 2799 trusted proxy Merge in DNS/adguard-home from 2799-trusted-proxy to master Updates #2799. Squashed commit of the following: commit 708a06b30116126a575767ea70865a6de90de774 Author: Eugene Burkov <[email protected]> Date: Fri Jul 23 18:56:16 2021 +0300 all: add trusted proxy mechanism
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f661df88cf4a11a86c1fbfb8dae9b2cd79ada09
internal/dnsforward/config.go
c.TrustedProxies = aghstrings.CloneSlice(sc.TrustedProxies)
<mask> c.BootstrapDNS = aghstrings.CloneSlice(sc.BootstrapDNS) <mask> c.AllowedClients = aghstrings.CloneSlice(sc.AllowedClients) <mask> c.DisallowedClients = aghstrings.CloneSlice(sc.DisallowedClients) <mask> c.BlockedHosts = aghstrings.CloneSlice(sc.BlockedHosts) <mask> c.UpstreamDNS = aghstrings.CloneSlice(sc.UpstreamDNS) <mask> } <mask> <mask> // RDNSSettings returns the copy of actual RDNS configuration. <mask> func (s *Server) RDNSSettings() (localPTRResolvers []string, resolveClients, resolvePTR bool) { </s> Pull request: 2799 trusted proxy Merge in DNS/adguard-home from 2799-trusted-proxy to master Updates #2799. Squashed commit of the following: commit 708a06b30116126a575767ea70865a6de90de774 Author: Eugene Burkov <[email protected]> Date: Fri Jul 23 18:56:16 2021 +0300 all: add trusted proxy mechanism
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2f661df88cf4a11a86c1fbfb8dae9b2cd79ada09
internal/dnsforward/dnsforward.go