AdGuardHome/internal/querylog/client.go
Stanislav Chzhen 06d465b0d1 Pull request 1858: AG-22594-imp-whois
Merge in DNS/adguard-home from AG-22594-imp-whois to master

Squashed commit of the following:

commit 093feed53291d02469fb1bd8d99472597ebd5015
Merge: 956d20dc4 ca313521d
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Wed Jun 21 12:42:40 2023 +0300

    Merge branch 'master' into AG-22594-imp-whois

commit 956d20dc473dcec90895b6f618fc56e96e9ff833
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Jun 20 18:30:48 2023 +0300

    whois: imp code more

commit c771fd9c5e4d90e76d079a0d25ab097ab5652a42
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Jun 20 15:05:45 2023 +0300

    whois: imp code

commit 21900fd468e10d9aee22149a6312b8596ff39810
Merge: 8dbe132c0 371261b2c
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Jun 20 11:34:06 2023 +0300

    Merge branch 'master' into AG-22594-imp-whois

commit 8dbe132c08d3ad4a63b0d4bdb9d00a5bc25971f4
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Jun 20 11:33:26 2023 +0300

    whois: imp code more

commit f5e761a260237579c67cbd48f01ea90499bff6b0
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Mon Jun 19 16:04:35 2023 +0300

    whois: imp code

commit 2780f7e16aacddad8736f83b77ef9bfa1271f8b1
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Fri Jun 16 17:33:47 2023 +0300

    all: imp code

commit 1fc67016068b745a46b3d0d341ab14f9f5bdc9aa
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Fri Jun 16 17:29:19 2023 +0300

    whois: imp tests

commit 204761870764fb10feea20065d79dee8c321e70b
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Fri Jun 16 11:55:37 2023 +0300

    all: upd deps

commit ded4f59498c5c544277b9c8e249567626547680e
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Wed Jun 14 20:43:32 2023 +0300

    all: imp tests

commit 0eed9834ff9dd94d0788ce69d0bb0521fa725410
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Wed Jun 14 19:31:49 2023 +0300

    all: imp code

commit 9f867587c8ad87363b8c8b061ead536c1ec59c5d
Merge: 504e9484d 681c604c2
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Jun 13 14:20:44 2023 +0300

    Merge branch 'master' into AG-22594-imp-whois

commit 504e9484dd84ab9d7c84a3f8399993d6422d3b67
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Jun 13 14:18:06 2023 +0300

    all: imp cache

commit c492abe41ace7ad76fcd4e297c22b910a90fec30
Merge: db36adb9c 826b314f1
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Fri Jun 9 16:06:12 2023 +0300

    Merge branch 'master' into AG-22594-imp-whois

commit db36adb9c14ce92b3971db0d87ec313d5bcd787e
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Fri Jun 9 15:53:33 2023 +0300

    all: add todo

commit 5cf192de9f93cd0d8521a3a6b4ded7f2bc5e0031
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Jun 8 14:59:26 2023 +0300

    all: imp docs

commit 021aa3eb5b9476a93b4af5fc90cc9ccf014ca152
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Mon Jun 5 18:35:25 2023 +0300

    all: imp naming

commit 4626c3a7fa3f2543501806c9fa1a19531547f394
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Fri Jun 2 17:41:00 2023 +0300

    all: imp tests

commit 1afcc9605ca176e4c7f76a03a2c996cf7d6bde13
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Fri Jun 2 12:44:32 2023 +0300

    all: imp docs

commit cdd0544ff1a63faed5ced3dae6bfb3b783e45428
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Jun 1 17:21:37 2023 +0300

    all: add docs

... and 2 more commits
2023-06-21 12:53:53 +03:00

25 lines
888 B
Go

package querylog
import "github.com/AdguardTeam/AdGuardHome/internal/whois"
// Client is the information required by the query log to match against clients
// during searches.
type Client struct {
WHOIS *whois.Info `json:"whois,omitempty"`
Name string `json:"name"`
DisallowedRule string `json:"disallowed_rule"`
Disallowed bool `json:"disallowed"`
IgnoreQueryLog bool `json:"-"`
}
// clientCacheKey is the key by which a cached client information is found.
type clientCacheKey struct {
clientID string
ip string
}
// clientCache is the cache of client information found throughout a request to
// the query log API. It is used both to speed up the lookup, as well as to
// make sure that changes in client data between two lookups don't create
// discrepancies in our response.
type clientCache map[clientCacheKey]*Client