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 1/5] 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)) } From 9798bf55526b8e57f299266317b44ae2d3d8f7ab Mon Sep 17 00:00:00 2001 From: SudoSpace <79229394+sudospaes@users.noreply.github.com> Date: Sun, 9 Jul 2023 14:34:12 +0330 Subject: [PATCH 2/5] revert changes --- web/service/xray.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/web/service/xray.go b/web/service/xray.go index 8a738b04..668d6952 100644 --- a/web/service/xray.go +++ b/web/service/xray.go @@ -106,13 +106,6 @@ 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{}) @@ -129,9 +122,6 @@ 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)) } From 65a69e967d090d997aeaee9b73e8d7cff550de17 Mon Sep 17 00:00:00 2001 From: SudoSpace <79229394+sudospaes@users.noreply.github.com> Date: Sun, 9 Jul 2023 14:36:42 +0330 Subject: [PATCH 3/5] Better bug fix bug fix, can't connect after change transmission type from tcp to other types. --- web/html/xui/inbound_modal.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/html/xui/inbound_modal.html b/web/html/xui/inbound_modal.html index 76feeea2..20b28554 100644 --- a/web/html/xui/inbound_modal.html +++ b/web/html/xui/inbound_modal.html @@ -111,6 +111,11 @@ if (!inModal.inbound.canEnableReality()) { this.inModal.inbound.reality = false; } + if (this.inModal.inbound.protocol == Protocols.VLESS && !inModal.inbound.canEnableTlsFlow()) { + this.inModal.inbound.settings.vlesses.forEach(client => { + client.flow = ""; + }); + } }, setDefaultCertData(index){ inModal.inbound.stream.tls.certs[index].certFile = app.defaultCert; From 95bdb064bb1c760320eda47dea9eadb64cde790a Mon Sep 17 00:00:00 2001 From: SudoSpace <79229394+sudospaes@users.noreply.github.com> Date: Sun, 9 Jul 2023 14:42:52 +0330 Subject: [PATCH 4/5] Clone Bug Fix Bug fix, set duplicate publicKey, privateKey, shortIds in cloned inbound from reality inbounds --- web/html/xui/inbounds.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 1420541d..781ea721 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -616,9 +616,17 @@ port: RandomUtil.randomIntRange(10000, 60000), protocol: baseInbound.protocol, settings: Inbound.Settings.getSettings(baseInbound.protocol).toString(), - streamSettings: baseInbound.stream.toString(), sniffing: baseInbound.canSniffing() ? baseInbound.sniffing.toString() : '{}', }; + if(baseInbound.stream.isReality) { + const getNewX25519 = await HttpUtil.post('/server/getNewX25519Cert'); + baseInbound.stream.reality.shortIds = RandomUtil.randomShortId(); + baseInbound.stream.reality.privateKey = getNewX25519.obj.privateKey + baseInbound.stream.reality.settings.publicKey = getNewX25519.obj.publicKey; + data.streamSettings = baseInbound.stream.toString(); + } else { + data.streamSettings = baseInbound.stream.toString(); + } await this.submit('/xui/inbound/add', data, inModal); }, async addInbound(inbound, dbInbound) { @@ -989,4 +997,4 @@ {{template "clientsModal"}} {{template "clientsBulkModal"}} - \ No newline at end of file + From 4b2169d9f6092db10511123fc1ce53e543c19f59 Mon Sep 17 00:00:00 2001 From: SudoSpace <79229394+sudospaes@users.noreply.github.com> Date: Sun, 16 Jul 2023 14:33:07 +0330 Subject: [PATCH 5/5] revert changes --- web/html/xui/inbounds.html | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 781ea721..11e9de7a 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -616,17 +616,9 @@ port: RandomUtil.randomIntRange(10000, 60000), protocol: baseInbound.protocol, settings: Inbound.Settings.getSettings(baseInbound.protocol).toString(), + streamSettings: baseInbound.stream.toString(), sniffing: baseInbound.canSniffing() ? baseInbound.sniffing.toString() : '{}', }; - if(baseInbound.stream.isReality) { - const getNewX25519 = await HttpUtil.post('/server/getNewX25519Cert'); - baseInbound.stream.reality.shortIds = RandomUtil.randomShortId(); - baseInbound.stream.reality.privateKey = getNewX25519.obj.privateKey - baseInbound.stream.reality.settings.publicKey = getNewX25519.obj.publicKey; - data.streamSettings = baseInbound.stream.toString(); - } else { - data.streamSettings = baseInbound.stream.toString(); - } await this.submit('/xui/inbound/add', data, inModal); }, async addInbound(inbound, dbInbound) {