Pull request: home: imp client http api, docs

Updates #3075.

Squashed commit of the following:

commit c88fd2e24a19474bce736e5b6af7e094b43be390
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu May 6 16:09:49 2021 +0300

    home: imp code, docs

commit 8ae7d9001927d56394d2177c22fe114d98f01732
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu May 6 15:35:49 2021 +0300

    home: imp client http api, docs
This commit is contained in:
Ainar Garipov 2021-05-06 16:41:33 +03:00
parent f717776c64
commit 460aa1a5ba
4 changed files with 70 additions and 44 deletions

View File

@ -29,25 +29,25 @@ var webHandlersRegistered = false
// Client contains information about persistent clients. // Client contains information about persistent clients.
type Client struct { type Client struct {
// upstreamConfig is the custom upstream config for this client. If
// 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.UpstreamConfig
Name string
IDs []string IDs []string
Tags []string Tags []string
Name string BlockedServices []string
UseOwnSettings bool // false: use global settings Upstreams []string
UseOwnSettings bool
FilteringEnabled bool FilteringEnabled bool
SafeSearchEnabled bool SafeSearchEnabled bool
SafeBrowsingEnabled bool SafeBrowsingEnabled bool
ParentalEnabled bool ParentalEnabled bool
UseOwnBlockedServices bool
UseOwnBlockedServices bool // false: use global settings
BlockedServices []string
Upstreams []string // list of upstream servers to be used for the client's requests
// Custom upstream config for this client
// nil: not yet initialized
// not nil, but empty: initialized, no good upstreams
// not nil, not empty: Upstreams ready to be used
upstreamConfig *proxy.UpstreamConfig
} }
type clientSource uint type clientSource uint
@ -63,9 +63,9 @@ const (
// RuntimeClient information // RuntimeClient information
type RuntimeClient struct { type RuntimeClient struct {
WhoisInfo *RuntimeClientWhoisInfo
Host string Host string
Source clientSource Source clientSource
WhoisInfo *RuntimeClientWhoisInfo
} }
// RuntimeClientWhoisInfo is the filtered WHOIS data for a runtime client. // RuntimeClientWhoisInfo is the filtered WHOIS data for a runtime client.