Add set_upstreams_config function
This commit is contained in:
parent
967a1e6b87
commit
6b2baba3c7
|
@ -306,6 +306,10 @@ func sortByValue(m map[string]int) []string {
|
|||
// upstreams configuration
|
||||
// -----------------------
|
||||
|
||||
func handleSetUpstreamConfig(w http.ResponseWriter, r *http.Request) {
|
||||
log.Tracef("%s %v", r.Method, r.URL)
|
||||
}
|
||||
|
||||
func handleSetUpstreamDNS(w http.ResponseWriter, r *http.Request) {
|
||||
log.Tracef("%s %v", r.Method, r.URL)
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
|
@ -1293,6 +1297,7 @@ func registerControlHandlers() {
|
|||
http.HandleFunc("/control/querylog_enable", postInstall(optionalAuth(ensurePOST(handleQueryLogEnable))))
|
||||
http.HandleFunc("/control/querylog_disable", postInstall(optionalAuth(ensurePOST(handleQueryLogDisable))))
|
||||
http.HandleFunc("/control/set_upstream_dns", postInstall(optionalAuth(ensurePOST(handleSetUpstreamDNS))))
|
||||
http.HandleFunc("/control/set_upstreams_config", postInstall(optionalAuth(ensurePOST(handleSetUpstreamConfig))))
|
||||
http.HandleFunc("/control/test_upstream_dns", postInstall(optionalAuth(ensurePOST(handleTestUpstreamDNS))))
|
||||
http.HandleFunc("/control/all_servers/enable", postInstall(optionalAuth(ensurePOST(handleAllServersEnable))))
|
||||
http.HandleFunc("/control/all_servers/disable", postInstall(optionalAuth(ensurePOST(handleAllServersDisable))))
|
||||
|
|
|
@ -87,6 +87,25 @@ paths:
|
|||
200:
|
||||
description: OK
|
||||
|
||||
/set_upstreams_config:
|
||||
post:
|
||||
tags:
|
||||
- global
|
||||
operationId: setUpstreamsConfig
|
||||
summary: "Updates the current upstreams configuration"
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Upstreams configuration JSON"
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/UpstreamsConfig"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
|
||||
/set_upstream_dns:
|
||||
post:
|
||||
tags:
|
||||
|
@ -831,6 +850,25 @@ definitions:
|
|||
language:
|
||||
type: "string"
|
||||
example: "en"
|
||||
UpstreamsConfig:
|
||||
type: "object"
|
||||
description: "Upstreams configuration"
|
||||
required:
|
||||
- "bootstrap_dns"
|
||||
- "upstream_dns"
|
||||
properties:
|
||||
bootstrap_dns:
|
||||
type: "string"
|
||||
example: "8.8.8.8:53"
|
||||
upstream_dns:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
example:
|
||||
- "tls://1.1.1.1"
|
||||
- "tls://1.0.0.1"
|
||||
all_servers:
|
||||
type: "boolean"
|
||||
Filter:
|
||||
type: "object"
|
||||
description: "Filter subscription info"
|
||||
|
|
Loading…
Reference in New Issue