Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHo3ein <ho3ein.sanaei@gmail.com>2023-12-10 17:42:52 +0300
committerGitHub <noreply@github.com>2023-12-10 17:42:52 +0300
commite3f1d3c892a1af48f27fdc36f273a55f38d13b40 (patch)
treeb11d0c1ed3c15c8f6f891a5e6df8e021d5db8ab6 /web/service/xray.go
parent36cf7c0a8fda915b51e75958ce729fd9a61a5c90 (diff)
parent9fbe80f87f950673058f0001b3704251fa8b9243 (diff)
huge changes
Diffstat (limited to 'web/service/xray.go')
-rw-r--r--web/service/xray.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/web/service/xray.go b/web/service/xray.go
index 2dbc092d..7233cec5 100644
--- a/web/service/xray.go
+++ b/web/service/xray.go
@@ -134,6 +134,32 @@ func (s *XrayService) GetXrayConfig() (*xray.Config, error) {
inbound.Settings = string(modifiedSettings)
}
+
+ if len(inbound.StreamSettings) > 0 {
+ // Unmarshal stream JSON
+ var stream map[string]interface{}
+ json.Unmarshal([]byte(inbound.StreamSettings), &stream)
+
+ // Remove the "settings" field under "tlsSettings" and "realitySettings"
+ tlsSettings, ok1 := stream["tlsSettings"].(map[string]interface{})
+ realitySettings, ok2 := stream["realitySettings"].(map[string]interface{})
+ if ok1 || ok2 {
+ if ok1 {
+ delete(tlsSettings, "settings")
+ } else if ok2 {
+ delete(realitySettings, "settings")
+ }
+ }
+
+ delete(stream, "externalProxy")
+
+ newStream, err := json.MarshalIndent(stream, "", " ")
+ if err != nil {
+ return nil, err
+ }
+ inbound.StreamSettings = string(newStream)
+ }
+
inboundConfig := inbound.GenXrayInboundConfig()
xrayConfig.InboundConfigs = append(xrayConfig.InboundConfigs, *inboundConfig)
}