aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtemis Everfree <artemis@artemis.sh>2023-01-31 16:04:08 -0800
committerArtemis Everfree <artemis@artemis.sh>2023-01-31 16:10:16 -0800
commit024e170cd96c3e0e537109affbb591e8e11ab17b (patch)
tree2225b4402507d3f457c38ccd7469feffe60f47e9 /net-vpn
parentnet-libs/libuecc: new package, add 7 (diff)
downloadguru-024e170cd96c3e0e537109affbb591e8e11ab17b.tar.gz
guru-024e170cd96c3e0e537109affbb591e8e11ab17b.tar.bz2
guru-024e170cd96c3e0e537109affbb591e8e11ab17b.zip
net-vpn/fastd: new package, add 22
Signed-off-by: Artemis Everfree <artemis@artemis.sh>
Diffstat (limited to 'net-vpn')
-rw-r--r--net-vpn/fastd/Manifest1
-rw-r--r--net-vpn/fastd/fastd-22.ebuild73
-rw-r--r--net-vpn/fastd/files/fastd.init55
-rw-r--r--net-vpn/fastd/metadata.xml16
4 files changed, 145 insertions, 0 deletions
diff --git a/net-vpn/fastd/Manifest b/net-vpn/fastd/Manifest
new file mode 100644
index 000000000..78d7a7b42
--- /dev/null
+++ b/net-vpn/fastd/Manifest
@@ -0,0 +1 @@
+DIST fastd-22.tar.xz 161288 BLAKE2B 25c741a0fe1ff4d8f02ee932301cc0bf58ff65cb95d4f53a49b2ef691d8531a917c1fea5b93f796dc0151ebeea3edd2b0c97e1ea5649ef2dfa4043b489c945eb SHA512 66196fa13c93b87b78b9e31bc267cf616dcfb4a964387c4a3f0f3176fa1529be335a6fac91379038d6a8b1a1be4fea547659551a8a9fa8d6939589d5f8a9a7aa
diff --git a/net-vpn/fastd/fastd-22.ebuild b/net-vpn/fastd/fastd-22.ebuild
new file mode 100644
index 000000000..789e8b99d
--- /dev/null
+++ b/net-vpn/fastd/fastd-22.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2023 Gentoo Authors
+#
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit linux-info meson systemd
+
+DESCRIPTION="A very small VPN daemon which tunnels IP packets and Ethernet frames over UDP."
+HOMEPAGE="https://fastd.readthedocs.io/"
+SRC_URI="https://github.com/NeoRaider/fastd/releases/download/v${PV}/${P}.tar.xz"
+
+# while source COPYRIGHT also mentions LGPLv2.1+, that only applies to
+# vendored libmnl. we are using system libmnl.
+LICENSE="BSD BSD-2"
+
+SLOT="0"
+KEYWORDS="~amd64 ~arm64"
+IUSE="+caps doc offload-l2tp systemd test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+>=net-libs/libuecc-6
+dev-libs/json-c
+dev-libs/libsodium
+dev-libs/openssl
+offload-l2tp? ( net-libs/libmnl )
+caps? ( sys-libs/libcap )
+test? ( dev-util/cmocka )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+sys-devel/bison
+doc? ( dev-python/sphinx )
+"
+IDEPEND=""
+
+pkg_setup() {
+ if use offload-l2tp; then
+ CONFIG_CHECK="~L2TP ~L2TP_V3 ~L2TP_ETH"
+ declare -g ERROR_L2TP="CONFIG_L2TP isn't set. Offloading L2TP to kernel will not work."
+ declare -g ERROR_L2TP_V3="CONFIG_L2TP_V3 isn't set. Offloading L2TP to kernel will not work."
+ declare -g ERROR_L2TP_ETH="CONFIG_L2TP_ETH isn't set. Offloading L2TP to kernel will not work."
+ linux-info_pkg_setup
+ fi
+}
+
+src_configure() {
+ local emesonargs=(
+ $(meson_feature caps capabilities)
+ $(meson_feature offload-l2tp offload_l2tp)
+ $(meson_feature systemd)
+ $(meson_use test build_tests)
+ -Dlibmnl_builtin=false
+ )
+ meson_src_configure
+}
+
+src_compile() {
+ meson_src_compile
+ if use doc; then
+ einfo "Building documentation ..."
+ local doc_dir="${S}/doc"
+ cd "${doc_dir}" || die "Cannot chdir into \"${doc_dir}\"!"
+ emake man || die "Building documentation failed!"
+ fi
+}
+
+src_install() {
+ meson_src_install
+ systemd_dounit "doc/examples/fastd@.service"
+ newinitd "${FILESDIR}/fastd.init" fastd
+ use doc && doman doc/build/man/*
+}
diff --git a/net-vpn/fastd/files/fastd.init b/net-vpn/fastd/files/fastd.init
new file mode 100644
index 000000000..9f93c7a81
--- /dev/null
+++ b/net-vpn/fastd/files/fastd.init
@@ -0,0 +1,55 @@
+#!/sbin/openrc-run
+# Copyright 2023 Gentoo Authors
+#
+# Distributed under the terms of the GNU General Public License v2
+
+name="fastd"
+description="fastd (Fast and Secure Tunnelling Daemon)"
+
+# usage would be i.e. fastd.my_vpn
+IFACE="${RC_SVCNAME#*.}"
+
+command="/usr/bin/fastd"
+command_args="--syslog-level info --syslog-ident fastd.${IFACE} --config /etc/fastd/${IFACE}/fastd.conf"
+pidfile="/run/${RC_SVCNAME}.pid"
+command_args_background="--daemon --pid-file ${pidfile}"
+
+depend() {
+ need net
+ use dns
+}
+
+extra_commands="checkconfig"
+checkconfig() {
+ if [ "${IFACE}" = "${RC_SVCNAME}" ]; then
+ eerror "You cannot call this init script directly. You must create a symbolic link to it with the configuration name:"
+ eerror " mkdir -p /etc/fastd/my_vpn"
+ eerror " nano /etc/fastd/my_vpn/fastd.conf"
+ eerror " ln -s /etc/init.d/fastd /etc/init.d/fastd.my_vpn"
+ eerror "And then call it instead:"
+ eerror " /etc/init.d/fastd.my_vpn start"
+ return 1
+ fi
+ fastd --config "/etc/fastd/${IFACE}/fastd.conf" --verify-config
+}
+
+start_pre() {
+ # If this isn't a restart, make sure that the user's config isn't
+ # busted before we try to start the daemon (this will produce
+ # better error messages than if we just try to start it blindly).
+ #
+ # If, on the other hand, this *is* a restart, then the stop_pre
+ # action will have ensured that the config is usable and we don't
+ # need to do that again.
+ if [ "${RC_CMD}" != "restart" ] ; then
+ checkconfig || return $?
+ fi
+}
+
+stop_pre() {
+ # If this is a restart, check to make sure the user's config
+ # isn't busted before we stop the running daemon.
+ if [ "${RC_CMD}" = "restart" ] ; then
+ checkconfig || return $?
+ fi
+}
diff --git a/net-vpn/fastd/metadata.xml b/net-vpn/fastd/metadata.xml
new file mode 100644
index 000000000..e549fbf6f
--- /dev/null
+++ b/net-vpn/fastd/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>artemis@artemis.sh</email>
+ <description>Primary maintainer</description>
+ <name>Artemis Everfree</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">NeoRaider/fastd</remote-id>
+ </upstream>
+ <use>
+ <flag name="offload-l2tp">Offload L2TP traffic to the kernel when using the null@l2tp transport method</flag>
+ <flag name="doc">Build and install manpages</flag>
+ </use>
+</pkgmetadata>