Pull request: upd-all

Merge in DNS/adguard-home from upd-all to master

Squashed commit of the following:

commit 1c71e4586daa7502f5dadd5ba4dc58a12a01f3b8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Feb 1 13:37:50 2023 +0300

    all: imp chlog; upd deps, i18n, services, trackers
This commit is contained in:
Ainar Garipov
2023-02-01 13:45:00 +03:00
parent 46382e8825
commit 04f4993385
40 changed files with 193 additions and 149 deletions

View File

@@ -110,8 +110,8 @@ func (c *sbCtx) getCached() int {
now := time.Now().Unix()
hashesToRequest := map[[32]byte]string{}
for k, v := range c.hashToHost {
key := k[0:2]
val := c.cache.Get(key)
// nolint:looppointer // The subsilce is used for a safe cache lookup.
val := c.cache.Get(k[0:2])
if val == nil || now >= int64(binary.BigEndian.Uint32(val)) {
hashesToRequest[k] = v
continue
@@ -186,8 +186,7 @@ func (c *sbCtx) getQuestion() string {
b := &strings.Builder{}
for hash := range c.hashToHost {
// TODO(e.burkov, a.garipov): Find out and document why exactly
// this slice.
// nolint:looppointer // The subsilce is used for safe hex encoding.
stringutil.WriteToBuilder(b, hex.EncodeToString(hash[0:2]), ".")
}
@@ -249,8 +248,8 @@ func (c *sbCtx) storeCache(hashes [][]byte) {
var curData []byte
var prevPrefix []byte
for i, hash := range hashes {
prefix := hash[0:2]
if !bytes.Equal(prefix, prevPrefix) {
// nolint:looppointer // The subsilce is used for a safe comparison.
if !bytes.Equal(hash[0:2], prevPrefix) {
if i != 0 {
c.setCache(prevPrefix, curData)
curData = nil
@@ -265,6 +264,7 @@ func (c *sbCtx) storeCache(hashes [][]byte) {
}
for hash := range c.hashToHost {
// nolint:looppointer // The subsilce is used for a safe cache lookup.
prefix := hash[0:2]
val := c.cache.Get(prefix)
if val == nil {