git: 7beda315f145 - main - security/xray: Update to 1.7.5

From: Neel Chauhan <nc_at_FreeBSD.org>
Date: Fri, 01 Sep 2023 20:17:09 UTC
The branch main has been updated by nc:

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

commit 7beda315f1451f36f6fa7525cc965d27108e000c
Author:     Neel Chauhan <nc@FreeBSD.org>
AuthorDate: 2023-09-01 20:15:57 +0000
Commit:     Neel Chauhan <nc@FreeBSD.org>
CommitDate: 2023-09-01 20:16:54 +0000

    security/xray: Update to 1.7.5
    
    Approved by:    maintainer
---
 security/xray-core/Makefile                |  76 ++++++++-------------
 security/xray-core/distinfo                | 102 ++++-------------------------
 security/xray-core/files/00_log.json       |   7 ++
 security/xray-core/files/01_api.json       |   6 ++
 security/xray-core/files/02_dns.json       |   4 ++
 security/xray-core/files/03_routing.json   |   8 +++
 security/xray-core/files/04_policy.json    |  12 ++++
 security/xray-core/files/05_inbounds.json  |   4 ++
 security/xray-core/files/06_outbounds.json |   4 ++
 security/xray-core/files/07_transport.json |  11 ++++
 security/xray-core/files/08_stats.json     |   3 +
 security/xray-core/files/09_reverse.json   |   8 +++
 security/xray-core/files/pkg-message.in    |  16 +++++
 security/xray-core/files/xray.in           |  47 +++++++++++++
 security/xray-core/pkg-plist               |  14 ++++
 15 files changed, 181 insertions(+), 141 deletions(-)

diff --git a/security/xray-core/Makefile b/security/xray-core/Makefile
index f6544b17c401..937a67aac5ef 100644
--- a/security/xray-core/Makefile
+++ b/security/xray-core/Makefile
@@ -1,8 +1,13 @@
 PORTNAME=	xray-core
 DISTVERSIONPREFIX=	v
-DISTVERSION=	1.5.5
-PORTREVISION=	12
+DISTVERSION=	1.7.5
 CATEGORIES=	security
+MASTER_SITES=	https://github.com/v2ray/geoip/releases/download/202308310037/:geoip \
+		https://github.com/v2ray/domain-list-community/releases/download/20230825070717/:geosite
+DISTFILES=	geoip.dat:geoip \
+		dlc.dat:geosite
+EXTRACT_ONLY=	v${DISTVERSION}.zip \
+		xtls-Xray-core-v${DISTVERSION}_GH0.tar.gz
 
 MAINTAINER=	nc@FreeBSD.org
 COMMENT=	Set of network penetration tools
@@ -11,63 +16,34 @@ WWW=		https://github.com/XTLS/Xray-core
 LICENSE=	MPL20
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BROKEN=		requires unsupported go1.18
+USES=		go:modules
 
-# USES=		go:1.18,modules
+USE_RC_SUBR=	xray
+SUB_FILES=	pkg-message
+
+USERS=		v2ray
+GROUPS=		v2ray
+
+SUB_LIST=	GROUP="${GROUPS}" \
+		USER="${USERS}"
 
 GO_PKGNAME=	github.com/${GH_ACCOUNT}/${PORTNAME}
+GO_MODULE=	github.com/${GH_ACCOUNT}/${PORTNAME}
 GO_TARGET=	./main:xray
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	xtls
 GH_PROJECT=	Xray-core
 
-GH_TUPLE=	\
-		cheekybits:genny:v1.0.0:cheekybits_genny/vendor/github.com/cheekybits/genny \
-		davecgh:go-spew:v1.1.1:davecgh_go_spew/vendor/github.com/davecgh/go-spew \
-		dgryski:go-metro:adc40b04c140:dgryski_go_metro/vendor/github.com/dgryski/go-metro \
-		francoispqt:gojay:v1.2.13:francoispqt_gojay/vendor/github.com/francoispqt/gojay \
-		fsnotify:fsnotify:v1.5.3:fsnotify_fsnotify/vendor/github.com/fsnotify/fsnotify \
-		ghodss:yaml:25d852aebe32:ghodss_yaml/vendor/github.com/ghodss/yaml \
-		go-task:slim-sprig:348f09dbbbc0:go_task_slim_sprig/vendor/github.com/go-task/slim-sprig \
-		go-tomb:tomb:dd632973f1e7:go_tomb_tomb/vendor/gopkg.in/tomb.v1 \
-		go-yaml:yaml:496545a6307b:go_yaml_yaml_1/vendor/gopkg.in/yaml.v3 \
-		go-yaml:yaml:v2.4.0:go_yaml_yaml/vendor/gopkg.in/yaml.v2 \
-		golang:crypto:7b82a4e95df4:golang_crypto/vendor/golang.org/x/crypto \
-		golang:mock:v1.6.0:golang_mock/vendor/github.com/golang/mock \
-		golang:mod:9b9b3d81d5e3:golang_mod/vendor/golang.org/x/mod \
-		golang:net:1d1ef9303861:golang_net/vendor/golang.org/x/net \
-		golang:protobuf:v1.5.2:golang_protobuf/vendor/github.com/golang/protobuf \
-		golang:sync:036812b2e83c:golang_sync/vendor/golang.org/x/sync \
-		golang:sys:9388b58f7150:golang_sys/vendor/golang.org/x/sys \
-		golang:text:v0.3.7:golang_text/vendor/golang.org/x/text \
-		golang:tools:v0.1.10:golang_tools/vendor/golang.org/x/tools \
-		golang:xerrors:2f41105eb62f:golang_xerrors/vendor/golang.org/x/xerrors \
-		google:go-cmp:v0.5.7:google_go_cmp/vendor/github.com/google/go-cmp \
-		google:go-genproto:b37d22cd5731:google_go_genproto/vendor/google.golang.org/genproto \
-		google:starlark-go:d1966c6b9fcd:google_starlark_go/vendor/go.starlark.net \
-		gorilla:websocket:v1.5.0:gorilla_websocket/vendor/github.com/gorilla/websocket \
-		grpc:grpc-go:v1.46.0:grpc_grpc_go/vendor/google.golang.org/grpc \
-		h12w:socks:v1.0.3:h12w_socks/vendor/h12.io/socks \
-		lucas-clemente:quic-go:v0.27.0:lucas_clemente_quic_go/vendor/github.com/lucas-clemente/quic-go \
-		marten-seemann:qtls-go1-16:v0.1.5:marten_seemann_qtls_go1_16/vendor/github.com/marten-seemann/qtls-go1-16 \
-		marten-seemann:qtls-go1-17:v0.1.1:marten_seemann_qtls_go1_17/vendor/github.com/marten-seemann/qtls-go1-17 \
-		marten-seemann:qtls-go1-18:v0.1.1:marten_seemann_qtls_go1_18/vendor/github.com/marten-seemann/qtls-go1-18 \
-		miekg:dns:v1.1.48:miekg_dns/vendor/github.com/miekg/dns \
-		nxadm:tail:v1.4.8:nxadm_tail/vendor/github.com/nxadm/tail \
-		onsi:ginkgo:v1.16.5:onsi_ginkgo/vendor/github.com/onsi/ginkgo \
-		pelletier:go-toml:v1.9.5:pelletier_go_toml/vendor/github.com/pelletier/go-toml \
-		pires:go-proxyproto:v0.6.2:pires_go_proxyproto/vendor/github.com/pires/go-proxyproto \
-		pmezard:go-difflib:v1.0.0:pmezard_go_difflib/vendor/github.com/pmezard/go-difflib \
-		protocolbuffers:protobuf-go:v1.28.0:protocolbuffers_protobuf_go/vendor/google.golang.org/protobuf \
-		refraction-networking:utls:v1.0.0:refraction_networking_utls/vendor/github.com/refraction-networking/utls \
-		riobard:go-bloom:cdc8013cb5b3:riobard_go_bloom/vendor/github.com/riobard/go-bloom \
-		seiflotfy:cuckoofilter:e3b120b3f5fb:seiflotfy_cuckoofilter/vendor/github.com/seiflotfy/cuckoofilter \
-		stretchr:objx:v0.1.0:stretchr_objx/vendor/github.com/stretchr/objx \
-		stretchr:testify:v1.7.1:stretchr_testify/vendor/github.com/stretchr/testify \
-		v2fly:ss-bloomring:28617310f63e:v2fly_ss_bloomring/vendor/github.com/v2fly/ss-bloomring \
-		xtls:Go:d4af136d3672:xtls_go/vendor/github.com/xtls/go
+post-extract:
+	${CP} ${DISTDIR}/${DIST_SUBDIR}/geoip.dat ${WRKSRC}/geoip.dat
+	${CP} ${DISTDIR}/${DIST_SUBDIR}/dlc.dat ${WRKSRC}/geosite.dat
 
-PLIST_FILES=	bin/xray
+post-install:
+	${MKDIR} ${STAGEDIR}${ETCDIR}
+	${MKDIR} ${STAGEDIR}${DATADIR}
+	${INSTALL_DATA} ${WRKSRC}/geoip.dat ${STAGEDIR}${DATADIR}/geoip.dat
+	${INSTALL_DATA} ${WRKSRC}/geosite.dat ${STAGEDIR}${DATADIR}/geosite.dat
+	${INSTALL_DATA} ${FILESDIR}/*.json ${STAGEDIR}${ETCDIR}/
 
 .include <bsd.port.mk>
diff --git a/security/xray-core/distinfo b/security/xray-core/distinfo
index a90caf425973..b08b5cf10059 100644
--- a/security/xray-core/distinfo
+++ b/security/xray-core/distinfo
@@ -1,91 +1,11 @@
-TIMESTAMP = 1651439244
-SHA256 (xtls-Xray-core-v1.5.5_GH0.tar.gz) = 3f8d04fef82a922c83bab43cac6c86a76386cf195eb510ccf1cc175982693893
-SIZE (xtls-Xray-core-v1.5.5_GH0.tar.gz) = 545116
-SHA256 (cheekybits-genny-v1.0.0_GH0.tar.gz) = 6982bf513333fb3ee3e6e0633500a3800fb6a3d6beb9e6c6084a96c85a49dd73
-SIZE (cheekybits-genny-v1.0.0_GH0.tar.gz) = 15585
-SHA256 (davecgh-go-spew-v1.1.1_GH0.tar.gz) = 7d82b9bb7291adbe7498fe946920ab3e7fc9e6cbfc3b2294693fad00bf0dd17e
-SIZE (davecgh-go-spew-v1.1.1_GH0.tar.gz) = 42152
-SHA256 (dgryski-go-metro-adc40b04c140_GH0.tar.gz) = 799a1b742820854095fcfda6b05b7823a27af39a2c7158a5fe9e10be076f7afa
-SIZE (dgryski-go-metro-adc40b04c140_GH0.tar.gz) = 4505
-SHA256 (francoispqt-gojay-v1.2.13_GH0.tar.gz) = 69de41c398b38217fbbb7e16a71893c7165bc8e59ba5d5b88b00db48f50cb3d5
-SIZE (francoispqt-gojay-v1.2.13_GH0.tar.gz) = 165255
-SHA256 (fsnotify-fsnotify-v1.5.3_GH0.tar.gz) = e86f80ea1adb281cb7f3f5dcee94c3ace9a6bfc0e826ff81ad705463b5779d80
-SIZE (fsnotify-fsnotify-v1.5.3_GH0.tar.gz) = 31489
-SHA256 (ghodss-yaml-25d852aebe32_GH0.tar.gz) = 52ad2f9939d39cd22a4267ad385eeef1ae6ae329929bb4117181f87af1689c27
-SIZE (ghodss-yaml-25d852aebe32_GH0.tar.gz) = 14351
-SHA256 (go-task-slim-sprig-348f09dbbbc0_GH0.tar.gz) = c52607aad259efae7f725eadf0493933c206d36b776df117f94f6b2eeb4fd8b1
-SIZE (go-task-slim-sprig-348f09dbbbc0_GH0.tar.gz) = 40034
-SHA256 (go-tomb-tomb-dd632973f1e7_GH0.tar.gz) = b67f4ee9324a78176bc3196fe262388696aeb3f31d9879d498200219f9c4c554
-SIZE (go-tomb-tomb-dd632973f1e7_GH0.tar.gz) = 3631
-SHA256 (go-yaml-yaml-496545a6307b_GH0.tar.gz) = ed0e11dc14bbbd4127031d7e8b9e58dad885e2c44a16359d2f64b71d1d1f692a
-SIZE (go-yaml-yaml-496545a6307b_GH0.tar.gz) = 90156
-SHA256 (go-yaml-yaml-v2.4.0_GH0.tar.gz) = d8e94679e5fff6bd1a35e10241543929a5f3da44f701755babf99b3daf0faac0
-SIZE (go-yaml-yaml-v2.4.0_GH0.tar.gz) = 73209
-SHA256 (golang-crypto-7b82a4e95df4_GH0.tar.gz) = a0abdf2e7224f159862a586a79ae8878fd246671d472e295e0bf36e64bd6c9d1
-SIZE (golang-crypto-7b82a4e95df4_GH0.tar.gz) = 1630639
-SHA256 (golang-mock-v1.6.0_GH0.tar.gz) = 470174971c3a63361149a30f5b2d3a716a198afeb6cc71daa30712faa7293942
-SIZE (golang-mock-v1.6.0_GH0.tar.gz) = 69251
-SHA256 (golang-mod-9b9b3d81d5e3_GH0.tar.gz) = 17a6e030b6e35cce6189203a8f86f0c4d26cb70f16cfd10c510b0876ff9852fc
-SIZE (golang-mod-9b9b3d81d5e3_GH0.tar.gz) = 119489
-SHA256 (golang-net-1d1ef9303861_GH0.tar.gz) = 39c98f6300e292cd7eeef252437dda8a8936c14cf02eb8d929f27b2d83fb0f3c
-SIZE (golang-net-1d1ef9303861_GH0.tar.gz) = 1229670
-SHA256 (golang-protobuf-v1.5.2_GH0.tar.gz) = 088cc0f3ba18fb8f9d00319568ff0af5a06d8925a6e6cb983bb837b4efb703b3
-SIZE (golang-protobuf-v1.5.2_GH0.tar.gz) = 171702
-SHA256 (golang-sync-036812b2e83c_GH0.tar.gz) = 75ac8fc16bdceb2496c4a9cc98584b70c29032d91a9e57a624acb073e3232fda
-SIZE (golang-sync-036812b2e83c_GH0.tar.gz) = 18752
-SHA256 (golang-sys-9388b58f7150_GH0.tar.gz) = 14b5828b22179f331d8f54496f453ecb20a07d66d165cdd7b06bb044b305bc25
-SIZE (golang-sys-9388b58f7150_GH0.tar.gz) = 1303010
-SHA256 (golang-text-v0.3.7_GH0.tar.gz) = 7cab2f6c3133ac1d422edd952b0dd2082fa55a73c2663fb2defd9bf83d649b26
-SIZE (golang-text-v0.3.7_GH0.tar.gz) = 8354718
-SHA256 (golang-tools-v0.1.10_GH0.tar.gz) = 9791babef393ab33e90b6045eead923abf37a9a30f79737aed309befa8e01740
-SIZE (golang-tools-v0.1.10_GH0.tar.gz) = 3014465
-SHA256 (golang-xerrors-2f41105eb62f_GH0.tar.gz) = 8f14b34849ccbc86957388fd13403f4de500dfd3fae41ca4d329f0ee562f0499
-SIZE (golang-xerrors-2f41105eb62f_GH0.tar.gz) = 13702
-SHA256 (google-go-cmp-v0.5.7_GH0.tar.gz) = 70c779a3f2625d7ab5a427b4244b93c2e6a8d1cd779c182fc4fad7ff864a4fb2
-SIZE (google-go-cmp-v0.5.7_GH0.tar.gz) = 104499
-SHA256 (google-go-genproto-b37d22cd5731_GH0.tar.gz) = 6ca4b0d182af3abc976aca11b20738a53dc333c2d4d65ffbab92cb5972159941
-SIZE (google-go-genproto-b37d22cd5731_GH0.tar.gz) = 13374294
-SHA256 (google-starlark-go-d1966c6b9fcd_GH0.tar.gz) = 00c0923dcc2038f154971a26ce54737473c5b63ba561bb0137f5bb3006ae6a2d
-SIZE (google-starlark-go-d1966c6b9fcd_GH0.tar.gz) = 269468
-SHA256 (gorilla-websocket-v1.5.0_GH0.tar.gz) = 5d86f9e1c76ff7ceca0747f78b79864fbaec9d440f4fdb03197466e5102a86b0
-SIZE (gorilla-websocket-v1.5.0_GH0.tar.gz) = 54155
-SHA256 (grpc-grpc-go-v1.46.0_GH0.tar.gz) = 61786043335c6bf55017ca6f273d6f4dda9b79e258f098257efe2444ae826404
-SIZE (grpc-grpc-go-v1.46.0_GH0.tar.gz) = 1520449
-SHA256 (h12w-socks-v1.0.3_GH0.tar.gz) = 50b107b8f3e06d6f8bcc00f9e8a63e490e426a62617f36700bc336de055f613e
-SIZE (h12w-socks-v1.0.3_GH0.tar.gz) = 14641
-SHA256 (lucas-clemente-quic-go-v0.27.0_GH0.tar.gz) = b3c8762b4b942964a606c559c65f37b0167d7a9bb6cdcbecb4313c0b9b4e774c
-SIZE (lucas-clemente-quic-go-v0.27.0_GH0.tar.gz) = 527888
-SHA256 (marten-seemann-qtls-go1-16-v0.1.5_GH0.tar.gz) = 58fbfb248ae7169a1a9cf47398b0746e0ce0225fce548bce282e6365cb2d4b69
-SIZE (marten-seemann-qtls-go1-16-v0.1.5_GH0.tar.gz) = 415648
-SHA256 (marten-seemann-qtls-go1-17-v0.1.1_GH0.tar.gz) = 9f6dc4d8013f4b63ad69e3de2c87f31a68fd9f3a0a9d4fd0c2cc1af272ec5f02
-SIZE (marten-seemann-qtls-go1-17-v0.1.1_GH0.tar.gz) = 421465
-SHA256 (marten-seemann-qtls-go1-18-v0.1.1_GH0.tar.gz) = 17284b1fed3b5e916122cd31f3c36ffbd782244e096c7165f588df612a16adf4
-SIZE (marten-seemann-qtls-go1-18-v0.1.1_GH0.tar.gz) = 422031
-SHA256 (miekg-dns-v1.1.48_GH0.tar.gz) = aed5aa183894c0af7d64f8939559ad8a5a1913f98af13142e8f52c1b016696a0
-SIZE (miekg-dns-v1.1.48_GH0.tar.gz) = 206316
-SHA256 (nxadm-tail-v1.4.8_GH0.tar.gz) = 8208362046819275a0809000dceacbd7b2a7caa07bcd6547dd2ff9b2104fa56c
-SIZE (nxadm-tail-v1.4.8_GH0.tar.gz) = 1255770
-SHA256 (onsi-ginkgo-v1.16.5_GH0.tar.gz) = 0380c81321b764b75e76a7aa8fc8ab1ab361232a88d5b6124ef8b9a9e75d5287
-SIZE (onsi-ginkgo-v1.16.5_GH0.tar.gz) = 164965
-SHA256 (pelletier-go-toml-v1.9.5_GH0.tar.gz) = 7ee5ee9344a5c18eebf9487782e00b2dbeaaf19be64b447a1e1d90f8aed710e8
-SIZE (pelletier-go-toml-v1.9.5_GH0.tar.gz) = 106932
-SHA256 (pires-go-proxyproto-v0.6.2_GH0.tar.gz) = 3de114552eaa76bc8296f6829bacc29c98a39310421e46d825c18142ba7ca024
-SIZE (pires-go-proxyproto-v0.6.2_GH0.tar.gz) = 37548
-SHA256 (pmezard-go-difflib-v1.0.0_GH0.tar.gz) = 28f3dc1b5c0efd61203ab07233f774740d3bf08da4d8153fb5310db6cea0ebda
-SIZE (pmezard-go-difflib-v1.0.0_GH0.tar.gz) = 11398
-SHA256 (protocolbuffers-protobuf-go-v1.28.0_GH0.tar.gz) = e59ae9ace31c3a84bddf1bc3f04a04c498adb9ea7f9fcde60db91bba33d55171
-SIZE (protocolbuffers-protobuf-go-v1.28.0_GH0.tar.gz) = 1279757
-SHA256 (refraction-networking-utls-v1.0.0_GH0.tar.gz) = 88c18e1913b291dc58b5088e7b1115508a6e0b1460f6bdb8b68ff761e56111ce
-SIZE (refraction-networking-utls-v1.0.0_GH0.tar.gz) = 546244
-SHA256 (riobard-go-bloom-cdc8013cb5b3_GH0.tar.gz) = b5c63cb5fb20bafcb7aef065d79fb9260ce8b8642dd2702d1d5e33f7c76f86c5
-SIZE (riobard-go-bloom-cdc8013cb5b3_GH0.tar.gz) = 5493
-SHA256 (seiflotfy-cuckoofilter-e3b120b3f5fb_GH0.tar.gz) = d5227dcff0c16cac9fabc898935abcf2218d7bc7adc94ea7ad50592312ec25f3
-SIZE (seiflotfy-cuckoofilter-e3b120b3f5fb_GH0.tar.gz) = 6825
-SHA256 (stretchr-objx-v0.1.0_GH0.tar.gz) = 41b4e6679211d4b628df627013435b7d4e6e396d54b5b89e3a4d4eb54545e7f8
-SIZE (stretchr-objx-v0.1.0_GH0.tar.gz) = 109451
-SHA256 (stretchr-testify-v1.7.1_GH0.tar.gz) = 5a53303e8ae54d0d581895f5bf8aae82f64f53c04c1c0f9e27a0ebeffa579a92
-SIZE (stretchr-testify-v1.7.1_GH0.tar.gz) = 93989
-SHA256 (v2fly-ss-bloomring-28617310f63e_GH0.tar.gz) = 1cc39aa34e7147a79b16bf56e0fa6e8b1677f20c775b429585b09660482942dd
-SIZE (v2fly-ss-bloomring-28617310f63e_GH0.tar.gz) = 5704
-SHA256 (xtls-Go-d4af136d3672_GH0.tar.gz) = 3542a3c1f1e588b7eb47e01bf55dff2d85184ad6ab017a62e6331d509c7f4a30
-SIZE (xtls-Go-d4af136d3672_GH0.tar.gz) = 88521
+TIMESTAMP = 1693528419
+SHA256 (go/security_xray-core/xtls-Xray-core-v1.7.5_GH0/geoip.dat) = 536d7aa9f54af747153d4f982adaa3181025dd72faaba8f532b3f514b467eff8
+SIZE (go/security_xray-core/xtls-Xray-core-v1.7.5_GH0/geoip.dat) = 10591274
+SHA256 (go/security_xray-core/xtls-Xray-core-v1.7.5_GH0/dlc.dat) = 231a6fb4915f7652ad9b2027965fbbb27435ffa9b3a0734ad2b69693e95d6604
+SIZE (go/security_xray-core/xtls-Xray-core-v1.7.5_GH0/dlc.dat) = 1594785
+SHA256 (go/security_xray-core/xtls-Xray-core-v1.7.5_GH0/v1.7.5.mod) = 6d45a243922836e2422095192b0bd4948745147aef4cfc7883d440307bfbde1b
+SIZE (go/security_xray-core/xtls-Xray-core-v1.7.5_GH0/v1.7.5.mod) = 2480
+SHA256 (go/security_xray-core/xtls-Xray-core-v1.7.5_GH0/v1.7.5.zip) = e2c2338ce24ba15d9f7cc93686e06e1fb15a33a345e5fa5d4f28a345dffb9014
+SIZE (go/security_xray-core/xtls-Xray-core-v1.7.5_GH0/v1.7.5.zip) = 970336
+SHA256 (go/security_xray-core/xtls-Xray-core-v1.7.5_GH0/xtls-Xray-core-v1.7.5_GH0.tar.gz) = a5fc936136a57a463bf9a895d068fdfa895b168ae6093c58a10208e098b6b2d3
+SIZE (go/security_xray-core/xtls-Xray-core-v1.7.5_GH0/xtls-Xray-core-v1.7.5_GH0.tar.gz) = 579098
diff --git a/security/xray-core/files/00_log.json b/security/xray-core/files/00_log.json
new file mode 100644
index 000000000000..b118b36b44f4
--- /dev/null
+++ b/security/xray-core/files/00_log.json
@@ -0,0 +1,7 @@
+{
+  "log": {
+    "access": "/var/log/xray-core/access.log",
+    "error": "/var/log/xray-core/error.log",
+    "loglevel": "warning"
+  }
+}
diff --git a/security/xray-core/files/01_api.json b/security/xray-core/files/01_api.json
new file mode 100644
index 000000000000..81d8ee9b37e1
--- /dev/null
+++ b/security/xray-core/files/01_api.json
@@ -0,0 +1,6 @@
+{
+  "api": {
+    "tag": "api",
+    "services": ["HandlerService", "LoggerService", "StatsService"]
+  }
+}
diff --git a/security/xray-core/files/02_dns.json b/security/xray-core/files/02_dns.json
new file mode 100644
index 000000000000..822fb4dc0be5
--- /dev/null
+++ b/security/xray-core/files/02_dns.json
@@ -0,0 +1,4 @@
+{
+  "dns": {
+  }
+}
diff --git a/security/xray-core/files/03_routing.json b/security/xray-core/files/03_routing.json
new file mode 100644
index 000000000000..2ea3ab998d27
--- /dev/null
+++ b/security/xray-core/files/03_routing.json
@@ -0,0 +1,8 @@
+{
+  "routing": {
+    "domainStrategy": "IPIfNonMatch",
+    "domainMatcher": "hybrid",
+    "rules": [],
+    "balancers": []
+  }
+}
diff --git a/security/xray-core/files/04_policy.json b/security/xray-core/files/04_policy.json
new file mode 100644
index 000000000000..f422ab94c261
--- /dev/null
+++ b/security/xray-core/files/04_policy.json
@@ -0,0 +1,12 @@
+{
+  "policy": {
+    "levels": {
+    },
+    "system": {
+      "statsInboundUplink": false,
+      "statsInboundDownlink": false,
+      "statsOutboundUplink": false,
+      "statsOutboundDownlink": false
+    }
+  }
+}
diff --git a/security/xray-core/files/05_inbounds.json b/security/xray-core/files/05_inbounds.json
new file mode 100644
index 000000000000..19eb93544313
--- /dev/null
+++ b/security/xray-core/files/05_inbounds.json
@@ -0,0 +1,4 @@
+{
+  "inbounds": [
+  ]
+}
diff --git a/security/xray-core/files/06_outbounds.json b/security/xray-core/files/06_outbounds.json
new file mode 100644
index 000000000000..106026c78f8f
--- /dev/null
+++ b/security/xray-core/files/06_outbounds.json
@@ -0,0 +1,4 @@
+{
+  "outbounds": [
+  ]
+}
diff --git a/security/xray-core/files/07_transport.json b/security/xray-core/files/07_transport.json
new file mode 100644
index 000000000000..c9bc7497ff50
--- /dev/null
+++ b/security/xray-core/files/07_transport.json
@@ -0,0 +1,11 @@
+{
+  "transport": {
+    "tcpSettings": {},
+    "kcpSettings": {},
+    "wsSettings": {},
+    "httpSettings": {},
+    "quicSettings": {},
+    "dsSettings": {},
+    "grpcSettings": {}
+  }
+}
diff --git a/security/xray-core/files/08_stats.json b/security/xray-core/files/08_stats.json
new file mode 100644
index 000000000000..8721468fc28f
--- /dev/null
+++ b/security/xray-core/files/08_stats.json
@@ -0,0 +1,3 @@
+{
+  "stats": {}
+}
diff --git a/security/xray-core/files/09_reverse.json b/security/xray-core/files/09_reverse.json
new file mode 100644
index 000000000000..5a6b7dcc3e2b
--- /dev/null
+++ b/security/xray-core/files/09_reverse.json
@@ -0,0 +1,8 @@
+{
+  "reverse": {
+    "bridges": [
+    ],
+    "portals": [
+    ]
+  }
+}
diff --git a/security/xray-core/files/pkg-message.in b/security/xray-core/files/pkg-message.in
new file mode 100644
index 000000000000..802f85feb88f
--- /dev/null
+++ b/security/xray-core/files/pkg-message.in
@@ -0,0 +1,16 @@
+[
+{ type: install
+  message: <<EOM
+To start the Xray automatically when the system is started, append
+the following in your ${PREFIX}/etc/rc.conf file:
+
+xray_enable="YES"               # Xray Core
+
+To manually start the xray run (as root):
+# %%PREFIX%%/etc/rc.d/xray start
+
+To manually stop it:
+# %%PREFIX%%/etc/rc.d/xray stop
+EOM
+}
+]
diff --git a/security/xray-core/files/xray.in b/security/xray-core/files/xray.in
new file mode 100644
index 000000000000..87516c9759d0
--- /dev/null
+++ b/security/xray-core/files/xray.in
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# PROVIDE: xray-core
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+# 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
+
+. /etc/rc.subr
+
+name="xray"
+rcvar="xray_enable"
+
+: ${xray_enable="NO"}
+: ${xray_config="%%PREFIX%%/etc/${name}-core"}
+: ${xray_logdir="/var/log/${name}-core"}
+: ${xray_env=""}
+: ${xray_user="%%USER%%"}
+: ${xray_group="%%GROUP%%"}
+
+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}"
+required_files="${xray_config}"
+
+start_precmd="xray_startprecmd"
+
+xray_startprecmd() {
+	touch "${pidfile}"
+	chown ${xray_user}:${xray_group} "${pidfile}"
+	mkdir -p "${xray_logdir}"
+	chown -R ${xray_user}:${xray_group} "${xray_logdir}"
+}
+
+load_rc_config "$name"
+run_rc_command "$1"
diff --git a/security/xray-core/pkg-plist b/security/xray-core/pkg-plist
new file mode 100644
index 000000000000..48ef6089ac67
--- /dev/null
+++ b/security/xray-core/pkg-plist
@@ -0,0 +1,14 @@
+bin/xray
+etc/rc.d/xray
+%%ETCDIR%%/00_log.json
+%%ETCDIR%%/01_api.json
+%%ETCDIR%%/02_dns.json
+%%ETCDIR%%/03_routing.json
+%%ETCDIR%%/04_policy.json
+%%ETCDIR%%/05_inbounds.json
+%%ETCDIR%%/06_outbounds.json
+%%ETCDIR%%/07_transport.json
+%%ETCDIR%%/08_stats.json
+%%ETCDIR%%/09_reverse.json
+%%DATADIR%%/geoip.dat
+%%DATADIR%%/geosite.dat