Pull request 2083: AG-27492-client-runtime
Squashed commit of the following: commit e4c2abd37f5885a12da5c68179e3dba18534c3be Merge: 7411b40b2dae304fc3Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Dec 13 13:15:40 2023 +0300 Merge branch 'master' into AG-27492-client-runtime commit 7411b40b234a438df4c84823fcb19efecf5eb64d Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Dec 12 17:51:51 2023 +0300 all: imp code commit d5edd0258779c6dfba56da1e4d79e0380b137385 Merge: 371f5b23cc908eec5dAuthor: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Dec 12 13:45:33 2023 +0300 Merge branch 'master' into AG-27492-client-runtime commit 371f5b23c9507fb6e8e8f8ec1f644ca8e67ea412 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Dec 12 13:44:38 2023 +0300 client: imp code commit 9aefb1443082a342270a7e5e77a07d5d1518e327 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 8 17:08:07 2023 +0300 all: imp code commit 3aa51d10aadfd124f36238a31f3d623706e3c870 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Dec 5 19:20:41 2023 +0300 all: imp docs commit 71d7187e0c14e143865b055e9b01ff61a2e30083 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Dec 1 17:17:06 2023 +0300 all: imp code commit e09f8a0bd90f295b5a580e24b2696cc78993713a Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Nov 30 14:46:53 2023 +0300 all: imp log msg commit ce0a9454df9a173694395b4dd8b05347a2e56fdc Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Nov 28 16:21:01 2023 +0300 all: imp code commit e84f176aaba6953b22e13a5fa84079a832d30a24 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Nov 22 17:40:18 2023 +0300 all: add client runtime
This commit is contained in:
@@ -75,6 +75,17 @@ type clientListJSON struct {
|
||||
Tags []string `json:"supported_tags"`
|
||||
}
|
||||
|
||||
// whoisOrEmpty returns a WHOIS client information or a pointer to an empty
|
||||
// struct. Frontend expects a non-nil value.
|
||||
func whoisOrEmpty(r *client.Runtime) (info *whois.Info) {
|
||||
info = r.WHOIS()
|
||||
if info != nil {
|
||||
return info
|
||||
}
|
||||
|
||||
return &whois.Info{}
|
||||
}
|
||||
|
||||
// handleGetClients is the handler for GET /control/clients HTTP API.
|
||||
func (clients *clientsContainer) handleGetClients(w http.ResponseWriter, r *http.Request) {
|
||||
data := clientListJSON{}
|
||||
@@ -88,11 +99,11 @@ func (clients *clientsContainer) handleGetClients(w http.ResponseWriter, r *http
|
||||
}
|
||||
|
||||
for ip, rc := range clients.ipToRC {
|
||||
src, host := rc.Info()
|
||||
cj := runtimeClientJSON{
|
||||
WHOIS: rc.WHOIS,
|
||||
|
||||
Name: rc.Host,
|
||||
Source: rc.Source,
|
||||
WHOIS: whoisOrEmpty(rc),
|
||||
Name: host,
|
||||
Source: src,
|
||||
IP: ip,
|
||||
}
|
||||
|
||||
@@ -437,10 +448,11 @@ func (clients *clientsContainer) findRuntime(ip netip.Addr, idStr string) (cj *c
|
||||
return cj
|
||||
}
|
||||
|
||||
_, host := rc.Info()
|
||||
cj = &clientJSON{
|
||||
Name: rc.Host,
|
||||
Name: host,
|
||||
IDs: []string{idStr},
|
||||
WHOIS: rc.WHOIS,
|
||||
WHOIS: whoisOrEmpty(rc),
|
||||
}
|
||||
|
||||
disallowed, rule := clients.dnsServer.IsBlockedClient(ip, idStr)
|
||||
|
||||
Reference in New Issue
Block a user