support update proxies

This commit is contained in:
2024-01-11 13:11:12 +08:00
parent 83ad03eca3
commit 18792a395c
11 changed files with 69 additions and 276 deletions

View File

@@ -5,11 +5,9 @@ import (
"fmt"
"github.com/fatedier/frp/pkg/config"
v1 "github.com/fatedier/frp/pkg/config/v1"
"github.com/vaughan0/go-ini"
"io"
"log"
"net/http"
"sort"
"strconv"
"strings"
)
@@ -22,44 +20,6 @@ func equalIgnoreCase(source string, target string) bool {
return strings.ToUpper(source) == strings.ToUpper(target)
}
func sortSectionKeys(object ini.Section) []string {
var keys []string
for key := range object {
keys = append(keys, key)
}
sort.Strings(keys)
return keys
}
func serializeSections() []byte {
var build strings.Builder
build.WriteString("[common]\n")
for _, key := range sortSectionKeys(clientCommon) {
build.WriteString(fmt.Sprintf("%s = %s\n", key, clientCommon[key]))
}
build.WriteString("\n")
sections := Sections{clientProxies}
for _, sectionInfo := range sections.sort() {
name := sectionInfo.Name
build.WriteString(fmt.Sprintf("[%s]\n", name))
section := sectionInfo.Section
for _, key := range sortSectionKeys(section) {
value := section[key]
if key == NameKey || key == OldNameKey || trimString(value) == "" {
continue
}
build.WriteString(fmt.Sprintf("%s = %s\n", key, value))
}
build.WriteString("\n")
}
return []byte(build.String())
}
func (c *HandleController) buildRequestUrl(serverApi string) string {
var protocol string