From fa51cb53098ce8320ec03cd53a1297fe356e65a8 Mon Sep 17 00:00:00 2001 From: pocketW <104479902+pocketW@users.noreply.github.com> Date: Wed, 24 Aug 2022 09:52:45 +1000 Subject: [PATCH] fix: fix bug when parsing transport protocol --- api/sspanel/sspanel.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/api/sspanel/sspanel.go b/api/sspanel/sspanel.go index a898cd7..47d5557 100644 --- a/api/sspanel/sspanel.go +++ b/api/sspanel/sspanel.go @@ -775,21 +775,21 @@ func (c *APIClient) ParseSSPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*a if c.NodeType == "Trojan" { EnableTLS = true - TLSType = nodeConfig.Security // try to read security from config + TLSType = "tls" + transportProtocol = "tcp" + + // Select security type if nodeConfig.EnableXtls == "1" { TLSType = "xtls" - } - if TLSType == "" { - TLSType = "tls" // default + } else if nodeConfig.Security != "" { + TLSType = nodeConfig.Security // try to read security from config } // Select transport protocol - transportProtocol = nodeConfig.Network // try to read transport protocol from config if nodeConfig.Grpc == "1" { transportProtocol = "grpc" - } - if nodeConfig.Network != "" { - transportProtocol = "tcp" // default + } else if nodeConfig.Network != "" { + transportProtocol = nodeConfig.Network // try to read transport protocol from config } }