Improve parameter handling

This commit is contained in:
Lan Tian
2020-03-27 12:21:30 +08:00
parent 8f581d378f
commit ad17c52bb9
6 changed files with 85 additions and 72 deletions

View File

@@ -21,7 +21,7 @@ func batchRequest(servers []string, endpoint string, command string) []string {
for i, server := range servers {
// Check if the server is in the valid server list passed at startup
var isValidServer bool = false
for _, validServer := range settingServers {
for _, validServer := range setting.servers {
if validServer == server {
isValidServer = true
break
@@ -35,7 +35,7 @@ func batchRequest(servers []string, endpoint string, command string) []string {
}(i)
} else {
// Compose URL and send the request
url := "http://" + server + "." + settingServersDomain + ":" + strconv.Itoa(settingServersPort) + "/" + url.PathEscape(endpoint) + "?q=" + url.QueryEscape(command)
url := "http://" + server + "." + setting.domain + ":" + strconv.Itoa(setting.proxyPort) + "/" + url.PathEscape(endpoint) + "?q=" + url.QueryEscape(command)
go func(url string, i int) {
response, err := http.Get(url)
if err != nil {