mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-29 02:18:51 +03:00
cf7c12c97b
Squashed commit of the following: commit 770a3f338ecb270fcff7792a4ffe3cf95492d2ae Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Jun 27 20:10:39 2023 +0300 dnssvc: fix test for darwin commit 6564abcc0904784ff3787e1a046d665519a108b3 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Jun 27 19:57:19 2023 +0300 all: fix .gitignore, tests commit 3ff1be0462b3adea81d98b1f65eeb685d2d72030 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Jun 27 19:30:05 2023 +0300 next: add conf example; imp dnssvc
45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
package websvc
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
// All Settings Handlers
|
|
|
|
// RespGetV1SettingsAll describes the response of the GET /api/v1/settings/all
|
|
// HTTP API.
|
|
type RespGetV1SettingsAll struct {
|
|
// TODO(a.garipov): Add more as we go.
|
|
|
|
DNS *HTTPAPIDNSSettings `json:"dns"`
|
|
HTTP *HTTPAPIHTTPSettings `json:"http"`
|
|
}
|
|
|
|
// handleGetSettingsAll is the handler for the GET /api/v1/settings/all HTTP
|
|
// API.
|
|
func (svc *Service) handleGetSettingsAll(w http.ResponseWriter, r *http.Request) {
|
|
dnsSvc := svc.confMgr.DNS()
|
|
dnsConf := dnsSvc.Config()
|
|
|
|
webSvc := svc.confMgr.Web()
|
|
httpConf := webSvc.Config()
|
|
|
|
// TODO(a.garipov): Add all currently supported parameters.
|
|
writeJSONOKResponse(w, r, &RespGetV1SettingsAll{
|
|
DNS: &HTTPAPIDNSSettings{
|
|
Addresses: dnsConf.Addresses,
|
|
BootstrapServers: dnsConf.BootstrapServers,
|
|
UpstreamServers: dnsConf.UpstreamServers,
|
|
DNS64Prefixes: dnsConf.DNS64Prefixes,
|
|
UpstreamTimeout: JSONDuration(dnsConf.UpstreamTimeout),
|
|
BootstrapPreferIPv6: dnsConf.BootstrapPreferIPv6,
|
|
UseDNS64: dnsConf.UseDNS64,
|
|
},
|
|
HTTP: &HTTPAPIHTTPSettings{
|
|
Addresses: httpConf.Addresses,
|
|
SecureAddresses: httpConf.SecureAddresses,
|
|
Timeout: JSONDuration(httpConf.Timeout),
|
|
ForceHTTPS: httpConf.ForceHTTPS,
|
|
},
|
|
})
|
|
}
|