allow full config
This commit is contained in:
@@ -6,16 +6,17 @@ import (
|
||||
)
|
||||
|
||||
type ConfigOptions struct {
|
||||
LogLevel string `json:"log-level"`
|
||||
EnableClashApi bool `json:"enable-clash-api"`
|
||||
ClashApiPort uint16 `json:"clash-api-port"`
|
||||
ClashApiSecret string `json:"web-secret"`
|
||||
GeoIPPath string `json:"geoip-path"`
|
||||
GeoSitePath string `json:"geosite-path"`
|
||||
Rules []Rule `json:"rules"`
|
||||
Warp WarpOptions `json:"warp"`
|
||||
Mux MuxOptions `json:"mux"`
|
||||
TLSTricks TLSTricks `json:"tls-tricks"`
|
||||
EnableFullConfig bool `json:"enable-full-config"`
|
||||
LogLevel string `json:"log-level"`
|
||||
EnableClashApi bool `json:"enable-clash-api"`
|
||||
ClashApiPort uint16 `json:"clash-api-port"`
|
||||
ClashApiSecret string `json:"web-secret"`
|
||||
GeoIPPath string `json:"geoip-path"`
|
||||
GeoSitePath string `json:"geosite-path"`
|
||||
Rules []Rule `json:"rules"`
|
||||
Warp WarpOptions `json:"warp"`
|
||||
Mux MuxOptions `json:"mux"`
|
||||
TLSTricks TLSTricks `json:"tls-tricks"`
|
||||
DNSOptions
|
||||
InboundOptions
|
||||
URLTestOptions
|
||||
|
||||
@@ -29,9 +29,9 @@ func ParseConfig(path string, debug bool) ([]byte, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ParseConfigContent(string(content), debug)
|
||||
return ParseConfigContent(string(content), debug, false)
|
||||
}
|
||||
func ParseConfigContent(contentstr string, debug bool) ([]byte, error) {
|
||||
func ParseConfigContent(contentstr string, debug bool, enableFullConfig bool) ([]byte, error) {
|
||||
content := []byte(contentstr)
|
||||
var jsonObj map[string]interface{} = make(map[string]interface{})
|
||||
|
||||
@@ -43,7 +43,12 @@ func ParseConfigContent(contentstr string, debug bool) ([]byte, error) {
|
||||
if tmpJsonObj["outbounds"] == nil {
|
||||
jsonObj["outbounds"] = []interface{}{jsonObj}
|
||||
} else {
|
||||
jsonObj["outbounds"] = tmpJsonObj["outbounds"]
|
||||
if enableFullConfig {
|
||||
jsonObj = tmpJsonObj
|
||||
} else {
|
||||
jsonObj["outbounds"] = tmpJsonObj["outbounds"]
|
||||
}
|
||||
|
||||
}
|
||||
} else if jsonArray, ok := tmpJsonResult.([]map[string]interface{}); ok {
|
||||
jsonObj["outbounds"] = jsonArray
|
||||
|
||||
Reference in New Issue
Block a user