From 5cf0d7c783f9e95152861c0f99cf8b2f34c8eef1 Mon Sep 17 00:00:00 2001 From: yuzuki999 Date: Wed, 30 Aug 2023 15:34:37 +0800 Subject: [PATCH] fix bug --- api/panel/node.go | 20 +++++++++++++++----- core/xray/inbound.go | 2 ++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/api/panel/node.go b/api/panel/node.go index 33400a1..aabb1d6 100644 --- a/api/panel/node.go +++ b/api/panel/node.go @@ -58,11 +58,13 @@ type BaseConfig struct { // VAllssNode is vmess and vless node info type VAllssNode struct { CommonNode - Tls int `json:"tls"` - TlsSettings TlsSettings `json:"tls_settings"` - Network string `json:"network"` - NetworkSettings json.RawMessage `json:"network_settings"` - ServerName string `json:"server_name"` + Tls int `json:"tls"` + TlsSettings TlsSettings `json:"tls_settings"` + TlsSettingsBack *TlsSettings `json:"tlsSettings"` + Network string `json:"network"` + NetworkSettings json.RawMessage `json:"network_settings"` + NetworkSettingsBack json.RawMessage `json:"networkSettings"` + ServerName string `json:"server_name"` // vless only Flow string `json:"flow"` @@ -137,6 +139,14 @@ func (c *Client) GetNodeInfo() (node *NodeInfo, err error) { if err != nil { return nil, fmt.Errorf("decode v2ray params error: %s", err) } + if len(rsp.NetworkSettingsBack) > 0 { + rsp.NetworkSettings = rsp.NetworkSettingsBack + rsp.NetworkSettingsBack = nil + } + if rsp.TlsSettingsBack != nil { + rsp.TlsSettings = *rsp.TlsSettingsBack + rsp.TlsSettingsBack = nil + } cm = &rsp.CommonNode node.VAllss = rsp node.Security = node.VAllss.Tls diff --git a/core/xray/inbound.go b/core/xray/inbound.go index 68e9f52..5671cc2 100644 --- a/core/xray/inbound.go +++ b/core/xray/inbound.go @@ -27,8 +27,10 @@ func buildInbound(option *conf.Options, nodeInfo *panel.NodeInfo, tag string) (* network = nodeInfo.VAllss.Network case "trojan": err = buildTrojan(option, in) + network = "tcp" case "shadowsocks": err = buildShadowsocks(option, nodeInfo, in) + network = "tcp" default: return nil, fmt.Errorf("unsupported node type: %s, Only support: V2ray, Trojan, Shadowsocks", nodeInfo.Type) }