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