Merge pull request #884 from amnezia-vpn/fix/android-xray-config

Fix logging configuration for XRay
This commit is contained in:
pokamest 2024-07-06 14:10:12 +01:00 committed by GitHub
commit ae4b33d042
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -117,14 +117,9 @@ class Xray : Protocol() {
val xrayJsonConfig = config.getJSONObject("xray_config_data")
val xrayConfig = parseConfig(config, xrayJsonConfig)
// for debug
// xrayJsonConfig.getJSONObject("log").put("loglevel", "debug")
xrayJsonConfig.getJSONObject("log").put("loglevel", "warning")
// disable access log
xrayJsonConfig.getJSONObject("log").put("access", "none")
// replace socks address
// (xrayJsonConfig.getJSONArray("inbounds")[0] as JSONObject).put("listen", "::1")
(xrayJsonConfig.optJSONObject("log") ?: JSONObject().also { xrayJsonConfig.put("log", it) })
.put("loglevel", "warning")
.put("access", "none") // disable access log
start(xrayConfig, xrayJsonConfig.toString(), vpnBuilder, protect)
state.value = CONNECTED