xray-core: init: add browser dialer support
authorTianling Shen <cnsztl@immortalwrt.org>
Fri, 2 Apr 2021 09:06:19 +0000 (17:06 +0800)
committerTianling Shen <cnsztl@immortalwrt.org>
Fri, 2 Apr 2021 09:29:03 +0000 (17:29 +0800)
Since v1.4.1, Xray has introduced a new feature to transfer data via
browsers, which can disguise itself as a normal browser to cheat
network censorship.

For more details, see https://github.com/XTLS/Xray-core/pull/421.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
(backported from 736667ce6eab44e265744337559c155aa99cbc00)

net/xray-core/files/xray.conf
net/xray-core/files/xray.init

index aa742e6688a601b790c2d4ce50bb73ec9c29d7ae..87174bb6b50ec3599d766912cfd88d8e3834122c 100644 (file)
@@ -7,5 +7,6 @@ config xray 'config'
        option confdir '/etc/xray'
        list conffiles '/etc/xray/config.json'
        option datadir '/usr/share/xray'
+       option dialer ''
        option format 'json'
 
index b6fe7043b2eb75bb9127b7ce3a3d02eef933888f..683c7353b8f4f73e5a52ae9794cf63aa1ab626ad 100755 (executable)
@@ -17,12 +17,14 @@ start_service() {
        local confdir
        local conffiles
        local datadir
+       local dialer
        local format
        local fullcone
 
        config_get confdir "config" "confdir"
        config_get conffiles "config" "conffiles"
        config_get datadir "config" "datadir" "/usr/share/xray"
+       config_get dialer "config" "dialer"
        config_get format "config" "format" "json"
        config_get fullcone "enabled" "fullcone" "0"
 
@@ -35,7 +37,8 @@ start_service() {
                        procd_append_param command -config "$i"
                done
        }
-       procd_append_param command -format "$format"
+       [ -n "$format" ] && procd_append_param command -format "$format"
+       [ -n "$dialer" ] && procd_set_param env XRAY_BROWSER_DIALER="$dialer"
        [ "$fullcone" -eq "0" ] && procd_set_param env XRAY_CONE_DISABLED="true"
        procd_set_param env XRAY_LOCATION_ASSET="$datadir"
        procd_set_param file $conffiles