2021-04-02 17:30:39 +03:00
|
|
|
package querylog
|
|
|
|
|
|
|
|
// Client is the information required by the query log to match against clients
|
|
|
|
// during searches.
|
|
|
|
type Client struct {
|
2021-06-18 18:13:36 +03:00
|
|
|
WHOIS *ClientWHOIS `json:"whois,omitempty"`
|
2021-04-02 17:30:39 +03:00
|
|
|
Name string `json:"name"`
|
|
|
|
DisallowedRule string `json:"disallowed_rule"`
|
|
|
|
Disallowed bool `json:"disallowed"`
|
|
|
|
}
|
|
|
|
|
2021-06-18 18:13:36 +03:00
|
|
|
// ClientWHOIS is the filtered WHOIS data for the client.
|
2021-04-02 17:30:39 +03:00
|
|
|
//
|
2021-06-18 18:13:36 +03:00
|
|
|
// TODO(a.garipov): Merge with home.RuntimeClientWHOISInfo after the
|
2021-04-02 17:30:39 +03:00
|
|
|
// refactoring is done.
|
2021-06-18 18:13:36 +03:00
|
|
|
type ClientWHOIS struct {
|
2021-04-02 17:30:39 +03:00
|
|
|
City string `json:"city,omitempty"`
|
|
|
|
Country string `json:"country,omitempty"`
|
|
|
|
Orgname string `json:"orgname,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|