1
0

net-proxy/v2ray: new package

This commit is contained in:
Puqns67 2023-05-28 17:25:29 +08:00
parent 1a14db4c8a
commit a54cb3e395
Signed by: Puqns67
GPG Key ID: 9669DF042554F536
4 changed files with 142 additions and 0 deletions

5
net-proxy/v2ray/Manifest Normal file
View File

@ -0,0 +1,5 @@
AUX v2ray.initd 829 BLAKE2B 50ca3f76aad7f9ecdc6df7f9a17464747d90e235ca91b93399393d705d5b61ce91405e2ab433d8f901a4c81e4ff13952d71bfe3debeeee451d6eac5fef80ae5b SHA512 d2a28766851063ffb418d6fadb0a9968d178765a38182d221c0f298366e513587da76a58e8fcc132ac2e6d39dfe6c53b810a72e6f6aff48199c7ed467ef92bd8
AUX v2ray.initd-r1 832 BLAKE2B 2aa5889f64e1d2f302df87746a8178d438ef0015649945937fe798f8ef9ea7e07316a68341633260a25984dc559d4c18cba0ff078b538bd78f88a624a0a73cfa SHA512 ffa322cbc3382e925a294bf092d9262dee29cf30debcec3ae66df351396104e05665856ec9336483ee51c02b5f69d0f3ee3dd33719421345bcd1f57d0c690c6d
DIST v2ray-5.5.0-deps.tar.xz 128767504 BLAKE2B 8f7d4c99a229280ebbbfb611f9b770257a4d51f2865931d952de257e5065ac21cb6cbd120a22a8b7bbc249de6f23baeb44e5f7b16206a8804a1c45fed1b21aba SHA512 e22577642090c4852885b5184ccb5a368086ead9d083282e7ee5ed32d8b741bfeba9a96eac9cfb8988f2099f98ccce31aed4d67590b70603853104c57304c0a7
DIST v2ray-5.5.0.tar.gz 971167 BLAKE2B db6ea1db079e2bbd626e7d65785ec3bf5d37a83affea3a07725c3aef8248370e38e000aba5e3a5ffc6db18c8887b9756315d970dfa4902c576e31bec5fd60763 SHA512 b09dc38f6a33409cd819f64ea76539a5930c6b50f9f37ed38a9e82def21a8d010459acab5581717856a0adf392696392a51fe0dba974fac8d7cd086834701b1a
EBUILD v2ray-5.5.0.ebuild 1315 BLAKE2B b78f0c7c3fd908676652522e1aa2c6005219d2b8b794f59af713eb86daddbbe1d2adf28cf5b8fe179e9f4921265ab02c611fc43e89147018dbd5758900ba0878 SHA512 bb4b48285ed3565afe5626923c3f1002cd755f50e145c77fb0050ab7137b7cf2ba9314ff6f06d6f54dfb2501eb3c0aa54209963b8746440011f03918f421a7e0

View File

@ -0,0 +1,44 @@
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
depend() {
need net
}
checkconfig() {
if [ "${RC_SVCNAME}" != "v2ray" ] ; then
V2_CFGNAME="${RC_SVCNAME#*.}."
fi
V2_CONFIG="/etc/v2ray/config.${V2_CFGNAME}json"
V2_PIDFILE="/run/v2ray.${V2_CFGNAME}pid"
V2_LOG="/var/log/v2ray.${V2_CFGNAME}log"
if [ ! -f ${V2_CONFIG} ]; then
ewarn "${V2_CONFIG} does not exist."
return 1
fi
return 0
}
start() {
checkconfig || return 1
ebegin "Starting V2ray"
ebegin "Log File : ${V2_LOG}"
start-stop-daemon --start \
-b -1 ${V2_LOG} -2 ${V2_LOG} \
-m -p ${V2_PIDFILE} \
--exec /usr/bin/v2ray -- -config ${V2_CONFIG}
eend $?
}
stop() {
checkconfig || return 1
ebegin "Stopping V2ray"
start-stop-daemon --stop -p ${V2_PIDFILE}
eend $?
}

View File

@ -0,0 +1,44 @@
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
depend() {
need net
}
checkconfig() {
if [ "${RC_SVCNAME}" != "v2ray" ] ; then
V2_CFGNAME="${RC_SVCNAME#*.}."
fi
V2_CONFIG="/etc/v2ray/config.${V2_CFGNAME}json"
V2_PIDFILE="/run/v2ray.${V2_CFGNAME}pid"
V2_LOG="/var/log/v2ray.${V2_CFGNAME}log"
if [ ! -f ${V2_CONFIG} ]; then
ewarn "${V2_CONFIG} does not exist."
return 1
fi
return 0
}
start() {
checkconfig || return 1
ebegin "Starting V2ray"
ebegin "Log File : ${V2_LOG}"
start-stop-daemon --start \
-b -1 ${V2_LOG} -2 ${V2_LOG} \
-m -p ${V2_PIDFILE} \
--exec /usr/bin/v2ray -- run -config ${V2_CONFIG}
eend $?
}
stop() {
checkconfig || return 1
ebegin "Stopping V2ray"
start-stop-daemon --stop -p ${V2_PIDFILE}
eend $?
}

View File

@ -0,0 +1,49 @@
# Copyright 2021-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit systemd go-module
DESCRIPTION="A platform for building proxies to bypass network restrictions."
HOMEPAGE="https://github.com/v2fly/v2ray-core"
SRC_URI="https://github.com/v2fly/v2ray-core/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/Puqns67/gentoo-deps/releases/download/${P}/${P}-deps.tar.xz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~x86 ~riscv64"
IUSE=""
BDEPEND="dev-lang/go"
DEPEND=""
RDEPEND="
!net-proxy/v2ray-bin
dev-libs/v2ray-geoip-bin
dev-libs/v2ray-domain-list-community-bin
"
S="${WORKDIR}/${PN}-core-${PV}"
src_prepare() {
sed -i 's|/usr/local/bin|/usr/bin|;s|/usr/local/etc|/etc|' release/config/systemd/system/*.service || die
sed -i '/^User=/s/nobody/v2ray/;/^User=/aDynamicUser=true' release/config/systemd/system/*.service || die
default
}
src_compile() {
ego build -v -work -o "bin/v2ray" -trimpath -ldflags "-s -w" ./main
}
src_install() {
dobin bin/v2ray
insinto /etc/v2ray
doins release/config/*.json
newinitd "${FILESDIR}/v2ray.initd-r1" v2ray
systemd_newunit release/config/systemd/system/v2ray.service v2ray.service
systemd_newunit release/config/systemd/system/v2ray@.service v2ray@.service
}