diff options
| author | Alireza Ahmadi <alireza7@gmail.com> | 2023-12-08 19:21:43 +0300 |
|---|---|---|
| committer | Alireza Ahmadi <alireza7@gmail.com> | 2023-12-08 19:21:43 +0300 |
| commit | bcc897640e68f7a731d39bee04c8930d7d7196c6 (patch) | |
| tree | b5fae14600b664f4f348e0e9b7eb2b85102c5b86 /web/service | |
| parent | 5e47b4e94925c2272a7f0a4cc355cede72c671a4 (diff) | |
del x-ui settings in final tls/reality #1300
Diffstat (limited to 'web/service')
| -rw-r--r-- | web/service/xray.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/web/service/xray.go b/web/service/xray.go index 2dbc092d..1d046a44 100644 --- a/web/service/xray.go +++ b/web/service/xray.go @@ -134,6 +134,27 @@ func (s *XrayService) GetXrayConfig() (*xray.Config, error) { inbound.Settings = string(modifiedSettings) } + + // 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") + } + newStream, err := json.MarshalIndent(stream, "", " ") + if err != nil { + return nil, err + } + inbound.StreamSettings = string(newStream) + } + inboundConfig := inbound.GenXrayInboundConfig() xrayConfig.InboundConfigs = append(xrayConfig.InboundConfigs, *inboundConfig) } |
