Bug fix, can't connect after change transmission type from tcp to other types

If flow is not equal to "" in transmit except tcp, connection will not be made. This problem occurs when we change the transmission from tcp to another type. Also, if tcp itself is alone and without tls and reality, flow must be empty in it.
This commit is contained in:
SudoSpace
2023-07-08 19:52:35 +03:30
committed by GitHub
parent 09eb52483c
commit 0c9816b7ba

View File

@@ -106,6 +106,13 @@ func (s *XrayService) GetXrayConfig() (*xray.Config, error) {
// clear client config for additional parameters
var final_clients []interface{}
// detect inbound transmission type
var stream map[string]interface{}
json.Unmarshal([]byte(inbound.StreamSettings), &stream)
network, _ := stream["network"].(string)
security, _ := stream["security"].(string)
for _, client := range clients {
c := client.(map[string]interface{})
@@ -122,6 +129,9 @@ func (s *XrayService) GetXrayConfig() (*xray.Config, error) {
if c["flow"] == "xtls-rprx-vision-udp443" {
c["flow"] = "xtls-rprx-vision"
}
if network != "tcp" || !(security == "tls" || security == "reality") {
c["flow"] = ""
}
}
final_clients = append(final_clients, interface{}(c))
}