xray-core: init: add option to control FullConeNAT setting
authorTianling Shen <redacted>
Thu, 11 Feb 2021 16:21:28 +0000 (00:21 +0800)
committerTianling Shen <redacted>
Fri, 12 Feb 2021 17:43:41 +0000 (01:43 +0800)
Latest version of xray-core made a change to support FullCone NAT,
which would break UDP connection from v2ray-core backend server.
So added the option for v2ray-core users, to make sure UDP works
as expected.

Signed-off-by: Tianling Shen <redacted>
net/xray-core/files/xray.conf
net/xray-core/files/xray.init

index d3d2728eee7b2c671c3c413714ed4b2b8e208119..aa742e6688a601b790c2d4ce50bb73ec9c29d7ae 100644 (file)
@@ -1,6 +1,7 @@
 
 config xray 'enabled'
        option enabled '0'
+       option fullcone '1'
 
 config xray 'config'
        option confdir '/etc/xray'
index 8ee5caa8f89980cf3dd0e98c246f2d3aad9b68d8..b6fe7043b2eb75bb9127b7ce3a3d02eef933888f 100755 (executable)
@@ -18,11 +18,13 @@ start_service() {
        local conffiles
        local datadir
        local format
+       local fullcone
 
        config_get confdir "config" "confdir"
        config_get conffiles "config" "conffiles"
        config_get datadir "config" "datadir" "/usr/share/xray"
        config_get format "config" "format" "json"
+       config_get fullcone "enabled" "fullcone" "0"
 
        procd_open_instance "$CONF"
        procd_set_param command "$PROG" run
@@ -34,6 +36,7 @@ start_service() {
                done
        }
        procd_append_param command -format "$format"
+       [ "$fullcone" -eq "0" ] && procd_set_param env XRAY_CONE_DISABLED="true"
        procd_set_param env XRAY_LOCATION_ASSET="$datadir"
        procd_set_param file $conffiles
 
git clone https://git.99rst.org/PROJECT