git: d34613e8d05a - main - security/xray-core: Fix runtime: remove "legacy reverse" feature

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Mon, 07 Sep 2026 23:36:48 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d34613e8d05af5ba7ea132d0dcafe50004d08ae2

commit d34613e8d05af5ba7ea132d0dcafe50004d08ae2
Author:     Boris Korzun <drtr0jan@yandex.ru>
AuthorDate: 2026-09-07 23:29:48 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2026-09-07 23:36:39 +0000

    security/xray-core: Fix runtime: remove "legacy reverse" feature
    
    Failed to start: main: failed to load config files: [/usr/local/etc/xray-core/00_log.json /usr/local/etc/xray-core/01_api.json /usr/local/etc/xray-core/02_dns.json  /usr/local/etc/xray-core/03_routing.json /usr/local/etc/xray-core/04_policy.json /usr/local/etc/xray-core/05_inbounds.json /usr/local/etc/xray-core/06_outbounds.json /usr/local/etc/xray-core/07_transport.json /usr/local/etc/xray-cor e/08_stats.json /usr/local/etc/xray-core/09_reverse.json] > common/errors: The feature "legacy reverse" has been removed and migrated to "VLESS Reverse Proxy". Please update your config(s) according to release note and documentation.
    
    - Add daemon syslog_output_enable feature to rc.script.
    - Fix build with custom (non v2ray) USER/GROUP.
    
    PR:             298264
    Approved by:    Kirill Lebedev <kirill@drlebedev.com> (maintainer)
    Sponsored by:   UNIS Labs (vvd, commit patch)
---
 security/xray-core/Makefile                     | 20 ++++++++----
 security/xray-core/files/09_reverse.json.sample |  8 -----
 security/xray-core/files/xray.in                | 42 +++++++++++++++++++------
 security/xray-core/pkg-plist                    |  1 -
 4 files changed, 46 insertions(+), 25 deletions(-)

diff --git a/security/xray-core/Makefile b/security/xray-core/Makefile
index 54cbe312b49d..35d445e2d871 100644
--- a/security/xray-core/Makefile
+++ b/security/xray-core/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	xray-core
 DISTVERSIONPREFIX=	v
 DISTVERSION=	26.7.28
+PORTREVISION=	1
 CATEGORIES=	security
 MASTER_SITES=	https://github.com/v2fly/geoip/releases/download/202608050239/:geoip \
 		https://github.com/v2fly/domain-list-community/releases/download/20260831141734/:geosite
@@ -15,7 +16,7 @@ WWW=		https://github.com/XTLS/Xray-core
 LICENSE=	MPL20
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-USES=		go:1.26+,modules
+USES=		go:modules
 USE_GITHUB=	yes
 GH_ACCOUNT=	XTLS
 GH_PROJECT=	Xray-core
@@ -28,12 +29,19 @@ GO_TARGET=	./main:xray
 
 CONFLICTS_INSTALL=	xray
 
-SUB_FILES=	pkg-message
-SUB_LIST=	GROUP="${GROUPS}" \
-		USER="${USERS}"
+XRAY_USER?=	v2ray
+XRAY_GROUP?=	v2ray
 
-USERS=		v2ray
-GROUPS=		v2ray
+SUB_FILES=	pkg-message
+SUB_LIST=	GROUP="${XRAY_GROUP}" \
+		USER="${XRAY_USER}"
+
+.if ${XRAY_USER} == v2ray
+USERS=		${XRAY_USER}
+.endif
+.if ${XRAY_GROUP} == v2ray
+GROUPS=		${XRAY_GROUP}
+.endif
 
 post-install:
 	${MKDIR} ${STAGEDIR}${ETCDIR} \
diff --git a/security/xray-core/files/09_reverse.json.sample b/security/xray-core/files/09_reverse.json.sample
deleted file mode 100644
index 5a6b7dcc3e2b..000000000000
--- a/security/xray-core/files/09_reverse.json.sample
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "reverse": {
-    "bridges": [
-    ],
-    "portals": [
-    ]
-  }
-}
diff --git a/security/xray-core/files/xray.in b/security/xray-core/files/xray.in
index 18c9beeb4f5c..ee1e895df70c 100644
--- a/security/xray-core/files/xray.in
+++ b/security/xray-core/files/xray.in
@@ -6,14 +6,22 @@
 
 # Add these lines to /etc/rc.conf.local or /etc/rc.conf to enable `xray':
 #
-# xray_enable (bool):		Set to "NO" by default.
-#                           	Set it to "YES" to enable xray
-# xray_config (path):		Set to "%%PREFIX%%/etc/xray-core" by default
-#                             	Set it to the xray server config
-# xray_logdir (path):		Set to "/var/log/xray-core" by default.
-#                               Set it to the directory of xray log files
-# xray_env (str):		Set to "" by default.
-#                               Set it to the desired environment variables
+# xray_enable (bool):			Set to "NO" by default.
+#					Set it to "YES" to enable xray
+# xray_config (path):			Set to "%%PREFIX%%/etc/xray-core" by default
+#					Set it to the xray server config
+# xray_logdir (path):			Set to "/var/log/xray-core" by default.
+#					Set it to the directory of xray log files
+# xray_env (str):			Set to "" by default.
+#					Set it to the desired environment variables
+# xray_syslog_output_enable (str):	Set to YES to enable syslog output
+#					Default is "NO". See daemon(8).
+# xray_syslog_output_tag (str):		Set syslog tag if syslog enabled.
+#					Default is "xray". See daemon(8).
+# xray_syslog_output_priority (str):	Set syslog priority if syslog enabled.
+#					Default is "notice". See daemon(8).
+# xray_syslog_output_facility (str):	Set syslog facility if syslog enabled.
+#					Default is "daemon". See daemon(8).
 
 . /etc/rc.subr
 
@@ -25,15 +33,29 @@ load_rc_config "$name"
 : ${xray_enable="NO"}
 : ${xray_config="%%PREFIX%%/etc/${name}-core"}
 : ${xray_logdir="/var/log/${name}-core"}
-: ${xray_env=""}
+: ${xray_syslog_output_enable:="NO"}
 : ${xray_user="%%USER%%"}
 : ${xray_group="%%GROUP%%"}
 
+if checkyesno xray_syslog_output_enable; then
+	if [ -n "${xray_syslog_output_tag}" ]; then
+		xray_syslog_output_flags="-T ${xray_syslog_output_tag}"
+	else
+		xray_syslog_output_flags="-T ${name}"
+	fi
+	if [ -n "${xray_syslog_output_priority}" ]; then
+		xray_syslog_output_flags="${xray_syslog_output_flags} -s ${xray_syslog_output_priority}"
+	fi
+	if [ -n "${xray_syslog_output_facility}" ]; then
+		xray_syslog_output_flags="${xray_syslog_output_flags} -l ${xray_syslog_output_facility}"
+	fi
+fi
+
 asset_env="XRAY_LOCATION_ASSET=%%PREFIX%%/share/${name}-core"
 pidfile="/var/run/$name.pid"
 procname="%%PREFIX%%/bin/xray"
 command="/usr/sbin/daemon"
-command_args="-c -p ${pidfile} /usr/bin/env ${asset_env} ${xray_env} ${procname} -confdir ${xray_config}"
+command_args="-f -t ${name} ${xray_syslog_output_flags} -p ${pidfile} /usr/bin/env ${asset_env} ${xray_env} ${procname} -confdir ${xray_config}"
 required_files="${xray_config}"
 
 start_precmd="xray_startprecmd"
diff --git a/security/xray-core/pkg-plist b/security/xray-core/pkg-plist
index 78101a2857a4..39087ce0afd8 100644
--- a/security/xray-core/pkg-plist
+++ b/security/xray-core/pkg-plist
@@ -8,6 +8,5 @@ bin/xray
 @sample %%ETCDIR%%/06_outbounds.json.sample
 @sample %%ETCDIR%%/07_transport.json.sample
 @sample %%ETCDIR%%/08_stats.json.sample
-@sample %%ETCDIR%%/09_reverse.json.sample
 %%DATADIR%%/geoip.dat
 %%DATADIR%%/geosite.dat