fix: fix bug when parsing transport protocol

This commit is contained in:
pocketW 2022-08-24 09:52:45 +10:00
parent 529eb46ea0
commit fa51cb5309

View File

@ -775,21 +775,21 @@ func (c *APIClient) ParseSSPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*a
if c.NodeType == "Trojan" { if c.NodeType == "Trojan" {
EnableTLS = true EnableTLS = true
TLSType = nodeConfig.Security // try to read security from config TLSType = "tls"
transportProtocol = "tcp"
// Select security type
if nodeConfig.EnableXtls == "1" { if nodeConfig.EnableXtls == "1" {
TLSType = "xtls" TLSType = "xtls"
} } else if nodeConfig.Security != "" {
if TLSType == "" { TLSType = nodeConfig.Security // try to read security from config
TLSType = "tls" // default
} }
// Select transport protocol // Select transport protocol
transportProtocol = nodeConfig.Network // try to read transport protocol from config
if nodeConfig.Grpc == "1" { if nodeConfig.Grpc == "1" {
transportProtocol = "grpc" transportProtocol = "grpc"
} } else if nodeConfig.Network != "" {
if nodeConfig.Network != "" { transportProtocol = nodeConfig.Network // try to read transport protocol from config
transportProtocol = "tcp" // default
} }
} }