mirror of
https://github.com/gentoo-mirror/gentoo-zh.git
synced 2025-04-10 20:08:43 -04:00
net-proxy/hysteria: new package
This commit is contained in:
parent
f0aad1844f
commit
58c41b6214
7
.github/workflows/overlay.toml
vendored
7
.github/workflows/overlay.toml
vendored
@ -957,6 +957,13 @@ use_latest_release = true
|
||||
prefix = "v"
|
||||
github_account = "st0nie"
|
||||
|
||||
["net-proxy/hysteria"]
|
||||
source = "github"
|
||||
github = "apernet/hysteria"
|
||||
use_latest_release = true
|
||||
prefix = "app/v"
|
||||
github_account = "oatiz"
|
||||
|
||||
["net-proxy/make-proxy"]
|
||||
source = "github"
|
||||
github = "yueyoum/make-proxy"
|
||||
|
8
acct-group/hysteria/hysteria-0.ebuild
Normal file
8
acct-group/hysteria/hysteria-0.ebuild
Normal file
@ -0,0 +1,8 @@
|
||||
# Copyright 2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit acct-group
|
||||
|
||||
ACCT_GROUP_ID=-1
|
8
acct-group/hysteria/metadata.xml
Normal file
8
acct-group/hysteria/metadata.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<name>lyraile</name>
|
||||
<email>iamoatiz@gmail.com</email>
|
||||
</maintainer>
|
||||
</pkgmetadata>
|
13
acct-user/hysteria/hysteria-0.ebuild
Normal file
13
acct-user/hysteria/hysteria-0.ebuild
Normal file
@ -0,0 +1,13 @@
|
||||
# Copyright 2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit acct-user
|
||||
|
||||
ACCT_USER_ID=-1
|
||||
ACCT_USER_GROUPS=( hysteria )
|
||||
ACCT_USER_HOME="/etc/hysteria"
|
||||
ACCT_USER_HOME_OWNER="hysteria:hysteria"
|
||||
|
||||
acct-user_add_deps
|
8
acct-user/hysteria/metadata.xml
Normal file
8
acct-user/hysteria/metadata.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<name>lyraile</name>
|
||||
<email>iamoatiz@gmail.com</email>
|
||||
</maintainer>
|
||||
</pkgmetadata>
|
2
net-proxy/hysteria/Manifest
Normal file
2
net-proxy/hysteria/Manifest
Normal file
@ -0,0 +1,2 @@
|
||||
DIST hysteria-2.1.0-deps.tar.xz 42357544 BLAKE2B 15d146c29666c736c14ca82ca8b30a62155afad9adbf1c8eeb69e0043b4d333af081c7ec3b756163b4d520a2b01e2d761f998db6da2f3de44c10bd3d43f69922 SHA512 b40cb4b5bf35a3d1a4de3d4f057ae4dcbc42bbb33b20584a483ff2144e54e7ce5dbb09a964063c06d8040cc8d213bc895bb4710dbae03b67b1f3818a0d0cd52f
|
||||
DIST hysteria-2.1.0.tar.gz 3776335 BLAKE2B 4ec3aa0f162fb4653b256f6dc1886072cc88888ce09ddecbfa002833fd0555a52e31c122013fa1d3081f876306eab5e244902ba9019d9d31ff97f8ff0b32330d SHA512 9435ef173adb90ec1d31fa956fac48a81bafb9d8151e73a6bb13b4224fecd63941480542ea523e3334b5a19cd71016f0d79db245466d54b5b8ab493a42f3c651
|
23
net-proxy/hysteria/files/hysteria-client.initd
Normal file
23
net-proxy/hysteria/files/hysteria-client.initd
Normal file
@ -0,0 +1,23 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
pidfile="/run/hysteria/hysteria-client.pid"
|
||||
command="/usr/bin/hysteria"
|
||||
command_args="client --config /etc/hysteria/client.yaml --disable-update-check"
|
||||
command_background="yes"
|
||||
command_user="hysteria:hysteria"
|
||||
|
||||
capabilities="^cap_net_bind_service,^cap_net_admin,^cap_net_raw"
|
||||
output_log="/var/log/hysteria-client.log"
|
||||
error_log="/var/log/hysteria-client.log"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
after local
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath -d -m 0755 -o "$command_user" /run/hysteria
|
||||
checkpath -f -m 0644 -o "$command_user" "$output_log"
|
||||
}
|
18
net-proxy/hysteria/files/hysteria-client.service
Normal file
18
net-proxy/hysteria/files/hysteria-client.service
Normal file
@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=Hysteria Client Service
|
||||
Documentation=https://hysteria.network/
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/hysteria client --config /etc/hysteria/client.yaml --disable-update-check
|
||||
WorkingDirectory=~
|
||||
User=hysteria
|
||||
Group=hysteria
|
||||
Environment=HYSTERIA_LOG_LEVEL=info
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
|
||||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
|
||||
NoNewPrivileges=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
23
net-proxy/hysteria/files/hysteria-server.initd
Normal file
23
net-proxy/hysteria/files/hysteria-server.initd
Normal file
@ -0,0 +1,23 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
pidfile="/run/hysteria/hysteria-server.pid"
|
||||
command="/usr/bin/hysteria"
|
||||
command_args="server --config /etc/hysteria/server.yaml --disable-update-check"
|
||||
command_background="yes"
|
||||
command_user="hysteria:hysteria"
|
||||
|
||||
capabilities="^cap_net_bind_service,^cap_net_admin,^cap_net_raw"
|
||||
output_log="/var/log/hysteria-server.log"
|
||||
error_log="/var/log/hysteria-server.log"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
after local
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath -d -m 0755 -o "$command_user" /run/hysteria
|
||||
checkpath -f -m 0644 -o "$command_user" "$output_log"
|
||||
}
|
19
net-proxy/hysteria/files/hysteria-server.service
Normal file
19
net-proxy/hysteria/files/hysteria-server.service
Normal file
@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=Hysteria Server Service
|
||||
Documentation=https://hysteria.network/
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/hysteria server --config /etc/hysteria/server.yaml --disable-update-check
|
||||
WorkingDirectory=~
|
||||
User=hysteria
|
||||
Group=hysteria
|
||||
Environment=HYSTERIA_LOG_LEVEL=info
|
||||
Environment=HYSTERIA_ACME_DIR=/var/lib/hysteria/acme
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
|
||||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
|
||||
NoNewPrivileges=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
96
net-proxy/hysteria/hysteria-2.1.0.ebuild
Normal file
96
net-proxy/hysteria/hysteria-2.1.0.ebuild
Normal file
@ -0,0 +1,96 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
inherit go-module systemd
|
||||
|
||||
DESCRIPTION="A powerful, lightning fast and censorship resistant proxy."
|
||||
HOMEPAGE="https://github.com/apernet/hysteria"
|
||||
|
||||
SRC_URI="
|
||||
https://github.com/apernet/${PN}/archive/refs/tags/app/v${PV}.tar.gz -> ${P}.tar.gz
|
||||
https://github.com/oatiz/gentoo-go-deps/releases/download/${P}/${P}-deps.tar.xz
|
||||
"
|
||||
|
||||
RESTRICT="mirror"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64"
|
||||
|
||||
GO_CPU_FLAGS_X86="
|
||||
cpu_flags_x86_avx2
|
||||
cpu_flags_x86_fma4
|
||||
cpu_flags_x86_fma3
|
||||
cpu_flags_x86_f16c
|
||||
cpu_flags_x86_avx
|
||||
cpu_flags_x86_sse4_2
|
||||
cpu_flags_x86_sse4_1
|
||||
cpu_flags_x86_ssse3
|
||||
cpu_flags_x86_sse3
|
||||
"
|
||||
|
||||
IUSE="+goamd64 ${GO_CPU_FLAGS_X86[@]}"
|
||||
|
||||
DEPEND="
|
||||
acct-user/hysteria
|
||||
acct-group/hysteria
|
||||
>=dev-lang/go-1.21.1
|
||||
"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
S="${WORKDIR}/${PN}-app-v${PV}"
|
||||
|
||||
ego() {
|
||||
set -- go "$@"
|
||||
echo "$@" >&2
|
||||
"$@" || die -n "${*} failed"
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
if use goamd64; then
|
||||
GOAMD64_V="v1"
|
||||
if use cpu_flags_x86_sse3 && use cpu_flags_x86_sse4_1 && use cpu_flags_x86_sse4_2 && use cpu_flags_x86_ssse3
|
||||
then
|
||||
GOAMD64_V="v2"
|
||||
if use cpu_flags_x86_avx && use cpu_flags_x86_avx2 && use cpu_flags_x86_f16c && \
|
||||
(use cpu_flags_x86_fma4 || use cpu_flags_x86_fma3)
|
||||
then
|
||||
GOAMD64_V="v3"
|
||||
fi
|
||||
fi
|
||||
export GOAMD64="${GOAMD64_V}"
|
||||
einfo "building with GOAMD64=${GOAMD64_V}"
|
||||
fi
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
local APP_SRC_CMD_PKG="github.com/apernet/hysteria/app/cmd"
|
||||
local APP_DATE
|
||||
APP_DATE=$(LC_ALL=C date -u +'%Y-%m-%dT%H:%M:%SZ' || die)
|
||||
local APP_ARCH="Unknown"
|
||||
if use goamd64; then
|
||||
APP_ARCH="amd64-${GOAMD64}"
|
||||
fi
|
||||
|
||||
CGO_ENABLED=1 ego build \
|
||||
-trimpath \
|
||||
-ldflags "-s -w -extldflags \"${LDFLAGS}\" \
|
||||
-X \"${APP_SRC_CMD_PKG}.appVersion=${PV}\" \
|
||||
-X \"${APP_SRC_CMD_PKG}.appDate=${APP_DATE}\" \
|
||||
-X \"${APP_SRC_CMD_PKG}.appType=release\" \
|
||||
-X \"${APP_SRC_CMD_PKG}.appPlatform=linux\" \
|
||||
-X \"${APP_SRC_CMD_PKG}.appArch=${APP_ARCH}\" \
|
||||
" \
|
||||
-o "${PN}" "./app"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
insinto "/etc/${PN}"
|
||||
dobin "${PN}"
|
||||
|
||||
systemd_dounit "${FILESDIR}/${PN}-server.service"
|
||||
systemd_dounit "${FILESDIR}/${PN}-client.service"
|
||||
newinitd "${FILESDIR}/${PN}-server.initd" "${PN}-server"
|
||||
newinitd "${FILESDIR}/${PN}-client.initd" "${PN}-client"
|
||||
}
|
15
net-proxy/hysteria/metadata.xml
Normal file
15
net-proxy/hysteria/metadata.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE
|
||||
pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<name>lyraile</name>
|
||||
<email>iamoatiz@gmail.com</email>
|
||||
</maintainer>
|
||||
<use>
|
||||
<flag name="goamd64">detect golang arch level on amd64 cpus by CPU_FLAGS_X86</flag>
|
||||
</use>
|
||||
<upstream>
|
||||
<remote-id type="github">apernet/hysteria</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
Loading…
x
Reference in New Issue
Block a user