net-proxy/xray-core: new package, add 26.2.2, 9999

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
This commit is contained in:
Alexander Tsoy
2026-02-03 00:58:07 +03:00
parent 4cb3c000d1
commit 08a9fe7627
6 changed files with 200 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
DIST Xray-core-26.2.2-vendor.tar.xz 3479180 BLAKE2B c7e0bcaec911a138d09ef7bb16ec8d532780d066a46c190cef3bbb643a7afbbeb12d6f03aa8affecea60d09a5432cfcdb39013db291bf9940a3aec4ad62b6605 SHA512 142a113580a5fa08d45f33d26198b4e5a57e33897f61ac72538e9d0f0969bf30c0984205c7e9d57c3e31cbd3444b9cb9b7e19f5b21cd37f3c3ac59f093a982e0
DIST xray-core-26.2.2.tar.gz 801580 BLAKE2B 64f08a1531d2d926c66085192c3c6aa1620fec8f5dce306c105195b866be54ee1ce5ecd5ed845ac6358854c3dd6b94652e765759a66509f7823cc902f8a44587 SHA512 c621fa13c755b7ab9ed81ce3480db48142c1b76b1cd94c10efb78dd0e1f147d42f4ea0e222e743449f87abcd660557b90e26ea453c6d58d1355b6481f7e4241a

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Xray Service
After=network.target nss-lookup.target
[Service]
User=xray
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/bin/xray run -confdir /etc/xray/
Restart=on-abort
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Xray Service
After=network.target nss-lookup.target
[Service]
User=xray
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/bin/xray run -config /etc/xray/%i.jsonc
Restart=on-abort
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>alexander@tsoy.me</email>
<name>Alexander Tsoy</name>
</maintainer>
<longdescription lang="en">
Project X originates from XTLS protocol, providing a set of network tools such as Xray-core and REALITY.
</longdescription>
<upstream>
<remote-id type="github">XTLS/Xray-core</remote-id>
</upstream>
</pkgmetadata>

View File

@@ -0,0 +1,78 @@
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit go-module systemd
DESCRIPTION="A unified platform for anti-censorship"
HOMEPAGE="https://github.com/XTLS/Xray-core/"
if [[ "${PV}" == 9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/XTLS/Xray-core.git"
else
SRC_URI="
https://github.com/XTLS/Xray-core/archive/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/puleglot/Xray-core/releases/download/v${PV}/Xray-core-${PV}-vendor.tar.xz
"
KEYWORDS="~amd64"
S="${WORKDIR}/Xray-core-${PV}"
fi
# main
LICENSE="MPL-2.0"
# deps
LICENSE+=" Apache-2.0 BSD BSD-2 ISC LGPL-3 MIT"
SLOT="0"
RESTRICT="test"
RDEPEND="
acct-user/xray
acct-group/xray"
DEPEND="${RDEPEND}"
BDEPEND=">=dev-lang/go-1.25.5:="
src_unpack() {
if [[ "${PV}" == 9999* ]]; then
git-r3_src_unpack
pushd "${S}" || die
# upstream bumped required go version to 1.25.6 for no particular reason
# gvisor.dev/gvisor requires 1.25.5
sed -E -i'' 's/^go 1\.25\..*/go 1.25.5/' go.mod || die
ego mod tidy
popd || die
go-module_live_vendor
else
default
fi
}
src_prepare() {
# upstream bumped required go version to 1.25.6 for no particular reason
# gvisor.dev/gvisor requires 1.25.5
sed -E -i'' 's/^go 1\.25\..*/go 1.25.5/' go.mod || die
default
}
src_compile() {
if [[ ${PV} == 9999* ]]; then
local CUSTOM_VER="$(git rev-parse --short HEAD)"
else
local CUSTOM_VER="${PV}"
fi
CGO_ENABLED=0 ego build -ldflags="-X github.com/xtls/xray-core/core.build=${CUSTOM_VER}" \
-trimpath -o xray -v ./main
}
src_install() {
default
dobin xray
systemd_dounit "${FILESDIR}"/xray.service
systemd_newunit "${FILESDIR}"/xray_at.service "xray@.service"
keepdir /etc/xray
}

View File

@@ -0,0 +1,78 @@
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit go-module systemd
DESCRIPTION="A unified platform for anti-censorship"
HOMEPAGE="https://github.com/XTLS/Xray-core/"
if [[ "${PV}" == 9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/XTLS/Xray-core.git"
else
SRC_URI="
https://github.com/XTLS/Xray-core/archive/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/puleglot/Xray-core/releases/download/v${PV}/Xray-core-${PV}-vendor.tar.xz
"
KEYWORDS="~amd64"
S="${WORKDIR}/Xray-core-${PV}"
fi
# main
LICENSE="MPL-2.0"
# deps
LICENSE+=" Apache-2.0 BSD BSD-2 ISC LGPL-3 MIT"
SLOT="0"
RESTRICT="test"
RDEPEND="
acct-user/xray
acct-group/xray"
DEPEND="${RDEPEND}"
BDEPEND=">=dev-lang/go-1.25.5:="
src_unpack() {
if [[ "${PV}" == 9999* ]]; then
git-r3_src_unpack
pushd "${S}" || die
# upstream bumped required go version to 1.25.6 for no particular reason
# gvisor.dev/gvisor requires 1.25.5
sed -E -i'' 's/^go 1\.25\..*/go 1.25.5/' go.mod || die
ego mod tidy
popd || die
go-module_live_vendor
else
default
fi
}
src_prepare() {
# upstream bumped required go version to 1.25.6 for no particular reason
# gvisor.dev/gvisor requires 1.25.5
sed -E -i'' 's/^go 1\.25\..*/go 1.25.5/' go.mod || die
default
}
src_compile() {
if [[ ${PV} == 9999* ]]; then
local CUSTOM_VER="$(git rev-parse --short HEAD)"
else
local CUSTOM_VER="${PV}"
fi
CGO_ENABLED=0 ego build -ldflags="-X github.com/xtls/xray-core/core.build=${CUSTOM_VER}" \
-trimpath -o xray -v ./main
}
src_install() {
default
dobin xray
systemd_dounit "${FILESDIR}"/xray.service
systemd_newunit "${FILESDIR}"/xray_at.service "xray@.service"
keepdir /etc/xray
}