mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-05-06 23:28:49 +00:00
del x-ui settings in final tls/reality #1300
This commit is contained in:
parent
5e47b4e949
commit
bcc897640e
1 changed files with 21 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue