From 0c9816b7ba13a7762f691b17d91e5635f00e55f0 Mon Sep 17 00:00:00 2001 From: SudoSpace <79229394+sudospaes@users.noreply.github.com> Date: Sat, 8 Jul 2023 19:52:35 +0330 Subject: [PATCH] Bug Fix 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. --- web/service/xray.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/service/xray.go b/web/service/xray.go index 668d6952..8a738b04 100644 --- a/web/service/xray.go +++ b/web/service/xray.go @@ -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)) }