尝试修复VLESS节点错误的问题
This commit is contained in:
@@ -358,10 +358,13 @@ func BuildNodeConfigPayload(node *model.Server) map[string]any {
|
||||
settings := parseObject(node.ProtocolSettings)
|
||||
baseConfig := map[string]any{
|
||||
"protocol": node.Type,
|
||||
"node_type": node.Type,
|
||||
"nodeType": node.Type,
|
||||
"listen_ip": "0.0.0.0",
|
||||
"server_port": node.ServerPort,
|
||||
"network": getMapAny(settings, "network"),
|
||||
"networkSettings": getMapAny(settings, "network_settings"),
|
||||
"network_settings": getMapAny(settings, "network_settings"),
|
||||
}
|
||||
|
||||
response := cloneNodePayload(baseConfig)
|
||||
@@ -381,6 +384,7 @@ func BuildNodeConfigPayload(node *model.Server) map[string]any {
|
||||
}
|
||||
case "vmess":
|
||||
response["tls"] = getMapInt(settings, "tls")
|
||||
response["tlsSettings"] = getMapAny(settings, "tls_settings")
|
||||
response["multiplex"] = getMapAny(settings, "multiplex")
|
||||
case "trojan":
|
||||
response["host"] = node.Host
|
||||
@@ -389,12 +393,14 @@ func BuildNodeConfigPayload(node *model.Server) map[string]any {
|
||||
response["tls"] = getMapInt(settings, "tls")
|
||||
if getMapInt(settings, "tls") == 2 {
|
||||
response["tls_settings"] = getMapAny(settings, "reality_settings")
|
||||
response["tlsSettings"] = getMapAny(settings, "reality_settings")
|
||||
} else {
|
||||
response["tls_settings"] = nil
|
||||
response["tlsSettings"] = nil
|
||||
}
|
||||
case "vless":
|
||||
response["tls"] = getMapInt(settings, "tls")
|
||||
response["flow"] = getMapAny(settings, "flow")
|
||||
response["flow"] = getMapString(settings, "flow")
|
||||
response["multiplex"] = getMapAny(settings, "multiplex")
|
||||
response["decryption"] = nil
|
||||
if encryption, ok := settings["encryption"].(map[string]any); ok {
|
||||
@@ -406,8 +412,10 @@ func BuildNodeConfigPayload(node *model.Server) map[string]any {
|
||||
}
|
||||
if getMapInt(settings, "tls") == 2 {
|
||||
response["tls_settings"] = getMapAny(settings, "reality_settings")
|
||||
response["tlsSettings"] = getMapAny(settings, "reality_settings")
|
||||
} else {
|
||||
response["tls_settings"] = getMapAny(settings, "tls_settings")
|
||||
response["tlsSettings"] = getMapAny(settings, "tls_settings")
|
||||
}
|
||||
case "hysteria":
|
||||
tls, _ := settings["tls"].(map[string]any)
|
||||
@@ -448,9 +456,11 @@ func BuildNodeConfigPayload(node *model.Server) map[string]any {
|
||||
case "naive":
|
||||
response["tls"] = getMapInt(settings, "tls")
|
||||
response["tls_settings"] = getMapAny(settings, "tls_settings")
|
||||
response["tlsSettings"] = getMapAny(settings, "tls_settings")
|
||||
case "http":
|
||||
response["tls"] = getMapInt(settings, "tls")
|
||||
response["tls_settings"] = getMapAny(settings, "tls_settings")
|
||||
response["tlsSettings"] = getMapAny(settings, "tls_settings")
|
||||
case "mieru":
|
||||
transport := getMapString(settings, "transport")
|
||||
if strings.TrimSpace(transport) == "" {
|
||||
|
||||
Reference in New Issue
Block a user