From b9a2dd707e68db5ab34c87707c61df83ed6b3634 Mon Sep 17 00:00:00 2001 From: Puqns67 Date: Thu, 14 Sep 2023 15:38:24 +0800 Subject: [PATCH] net-vpn/frp: new package --- net-vpn/frp/Manifest | 2 + net-vpn/frp/files/frpc.service | 15 +++++++ net-vpn/frp/files/frpc_at.service | 15 +++++++ net-vpn/frp/files/frps.service | 14 +++++++ net-vpn/frp/files/frps_at.service | 14 +++++++ net-vpn/frp/frp-0.51.3.ebuild | 65 +++++++++++++++++++++++++++++++ net-vpn/frp/metadata.xml | 15 +++++++ 7 files changed, 140 insertions(+) create mode 100644 net-vpn/frp/Manifest create mode 100644 net-vpn/frp/files/frpc.service create mode 100644 net-vpn/frp/files/frpc_at.service create mode 100644 net-vpn/frp/files/frps.service create mode 100644 net-vpn/frp/files/frps_at.service create mode 100644 net-vpn/frp/frp-0.51.3.ebuild create mode 100644 net-vpn/frp/metadata.xml diff --git a/net-vpn/frp/Manifest b/net-vpn/frp/Manifest new file mode 100644 index 0000000..5a95bee --- /dev/null +++ b/net-vpn/frp/Manifest @@ -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 diff --git a/net-vpn/frp/files/frpc.service b/net-vpn/frp/files/frpc.service new file mode 100644 index 0000000..42fb47c --- /dev/null +++ b/net-vpn/frp/files/frpc.service @@ -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 diff --git a/net-vpn/frp/files/frpc_at.service b/net-vpn/frp/files/frpc_at.service new file mode 100644 index 0000000..fa98ec4 --- /dev/null +++ b/net-vpn/frp/files/frpc_at.service @@ -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 diff --git a/net-vpn/frp/files/frps.service b/net-vpn/frp/files/frps.service new file mode 100644 index 0000000..99c5e7b --- /dev/null +++ b/net-vpn/frp/files/frps.service @@ -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 diff --git a/net-vpn/frp/files/frps_at.service b/net-vpn/frp/files/frps_at.service new file mode 100644 index 0000000..72de81c --- /dev/null +++ b/net-vpn/frp/files/frps_at.service @@ -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 diff --git a/net-vpn/frp/frp-0.51.3.ebuild b/net-vpn/frp/frp-0.51.3.ebuild new file mode 100644 index 0000000..b1545d2 --- /dev/null +++ b/net-vpn/frp/frp-0.51.3.ebuild @@ -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 +} diff --git a/net-vpn/frp/metadata.xml b/net-vpn/frp/metadata.xml new file mode 100644 index 0000000..51d524a --- /dev/null +++ b/net-vpn/frp/metadata.xml @@ -0,0 +1,15 @@ + + + + + me@puqns67.icu + Puqns67 + + + Build and install frp client (frpc) + Build and install frp server (frps) + + + fatedier/frp + +