feat: unify trojan transport & add ss2022 related config (#465)

This commit is contained in:
M1Screw 2023-10-04 10:44:45 +08:00 committed by GitHub
parent 5fe18e020d
commit 71aba0601e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 10 deletions

View File

@ -21,11 +21,7 @@ type CustomConfig struct {
OffsetPortNode string `json:"offset_port_node"`
ServerSub string `json:"server_sub"`
Host string `json:"host"`
MuPort string `json:"mu_port"`
MuEncryption string `json:"mu_encryption"`
MuProtocol string `json:"mu_protocol"`
MuObfs string `json:"mu_obfs"`
MuSuffix string `json:"mu_suffix"`
Method string `json:"method"`
V2Port string `json:"v2_port"`
TLS string `json:"tls"`
EnableVless string `json:"enable_vless"`
@ -38,7 +34,6 @@ type CustomConfig struct {
Header json.RawMessage `json:"header"`
TrojanPort string `json:"trojan_port"`
AllowInsecure string `json:"allow_insecure"`
Grpc string `json:"grpc"`
Servicename string `json:"servicename"`
EnableXtls string `json:"enable_xtls"`
Flow string `json:"flow"`

View File

@ -768,6 +768,7 @@ func (c *APIClient) ParseSSPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*a
}
parsedPort, err := strconv.ParseInt(nodeConfig.OffsetPortNode, 10, 32)
if err != nil {
return nil, err
}
@ -780,6 +781,7 @@ func (c *APIClient) ParseSSPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*a
if c.NodeType == "V2ray" {
transportProtocol = nodeConfig.Network
TLSType = nodeConfig.Security
if parsedAlterID, err := strconv.ParseInt(nodeConfig.AlterID, 10, 16); err != nil {
return nil, err
} else {
@ -789,6 +791,7 @@ func (c *APIClient) ParseSSPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*a
if TLSType == "tls" || TLSType == "xtls" {
EnableTLS = true
}
if nodeConfig.EnableVless == "1" {
EnableVless = true
}
@ -807,9 +810,7 @@ func (c *APIClient) ParseSSPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*a
}
// Select transport protocol
if nodeConfig.Grpc == "1" {
transportProtocol = "grpc"
} else if nodeConfig.Network != "" {
if nodeConfig.Network != "" {
transportProtocol = nodeConfig.Network // try to read transport protocol from config
}
}
@ -827,7 +828,7 @@ func (c *APIClient) ParseSSPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*a
EnableTLS: EnableTLS,
EnableVless: EnableVless,
VlessFlow: nodeConfig.Flow,
CypherMethod: nodeConfig.MuEncryption,
CypherMethod: nodeConfig.Method,
ServiceName: nodeConfig.Servicename,
Header: nodeConfig.Header,
}