1
0

net-vpn/frp: new package

This commit is contained in:
Puqns67 2023-09-14 15:38:24 +08:00
parent 6232036c31
commit b9a2dd707e
Signed by: Puqns67
GPG Key ID: 9669DF042554F536
7 changed files with 140 additions and 0 deletions

2
net-vpn/frp/Manifest Normal file
View File

@ -0,0 +1,2 @@
DIST frp-0.51.3-vendor.tar.xz 7268632 BLAKE2B f95841eb57e4c80246e1805ce48b07fb11f90cfca93d25e384fb450a797beaa1e9b922797a5ac3647643aaa59e7c98bdf6155f31d0fc7d295a26cb92634c7021 SHA512 0255b780f01f195b304f1b668dc5c38dbdea847d6efc23dcbf98743a67f1010e4abd0fbdf742d4057f02dcdbe8741ca9b0afa7b55ca73cd838ef885e2561d230
DIST frp-0.51.3.tar.gz 1040163 BLAKE2B 0bcc5fdebf5b5884bf59cbf00d6b5d6747fe84ecfda28a5f773d6a6fe6f4078e91f54f588dba86696dc6460180f897536705e295ecdc9fb8b024851693a50f5b SHA512 fd0b619c248b7a99b9b477232fcf57b196981a079335c6aae35eba99639d803d14b044ce1eb3e12889971617b8d0c0fbb000891c70cb8134b0133eec9325434e

View File

@ -0,0 +1,15 @@
[Unit]
Description=Frp Client Service
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/usr/bin/frpc -c /etc/frp/frpc.ini
ExecReload=/usr/bin/frpc reload -c /etc/frp/frpc.ini
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,15 @@
[Unit]
Description=Frp Client Service
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/usr/bin/frpc -c /etc/frp/%i.ini
ExecReload=/usr/bin/frpc reload -c /etc/frp/%i.ini
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=Frp Server Service
After=network.target
Wants=network.target
[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/usr/bin/frps -c /etc/frp/frps.ini
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=Frp Server Service
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/usr/bin/frps -c /etc/frp/%i.ini
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,65 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit go-module systemd shell-completion
DESCRIPTION="A reverse proxy that exposes a server behind a NAT or firewall to the internet"
HOMEPAGE="https://github.com/fatedier/frp"
SRC_URI="https://github.com/fatedier/frp/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/Puqns67/gentoo-deps/releases/download/${P}/${P}-vendor.tar.xz"
LICENSE="Apache-2.0 BSD BSD-2 ISC MIT MPL-2.0"
SLOT="0"
KEYWORDS="~amd64 ~loong ~riscv"
IUSE="+client server"
REQUIRED_USE="|| ( client server )"
DEPEND="${RDEPEND}"
RDEPEND=""
BDEPEND="dev-lang/go"
src_compile() {
mkdir -pv completions || die
if use client; then
ego build -trimpath -ldflags "-w" -o frpc ./cmd/frpc
./frpc completion bash > completions/frpc || die
./frpc completion fish > completions/frpc.fish || die
./frpc completion zsh > completions/_frpc || die
fi
if use server; then
ego build -trimpath -ldflags "-w" -o frps ./cmd/frps
./frps completion bash > completions/frps || die
./frps completion fish > completions/frps.fish || die
./frps completion zsh > completions/_frps || die
fi
}
src_install() {
if use client; then
dobin frpc
dobashcomp completions/frpc
systemd_dounit "${FILESDIR}/frpc.service"
systemd_newunit "${FILESDIR}/frpc_at.service" frpc@.service
for x in conf/frpc*.ini; do mv "${x}"{,.example}; done
fi
if use server; then
dobin frps
dobashcomp completions/frps
systemd_dounit "${FILESDIR}/frps.service"
systemd_newunit "${FILESDIR}/frps_at.service" frps@.service
for x in conf/frps*.ini; do mv "${x}"{,.example}; done
fi
dofishcomp completions/*.fish
dozshcomp completions/_*
insinto /etc/frp
doins conf/*.example
}

15
net-vpn/frp/metadata.xml Normal file
View 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">
<email>me@puqns67.icu</email>
<name>Puqns67</name>
</maintainer>
<use>
<flag name="client">Build and install frp client (frpc)</flag>
<flag name="server">Build and install frp server (frps)</flag>
</use>
<upstream>
<remote-id type="github">fatedier/frp</remote-id>
</upstream>
</pkgmetadata>