AdGuardHome/internal/client/persistent.go

288 lines
7.1 KiB
Go
Raw Normal View History

package client
import (
"encoding"
"fmt"
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
"net"
"net/netip"
"slices"
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
"strings"
"time"
Pull request: 1163 safesearch vol.2 Merge in DNS/adguard-home from 1163-safesearch-1-2-1 to master Squashed commit of the following: commit d3a5ebef35210019842145074e898129b42f1f2c Merge: b85264ae c6706445 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Mar 15 09:17:53 2023 +0700 Merge remote-tracking branch 'origin/master' into 1163-safesearch-1-2-1 # Conflicts: # CHANGELOG.md commit b85264aefc5f191ac6cb194b519f03ba15829a4e Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Mar 14 00:16:07 2023 +0700 home: imp code commit ac2ed7a5ce8db40628e7d4d1c8634641e5f38b0b Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 23:02:06 2023 +0700 all: changelog commit f0fccafcb01f50c7051df53bbe9b02cab75aa71e Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 22:42:36 2023 +0700 all: changelog commit 37df29bf6372939644fb28e3d70365496e0cb4f6 Merge: b227b277 595484e0 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 22:38:57 2023 +0700 Merge remote-tracking branch 'origin/master' into 1163-safesearch-1-2-1 commit b227b2775b4866d69241ad87acf99700715552cb Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 16:56:01 2023 +0700 all: imp docs commit 6fd39fc3565c3f4bc7a7113d17733c20dfe24d8d Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 16:55:03 2023 +0700 home: imp code commit 3bb3bb7c7dcf97b2a5602a7d2b6770c08b4d863d Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 12:16:53 2023 +0700 home: imp docs commit 5f573a56a9fd9942ad677fa0fae6b24228dab653 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 11:56:47 2023 +0700 home: imp code commit 23eeb5552cf2510596b2311cc3eda53ac678ffcc Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Mar 10 10:57:33 2023 +0700 home: imp code commit 643de2fca1b5917c61fe83e1e472222404f3cd21 Merge: dada6e63 a2053526 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 9 21:03:08 2023 +0700 Merge remote-tracking branch 'origin/master' into 1163-safesearch-1-2-1 commit dada6e63ca5324d30775e2da1727da891743f654 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 9 17:09:03 2023 +0700 all: imp docs commit 81a180d99dd9a995440d5f4e2ebca34678e7d0c7 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 9 15:12:43 2023 +0700 all: imp code commit fa84877bc777004d246d71d0a9ae0bd9ee568a91 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 9 10:53:05 2023 +0700 all: imp code commit 6d7e02e745d72921a693d4f09eec7ce21c2aefd4 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 9 10:40:02 2023 +0700 all: imp docs commit 0a4332997070fb8d2fb3a34d32b92f57a325ff06 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Mar 7 22:00:52 2023 +0700 safesearch: fix merge commit 145c2222ba4cf7f8909b816d83829d2217c94243 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 2 11:41:48 2023 +0700 safesearch: fix merge commit 14c6a8005fe15b5d5a39f91b17c96d8670975811 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Mar 1 12:50:09 2023 +0700 all: docs commit 2a85c8831866bf1c34c423a289461fc1e32667b5 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Mar 1 12:47:00 2023 +0700 all: use safesearch package
2023-03-15 14:31:07 +03:00
"github.com/AdguardTeam/AdGuardHome/internal/filtering"
"github.com/AdguardTeam/AdGuardHome/internal/filtering/safesearch"
"github.com/AdguardTeam/dnsproxy/proxy"
"github.com/AdguardTeam/golibs/container"
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/netutil"
"github.com/google/uuid"
)
// UID is the type for the unique IDs of persistent clients.
type UID uuid.UUID
// NewUID returns a new persistent client UID. Any error returned is an error
// from the cryptographic randomness reader.
func NewUID() (uid UID, err error) {
uuidv7, err := uuid.NewV7()
return UID(uuidv7), err
}
Pull request 2138: AG-27492-client-persistent-storage Squashed commit of the following: commit 37e33ec761cfa30164125af2c5bb40789412355e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Feb 14 15:25:25 2024 +0300 aghalg: imp code commit 6b2f09a44298b474ec1bdf3d027fb4941d2f7bea Merge: b8ea924aa 37736289e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Feb 14 15:04:59 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-storage commit b8ea924aa7ed4c052760a6068f945d83d184e7e3 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Feb 13 19:07:52 2024 +0300 home: imp tests commit aa6fec03b1a1ead96bc76919b7ad51ae19626633 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Feb 13 14:54:28 2024 +0300 home: imp docs commit 10637fdec47d0b035cf5c7949ddcd9ec564851a3 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Feb 8 20:16:11 2024 +0300 all: imp code commit b45c7d868ddb1be73e119b3260e2a866d57baa91 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Feb 7 19:15:11 2024 +0300 aghalg: add tests commit 7abe33dbaa7221ddbc8b7d802dbfa7f951d90cf8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Feb 6 20:50:22 2024 +0300 all: imp code, tests commit 4a44e993c9bd393d2cb9853108eae1ad91e64402 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Feb 1 14:59:11 2024 +0300 all: persistent client index commit 66b16e216e03e9f3d5e69496a89b18a9d732b564 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 31 15:06:05 2024 +0300 aghalg: ordered map
2024-02-15 14:08:05 +03:00
// MustNewUID is a wrapper around [NewUID] that panics if there is an error.
func MustNewUID() (uid UID) {
uid, err := NewUID()
if err != nil {
panic(fmt.Errorf("unexpected uuidv7 error: %w", err))
}
return uid
}
// type check
var _ encoding.TextMarshaler = UID{}
// MarshalText implements the [encoding.TextMarshaler] for UID.
func (uid UID) MarshalText() ([]byte, error) {
return uuid.UUID(uid).MarshalText()
}
// type check
var _ encoding.TextUnmarshaler = (*UID)(nil)
// UnmarshalText implements the [encoding.TextUnmarshaler] interface for UID.
func (uid *UID) UnmarshalText(data []byte) error {
return (*uuid.UUID)(uid).UnmarshalText(data)
}
// Persistent contains information about persistent clients.
type Persistent struct {
// UpstreamConfig is the custom upstream configuration for this client. If
Pull request: custom upstreams cache Merge in DNS/adguard-home from custom-ups-cache to master Squashed commit of the following: commit 98428a87520f70cb522701d8eccfe4c529be1e40 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 17 10:53:32 2023 +0200 all: upd dep commit 775a639af4a2a45220b17e8b0037edc126ff62e4 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 17 09:52:31 2023 +0200 dnsforward: imp test commit e9e2a58b48e8588dfcb28df319d4651e1fe77af5 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 17 09:44:46 2023 +0200 docs: changelog commit a6d67218f037c8fec29e5fa2967476d63c3cfc32 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 17 09:37:17 2023 +0200 all: upd dep commit b101ff6e0cf393dacdee6fb68d33ba8f11c36280 Merge: d61f4eb88 8bb1aad73 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Nov 16 15:54:05 2023 +0200 Merge remote-tracking branch 'origin/master' into custom-ups-cache commit d61f4eb8871f8ae8504259998bf9015b29001cfb Merge: 567a8a4af fdf60eeed Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Nov 13 10:32:22 2023 +0200 Merge remote-tracking branch 'origin/master' into custom-ups-cache commit 567a8a4af34ad001d0e6d7d2efdc123205569e8c Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Nov 13 10:30:24 2023 +0200 home: imp code commit a3c16facbebc166e5c0c731c1e892b61c0950d9e Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 14:34:04 2023 +0200 all: imp code commit 84160eafee1d0f2d0cd3f025f2d5070e4f597ad6 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 14:31:26 2023 +0200 all: conf custom ups cache commit b7f6581901ebad96c87e765a305a1fa5b336efbb Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 14:29:47 2023 +0200 all: conf custom ups cache commit d07df945d4e7614a679ef5dc77756096abf1e66c Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 09:26:29 2023 +0200 all: docs commit 998124bac08889c7d354dd1a099929726725bccc Merge: f665e2f85 53170d871 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 09:24:28 2023 +0200 Merge remote-tracking branch 'origin/master' into custom-ups-cache commit f665e2f85bce12d95f80aba6614b6bfd4874b122 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 09:22:46 2023 +0200 all: conf custom ups cache commit a4b26973bef4f3b339198ffbe52a50baca303daf Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Nov 9 12:46:39 2023 +0200 all: conf custom ups cache
2023-11-17 15:51:51 +03:00
// it's nil, it has not been initialized yet. If it's non-nil and empty,
// there are no valid upstreams. If it's non-nil and non-empty, these
// upstream must be used.
UpstreamConfig *proxy.CustomUpstreamConfig
Pull request: AG-31778-fix-safesearch-https Squashed commit of the following: commit 85ea3d985e83209e3b49119959aedd330df24d23 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Apr 18 15:19:38 2024 +0200 all: imp docs commit b0695daddbcf191454c5e829ca4d19def8ddacbf Merge: a79f98f2f 48c6242a7 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 17 11:06:49 2024 +0200 Merge remote-tracking branch 'origin/master' into AG-31778-fix-safesearch-https # Conflicts: # CHANGELOG.md commit a79f98f2f215a4a79ca4d186c0da33db936429dc Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 17 11:05:34 2024 +0200 dnsforward: imp code commit b901a1169cc78313298d70cce770cd1523ccbf9f Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Apr 16 11:03:52 2024 +0200 dnsforward: imp code commit fb6e66971b1b984147ec400ceaff856e7b5710c7 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Apr 16 10:08:51 2024 +0200 all: safesearch rewrites commit 88add21831fff7e04539f5dd299832883a6f3995 Merge: b78ad8f74 201ac73cf Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Apr 16 09:43:20 2024 +0200 Merge remote-tracking branch 'origin/master' into AG-31778-fix-safesearch-https # Conflicts: # CHANGELOG.md commit b78ad8f748c7fa52533e0541cae16bd51c201370 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Apr 12 13:34:39 2024 +0200 all: safesearch rewrites commit fb3efbb053242c537ca872542006917b8e8ac1ff Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Apr 11 13:15:37 2024 +0200 safesearch: imp code commit 1193c704f4d30be4a2cc66e84a31c9a6020ab269 Merge: 14e823d7c ff7c715c5 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Apr 11 13:13:44 2024 +0200 Merge remote-tracking branch 'origin/master' into AG-31778-fix-safesearch-https # Conflicts: # CHANGELOG.md commit 14e823d7cc13c275c2ed04704883a94b95e29963 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Apr 11 13:11:43 2024 +0200 all: safesearch https commit cd403a2897ae56a9059a78f24b104af5805d84ab Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Apr 11 12:09:27 2024 +0200 Revert "all: safesearch https" This reverts commit 1c9564b9b4db70f85b2f827cc06b65d2b67b08b1. commit 1c9564b9b4db70f85b2f827cc06b65d2b67b08b1 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 10 12:41:47 2024 +0200 all: safesearch https commit 5f42688fbab566973acc8dc414a992819492a9ac Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 10 09:22:30 2024 +0200 filtering: imp code commit eb9bd9f47cd71cafe8eee4698a8a0d5d25dea3d3 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 10 09:19:22 2024 +0200 all: changelog commit 0c77c705a942fe83d3809a7efbc8a6baf5886762 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 10 08:55:22 2024 +0200 safesearch: imp tests commit 492a93fbb5ff54678e22a15577f509b2327c2ebe Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Apr 9 14:45:16 2024 +0200 all: changelog commit a665e7246d11503c47d48ccc714e6862f764e930 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Apr 9 14:41:24 2024 +0200 safesearch: https req
2024-04-22 10:48:26 +03:00
SafeSearch filtering.SafeSearch
Pull request: 1163 safesearch vol.2 Merge in DNS/adguard-home from 1163-safesearch-1-2-1 to master Squashed commit of the following: commit d3a5ebef35210019842145074e898129b42f1f2c Merge: b85264ae c6706445 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Mar 15 09:17:53 2023 +0700 Merge remote-tracking branch 'origin/master' into 1163-safesearch-1-2-1 # Conflicts: # CHANGELOG.md commit b85264aefc5f191ac6cb194b519f03ba15829a4e Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Mar 14 00:16:07 2023 +0700 home: imp code commit ac2ed7a5ce8db40628e7d4d1c8634641e5f38b0b Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 23:02:06 2023 +0700 all: changelog commit f0fccafcb01f50c7051df53bbe9b02cab75aa71e Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 22:42:36 2023 +0700 all: changelog commit 37df29bf6372939644fb28e3d70365496e0cb4f6 Merge: b227b277 595484e0 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 22:38:57 2023 +0700 Merge remote-tracking branch 'origin/master' into 1163-safesearch-1-2-1 commit b227b2775b4866d69241ad87acf99700715552cb Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 16:56:01 2023 +0700 all: imp docs commit 6fd39fc3565c3f4bc7a7113d17733c20dfe24d8d Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 16:55:03 2023 +0700 home: imp code commit 3bb3bb7c7dcf97b2a5602a7d2b6770c08b4d863d Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 12:16:53 2023 +0700 home: imp docs commit 5f573a56a9fd9942ad677fa0fae6b24228dab653 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Mar 13 11:56:47 2023 +0700 home: imp code commit 23eeb5552cf2510596b2311cc3eda53ac678ffcc Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Mar 10 10:57:33 2023 +0700 home: imp code commit 643de2fca1b5917c61fe83e1e472222404f3cd21 Merge: dada6e63 a2053526 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 9 21:03:08 2023 +0700 Merge remote-tracking branch 'origin/master' into 1163-safesearch-1-2-1 commit dada6e63ca5324d30775e2da1727da891743f654 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 9 17:09:03 2023 +0700 all: imp docs commit 81a180d99dd9a995440d5f4e2ebca34678e7d0c7 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 9 15:12:43 2023 +0700 all: imp code commit fa84877bc777004d246d71d0a9ae0bd9ee568a91 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 9 10:53:05 2023 +0700 all: imp code commit 6d7e02e745d72921a693d4f09eec7ce21c2aefd4 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 9 10:40:02 2023 +0700 all: imp docs commit 0a4332997070fb8d2fb3a34d32b92f57a325ff06 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Mar 7 22:00:52 2023 +0700 safesearch: fix merge commit 145c2222ba4cf7f8909b816d83829d2217c94243 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Mar 2 11:41:48 2023 +0700 safesearch: fix merge commit 14c6a8005fe15b5d5a39f91b17c96d8670975811 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Mar 1 12:50:09 2023 +0700 all: docs commit 2a85c8831866bf1c34c423a289461fc1e32667b5 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Mar 1 12:47:00 2023 +0700 all: use safesearch package
2023-03-15 14:31:07 +03:00
Pull request 2235: 7069-fix-blocked-services Updates #7069. Squashed commit of the following: commit 0f87493966124af4fa4b28eb1f67281343dd8242 Merge: 87f06b864 28a6c24db Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 18 14:09:18 2024 +0300 Merge branch 'master' into 7069-fix-blocked-services commit 87f06b86432bba4d2e2583010784746452b7690f Merge: c2440752c 66877c92d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 18 13:47:28 2024 +0300 Merge branch 'master' into 7069-fix-blocked-services commit c2440752c8a223e8ab2e4a519da9259d888ca06f Merge: 17a9c14e2 1c82be295 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jun 17 18:42:48 2024 +0300 Merge branch 'master' into 7069-fix-blocked-services commit 17a9c14e29a38ed513a827d9b5351d66f1e6cb48 Merge: 11160bc62 bed86d57f Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 11 13:41:00 2024 +0300 Merge branch 'master' into 7069-fix-blocked-services commit 11160bc62b08fd6e984d38d5600fa62c3564668f Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 11 13:36:56 2024 +0300 all: imp docs commit 491287164d31606c93dcbeb4f1e351df0960309b Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jun 10 14:03:22 2024 +0300 home: imp code commit 0caf8b15797c28447039736cc9641ccddee5cac0 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jun 10 13:35:54 2024 +0300 all: upd chlog commit 46f793b2591dce54a9566ccb9cb723ab5c60cd6a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jun 10 13:27:22 2024 +0300 home: fix blocked services
2024-06-18 14:27:25 +03:00
// BlockedServices is the configuration of blocked services of a client. It
// must not be nil after initialization.
Pull request 1883: 951-blocked-services-client-schedule Updates #951. Squashed commit of the following: commit 94e4766932940a99c5265489bccb46d0ed6cec25 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 27 17:21:41 2023 +0300 chlog: upd docs commit b4022c33860c258bf29650413f0c972b849a1758 Merge: cfa24ff01 e7e638443 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 27 16:33:20 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit cfa24ff0190b2bc12736700eeff815525fbaf5fe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 27 15:04:10 2023 +0300 chlog: imp docs commit dad27590d5eefde82758d58fc06a20c139492db8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jun 26 17:38:08 2023 +0300 home: imp err msg commit 7d9ba98c4477000fc2e0f06c3462fe9cd0c65293 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jun 26 16:58:00 2023 +0300 all: add tests commit 8e952fc4e3b3d433b29efe47c88d6b7806e99ff8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Jun 23 16:36:10 2023 +0300 schedule: add todo commit 723573a98d5b930334a5fa125eb12593f4a2430d Merge: 2151ab2a6 e54fc9b1e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Jun 23 11:40:03 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit 2151ab2a627b9833ba6cce9621f72b29d326da75 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Jun 23 11:37:49 2023 +0300 all: add tests commit 81ab341db3e4053f09b181d8111c0da197bdac05 Merge: aa7ae41a8 66345e855 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jun 22 17:59:01 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit aa7ae41a868045fe24e390b25f15551fd8821529 Merge: 304389a48 06d465b0d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jun 21 17:10:11 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit 304389a487f728e8ced293ea811a4e0026a37f0d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jun 21 17:05:31 2023 +0300 home: imp err msg commit 29cfc7ae2a0bbd5ec3205eae3f6f810519787f26 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 20 20:42:59 2023 +0300 all: imp err handling commit 8543868eef6442fd30131d9567b66222999101e9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 20 18:21:50 2023 +0300 all: upd chlog commit c5b614d45e5cf25c30c52343f48139fb34c77539 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 20 14:37:47 2023 +0300 all: add blocked services schedule
2023-06-27 18:03:07 +03:00
BlockedServices *filtering.BlockedServices
Name string
Pull request 1883: 951-blocked-services-client-schedule Updates #951. Squashed commit of the following: commit 94e4766932940a99c5265489bccb46d0ed6cec25 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 27 17:21:41 2023 +0300 chlog: upd docs commit b4022c33860c258bf29650413f0c972b849a1758 Merge: cfa24ff01 e7e638443 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 27 16:33:20 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit cfa24ff0190b2bc12736700eeff815525fbaf5fe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 27 15:04:10 2023 +0300 chlog: imp docs commit dad27590d5eefde82758d58fc06a20c139492db8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jun 26 17:38:08 2023 +0300 home: imp err msg commit 7d9ba98c4477000fc2e0f06c3462fe9cd0c65293 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jun 26 16:58:00 2023 +0300 all: add tests commit 8e952fc4e3b3d433b29efe47c88d6b7806e99ff8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Jun 23 16:36:10 2023 +0300 schedule: add todo commit 723573a98d5b930334a5fa125eb12593f4a2430d Merge: 2151ab2a6 e54fc9b1e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Jun 23 11:40:03 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit 2151ab2a627b9833ba6cce9621f72b29d326da75 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Jun 23 11:37:49 2023 +0300 all: add tests commit 81ab341db3e4053f09b181d8111c0da197bdac05 Merge: aa7ae41a8 66345e855 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jun 22 17:59:01 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit aa7ae41a868045fe24e390b25f15551fd8821529 Merge: 304389a48 06d465b0d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jun 21 17:10:11 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit 304389a487f728e8ced293ea811a4e0026a37f0d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jun 21 17:05:31 2023 +0300 home: imp err msg commit 29cfc7ae2a0bbd5ec3205eae3f6f810519787f26 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 20 20:42:59 2023 +0300 all: imp err handling commit 8543868eef6442fd30131d9567b66222999101e9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 20 18:21:50 2023 +0300 all: upd chlog commit c5b614d45e5cf25c30c52343f48139fb34c77539 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 20 14:37:47 2023 +0300 all: add blocked services schedule
2023-06-27 18:03:07 +03:00
Tags []string
Upstreams []string
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
IPs []netip.Addr
// TODO(s.chzhen): Use netutil.Prefix.
Subnets []netip.Prefix
MACs []net.HardwareAddr
ClientIDs []string
// UID is the unique identifier of the persistent client.
UID UID
Pull request: custom upstreams cache Merge in DNS/adguard-home from custom-ups-cache to master Squashed commit of the following: commit 98428a87520f70cb522701d8eccfe4c529be1e40 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 17 10:53:32 2023 +0200 all: upd dep commit 775a639af4a2a45220b17e8b0037edc126ff62e4 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 17 09:52:31 2023 +0200 dnsforward: imp test commit e9e2a58b48e8588dfcb28df319d4651e1fe77af5 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 17 09:44:46 2023 +0200 docs: changelog commit a6d67218f037c8fec29e5fa2967476d63c3cfc32 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 17 09:37:17 2023 +0200 all: upd dep commit b101ff6e0cf393dacdee6fb68d33ba8f11c36280 Merge: d61f4eb88 8bb1aad73 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Nov 16 15:54:05 2023 +0200 Merge remote-tracking branch 'origin/master' into custom-ups-cache commit d61f4eb8871f8ae8504259998bf9015b29001cfb Merge: 567a8a4af fdf60eeed Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Nov 13 10:32:22 2023 +0200 Merge remote-tracking branch 'origin/master' into custom-ups-cache commit 567a8a4af34ad001d0e6d7d2efdc123205569e8c Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Nov 13 10:30:24 2023 +0200 home: imp code commit a3c16facbebc166e5c0c731c1e892b61c0950d9e Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 14:34:04 2023 +0200 all: imp code commit 84160eafee1d0f2d0cd3f025f2d5070e4f597ad6 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 14:31:26 2023 +0200 all: conf custom ups cache commit b7f6581901ebad96c87e765a305a1fa5b336efbb Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 14:29:47 2023 +0200 all: conf custom ups cache commit d07df945d4e7614a679ef5dc77756096abf1e66c Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 09:26:29 2023 +0200 all: docs commit 998124bac08889c7d354dd1a099929726725bccc Merge: f665e2f85 53170d871 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 09:24:28 2023 +0200 Merge remote-tracking branch 'origin/master' into custom-ups-cache commit f665e2f85bce12d95f80aba6614b6bfd4874b122 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Nov 10 09:22:46 2023 +0200 all: conf custom ups cache commit a4b26973bef4f3b339198ffbe52a50baca303daf Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Nov 9 12:46:39 2023 +0200 all: conf custom ups cache
2023-11-17 15:51:51 +03:00
UpstreamsCacheSize uint32
UpstreamsCacheEnabled bool
UseOwnSettings bool
FilteringEnabled bool
SafeBrowsingEnabled bool
ParentalEnabled bool
UseOwnBlockedServices bool
Pull request 1791: 4299-querylog-stats-clients Merge in DNS/adguard-home from 4299-querylog-stats-clients to master Squashed commit of the following: commit 33b80b67224f7c1a15bee8e6a23d9d5bab6ac629 Merge: 61964fdd 5d5a7295 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Apr 7 12:43:22 2023 +0300 Merge branch 'master' into 4299-querylog-stats-clients commit 61964fdd02221abbddedf2d6d02bb0bce6845362 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Apr 7 12:42:01 2023 +0300 dnsforward: imp code commit 7382168500bab6ca7494d39aabfc2d7bfceb5d24 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Apr 7 11:13:07 2023 +0300 all: imp code, chlog commit c7852902f635af6c296dcb6735f7b0bfb83f4e87 Merge: aa4dc0a5 a55cbbe7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Apr 6 14:34:24 2023 +0300 Merge branch 'master' into 4299-querylog-stats-clients commit aa4dc0a54e95bc5b24718ec158340b631a822801 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Apr 6 12:54:02 2023 +0300 all: imp code commit dd541f0cd7ecbf0afcf10ccbd130fd1d1fa4c1c4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 31 13:01:53 2023 +0300 querylog: fix typo commit d2c8fdb35b04d27c8957fa027882fde704cc07be Merge: 83d0baa1 2eb3bf6e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 31 12:36:49 2023 +0300 Merge branch 'master' into 4299-querylog-stats-clients commit 83d0baa1f1202f9c62d4be2041d7aed12ee9ab2c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Mar 31 12:35:15 2023 +0300 all: add tests commit a459f19f25cf9646d145813fe7834b2d9979c516 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Mar 29 16:51:53 2023 +0300 all: add clients querylog stats ignore
2023-04-07 13:17:40 +03:00
IgnoreQueryLog bool
IgnoreStatistics bool
Pull request: AG-31778-fix-safesearch-https Squashed commit of the following: commit 85ea3d985e83209e3b49119959aedd330df24d23 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Apr 18 15:19:38 2024 +0200 all: imp docs commit b0695daddbcf191454c5e829ca4d19def8ddacbf Merge: a79f98f2f 48c6242a7 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 17 11:06:49 2024 +0200 Merge remote-tracking branch 'origin/master' into AG-31778-fix-safesearch-https # Conflicts: # CHANGELOG.md commit a79f98f2f215a4a79ca4d186c0da33db936429dc Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 17 11:05:34 2024 +0200 dnsforward: imp code commit b901a1169cc78313298d70cce770cd1523ccbf9f Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Apr 16 11:03:52 2024 +0200 dnsforward: imp code commit fb6e66971b1b984147ec400ceaff856e7b5710c7 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Apr 16 10:08:51 2024 +0200 all: safesearch rewrites commit 88add21831fff7e04539f5dd299832883a6f3995 Merge: b78ad8f74 201ac73cf Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Apr 16 09:43:20 2024 +0200 Merge remote-tracking branch 'origin/master' into AG-31778-fix-safesearch-https # Conflicts: # CHANGELOG.md commit b78ad8f748c7fa52533e0541cae16bd51c201370 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Apr 12 13:34:39 2024 +0200 all: safesearch rewrites commit fb3efbb053242c537ca872542006917b8e8ac1ff Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Apr 11 13:15:37 2024 +0200 safesearch: imp code commit 1193c704f4d30be4a2cc66e84a31c9a6020ab269 Merge: 14e823d7c ff7c715c5 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Apr 11 13:13:44 2024 +0200 Merge remote-tracking branch 'origin/master' into AG-31778-fix-safesearch-https # Conflicts: # CHANGELOG.md commit 14e823d7cc13c275c2ed04704883a94b95e29963 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Apr 11 13:11:43 2024 +0200 all: safesearch https commit cd403a2897ae56a9059a78f24b104af5805d84ab Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Apr 11 12:09:27 2024 +0200 Revert "all: safesearch https" This reverts commit 1c9564b9b4db70f85b2f827cc06b65d2b67b08b1. commit 1c9564b9b4db70f85b2f827cc06b65d2b67b08b1 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 10 12:41:47 2024 +0200 all: safesearch https commit 5f42688fbab566973acc8dc414a992819492a9ac Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 10 09:22:30 2024 +0200 filtering: imp code commit eb9bd9f47cd71cafe8eee4698a8a0d5d25dea3d3 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 10 09:19:22 2024 +0200 all: changelog commit 0c77c705a942fe83d3809a7efbc8a6baf5886762 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Apr 10 08:55:22 2024 +0200 safesearch: imp tests commit 492a93fbb5ff54678e22a15577f509b2327c2ebe Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Apr 9 14:45:16 2024 +0200 all: changelog commit a665e7246d11503c47d48ccc714e6862f764e930 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Apr 9 14:41:24 2024 +0200 safesearch: https req
2024-04-22 10:48:26 +03:00
// TODO(d.kolyshev): Make SafeSearchConf a pointer.
SafeSearchConf filtering.SafeSearchConfig
}
// SetTags sets the tags if they are known, otherwise logs an unknown tag.
func (c *Persistent) SetTags(tags []string, known *container.MapSet[string]) {
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
for _, t := range tags {
if !known.Has(t) {
log.Info("skipping unknown tag %q", t)
continue
}
c.Tags = append(c.Tags, t)
}
slices.Sort(c.Tags)
}
// SetIDs parses a list of strings into typed fields and returns an error if
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
// there is one.
func (c *Persistent) SetIDs(ids []string) (err error) {
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
for _, id := range ids {
err = c.setID(id)
if err != nil {
return err
}
}
slices.SortFunc(c.IPs, netip.Addr.Compare)
// TODO(s.chzhen): Use netip.PrefixCompare in Go 1.23.
slices.SortFunc(c.Subnets, subnetCompare)
slices.SortFunc(c.MACs, slices.Compare[net.HardwareAddr])
slices.Sort(c.ClientIDs)
return nil
}
// subnetCompare is a comparison function for the two subnets. It returns -1 if
// x sorts before y, 1 if x sorts after y, and 0 if their relative sorting
// position is the same.
func subnetCompare(x, y netip.Prefix) (cmp int) {
if x == y {
return 0
}
xAddr, xBits := x.Addr(), x.Bits()
yAddr, yBits := y.Addr(), y.Bits()
if xBits == yBits {
return xAddr.Compare(yAddr)
}
if xBits > yBits {
return -1
} else {
return 1
}
}
// setID parses id into typed field if there is no error.
func (c *Persistent) setID(id string) (err error) {
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
if id == "" {
return errors.Error("clientid is empty")
}
var ip netip.Addr
if ip, err = netip.ParseAddr(id); err == nil {
c.IPs = append(c.IPs, ip)
return nil
}
var subnet netip.Prefix
if subnet, err = netip.ParsePrefix(id); err == nil {
c.Subnets = append(c.Subnets, subnet)
return nil
}
var mac net.HardwareAddr
if mac, err = net.ParseMAC(id); err == nil {
c.MACs = append(c.MACs, mac)
return nil
}
err = ValidateClientID(id)
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
if err != nil {
// Don't wrap the error, because it's informative enough as is.
return err
}
c.ClientIDs = append(c.ClientIDs, strings.ToLower(id))
return nil
}
// ValidateClientID returns an error if id is not a valid ClientID.
//
// TODO(s.chzhen): It's an exact copy of the [dnsforward.ValidateClientID] to
// avoid the import cycle. Remove it.
func ValidateClientID(id string) (err error) {
err = netutil.ValidateHostnameLabel(id)
if err != nil {
// Replace the domain name label wrapper with our own.
return fmt.Errorf("invalid clientid %q: %w", id, errors.Unwrap(err))
}
return nil
}
// IDs returns a list of client IDs containing at least one element.
func (c *Persistent) IDs() (ids []string) {
ids = make([]string, 0, c.IDsLen())
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
for _, ip := range c.IPs {
ids = append(ids, ip.String())
}
for _, subnet := range c.Subnets {
ids = append(ids, subnet.String())
}
for _, mac := range c.MACs {
ids = append(ids, mac.String())
}
return append(ids, c.ClientIDs...)
}
// IDsLen returns a length of client ids.
func (c *Persistent) IDsLen() (n int) {
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
return len(c.IPs) + len(c.Subnets) + len(c.MACs) + len(c.ClientIDs)
}
// EqualIDs returns true if the ids of the current and previous clients are the
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
// same.
func (c *Persistent) EqualIDs(prev *Persistent) (equal bool) {
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
return slices.Equal(c.IPs, prev.IPs) &&
slices.Equal(c.Subnets, prev.Subnets) &&
slices.EqualFunc(c.MACs, prev.MACs, slices.Equal[net.HardwareAddr]) &&
slices.Equal(c.ClientIDs, prev.ClientIDs)
}
// ShallowClone returns a deep copy of the client, except upstreamConfig,
// safeSearchConf, SafeSearch fields, because it's difficult to copy them.
func (c *Persistent) ShallowClone() (clone *Persistent) {
clone = &Persistent{}
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
*clone = *c
Pull request 1883: 951-blocked-services-client-schedule Updates #951. Squashed commit of the following: commit 94e4766932940a99c5265489bccb46d0ed6cec25 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 27 17:21:41 2023 +0300 chlog: upd docs commit b4022c33860c258bf29650413f0c972b849a1758 Merge: cfa24ff01 e7e638443 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 27 16:33:20 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit cfa24ff0190b2bc12736700eeff815525fbaf5fe Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 27 15:04:10 2023 +0300 chlog: imp docs commit dad27590d5eefde82758d58fc06a20c139492db8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jun 26 17:38:08 2023 +0300 home: imp err msg commit 7d9ba98c4477000fc2e0f06c3462fe9cd0c65293 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jun 26 16:58:00 2023 +0300 all: add tests commit 8e952fc4e3b3d433b29efe47c88d6b7806e99ff8 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Jun 23 16:36:10 2023 +0300 schedule: add todo commit 723573a98d5b930334a5fa125eb12593f4a2430d Merge: 2151ab2a6 e54fc9b1e Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Jun 23 11:40:03 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit 2151ab2a627b9833ba6cce9621f72b29d326da75 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Jun 23 11:37:49 2023 +0300 all: add tests commit 81ab341db3e4053f09b181d8111c0da197bdac05 Merge: aa7ae41a8 66345e855 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jun 22 17:59:01 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit aa7ae41a868045fe24e390b25f15551fd8821529 Merge: 304389a48 06d465b0d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jun 21 17:10:11 2023 +0300 Merge branch 'master' into 951-blocked-services-client-schedule commit 304389a487f728e8ced293ea811a4e0026a37f0d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jun 21 17:05:31 2023 +0300 home: imp err msg commit 29cfc7ae2a0bbd5ec3205eae3f6f810519787f26 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 20 20:42:59 2023 +0300 all: imp err handling commit 8543868eef6442fd30131d9567b66222999101e9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 20 18:21:50 2023 +0300 all: upd chlog commit c5b614d45e5cf25c30c52343f48139fb34c77539 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Jun 20 14:37:47 2023 +0300 all: add blocked services schedule
2023-06-27 18:03:07 +03:00
clone.BlockedServices = c.BlockedServices.Clone()
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
clone.Tags = slices.Clone(c.Tags)
clone.Upstreams = slices.Clone(c.Upstreams)
clone.IPs = slices.Clone(c.IPs)
clone.Subnets = slices.Clone(c.Subnets)
clone.MACs = slices.Clone(c.MACs)
clone.ClientIDs = slices.Clone(c.ClientIDs)
Pull request 2122: AG-27492-client-persistent-ids Squashed commit of the following: commit a0527b86f10596a86357630117607a3c507e4ac2 Merge: 512edaf2d 9694f19ef Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 17 13:15:18 2024 +0300 Merge branch 'master' into AG-27492-client-persistent-ids commit 512edaf2dc29f19c4fb7860b0c350a5e4180cda4 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Jan 15 15:50:28 2024 +0300 home: imp docs commit 4d4b3599918aab8ee6315c7f2f35f70db89e4d02 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 20:20:42 2024 +0300 home: imp code commit 8031347b8613cc49a80968e162dd198851eafe7c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 18:46:20 2024 +0300 home: fix typo commit 5932b181fe6a0c0bc605070fd9ddcc6617703ab7 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 16:52:49 2024 +0300 home: imp code more commit 9412f5846795acfb68b009491b1045d1e27d8ddc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Jan 11 15:41:23 2024 +0300 home: imp code commit 855d3201ab1b176ed5fdd32bce933a7795601a6d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Jan 10 20:24:49 2024 +0300 home: add tests commit 112f1bd13acf992b0ba9562c29365b22d5374ec2 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 18:29:11 2023 +0300 home: imp code commit 8b295bfa8968c3767bcfaf05c7f109d75af8c961 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 29 14:58:17 2023 +0300 home: persistent client ids
2024-01-17 13:24:21 +03:00
return clone
}
// CloseUpstreams closes the client-specific upstream config of c if any.
func (c *Persistent) CloseUpstreams() (err error) {
if c.UpstreamConfig != nil {
if err = c.UpstreamConfig.Close(); err != nil {
return fmt.Errorf("closing upstreams of client %q: %w", c.Name, err)
}
}
return nil
}
// SetSafeSearch initializes and sets the safe search filter for this client.
func (c *Persistent) SetSafeSearch(
conf filtering.SafeSearchConfig,
cacheSize uint,
cacheTTL time.Duration,
) (err error) {
ss, err := safesearch.NewDefault(conf, fmt.Sprintf("client %q", c.Name), cacheSize, cacheTTL)
if err != nil {
// Don't wrap the error, because it's informative enough as is.
return err
}
c.SafeSearch = ss
return nil
}