git: 3ad03358f695 - main - net/spoofdpi: New port: Simple and fast anti-censorship tool

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Mon, 05 Aug 2024 23:05:33 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3ad03358f6959b68ea10c2d395274dda595afec9

commit 3ad03358f6959b68ea10c2d395274dda595afec9
Author:     Yusuf Yaman <nxjoseph@protonmail.com>
AuthorDate: 2024-08-05 23:01:57 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-08-05 23:01:57 +0000

    net/spoofdpi: New port: Simple and fast anti-censorship tool
    
    SpoofDPI is a simple and fast anti-censorship tool written in Go that
    bypasses Deep Packet Inspection (DPI) by splitting HTTPS requests
    into chunks and sending the first byte separately.
    
    It can be run as daemon via rc.d script spoofdpi.
    
    https://github.com/xvzc/SpoofDPI
    
    PR:     280591
---
 GIDs                           |  2 +-
 UIDs                           |  2 +-
 net/Makefile                   |  1 +
 net/spoofdpi/Makefile          | 47 ++++++++++++++++++++++++++++++++++++++++++
 net/spoofdpi/distinfo          | 45 ++++++++++++++++++++++++++++++++++++++++
 net/spoofdpi/files/spoofdpi.in | 43 ++++++++++++++++++++++++++++++++++++++
 net/spoofdpi/pkg-descr         |  3 +++
 7 files changed, 141 insertions(+), 2 deletions(-)

diff --git a/GIDs b/GIDs
index 58773b9d3349..bf70d7250078 100644
--- a/GIDs
+++ b/GIDs
@@ -320,7 +320,7 @@ _wsdd:*:370:
 # free: 377
 # free: 378
 # free: 379
-# free: 380
+spoofdpi:*:380:
 # free: 381
 # free: 382
 # free: 383
diff --git a/UIDs b/UIDs
index 59e8b3937108..a09c867cc62b 100644
--- a/UIDs
+++ b/UIDs
@@ -325,7 +325,7 @@ _wsdd:*:370:370::0:0:Web Service Discovery Daemon:/nonexistent:/usr/sbin/nologin
 # free: 377
 # free: 378
 # free: 379
-# free: 380
+poofdpi:*:380:380::0:0:SpoofDPI Daemon:/nonexistent:/usr/sbin/nologin
 # free: 381
 # free: 382
 # free: 383
diff --git a/net/Makefile b/net/Makefile
index 6493ea0fa369..f0897e911f07 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -1501,6 +1501,7 @@
     SUBDIR += speedtest
     SUBDIR += speedtest-go
     SUBDIR += spiritvnc
+    SUBDIR += spoofdpi
     SUBDIR += spoofer
     SUBDIR += spread
     SUBDIR += spread-j
diff --git a/net/spoofdpi/Makefile b/net/spoofdpi/Makefile
new file mode 100644
index 000000000000..0044c3bc1968
--- /dev/null
+++ b/net/spoofdpi/Makefile
@@ -0,0 +1,47 @@
+PORTNAME=	spoofdpi
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.10.4
+CATEGORIES=	net
+
+MAINTAINER=	nxjoseph@protonmail.com
+COMMENT=	Simple and fast anti-censorship tool
+WWW=		https://github.com/xvzc/SpoofDPI
+
+LICENSE=	APACHE20
+
+USES=		go:modules
+USE_GITHUB=	yes
+GH_ACCOUNT=	xvzc
+GH_PROJECT=	SpoofDPI
+GH_TUPLE=	atomicgo:cursor:v0.2.0:atomicgo_cursor/vendor/atomicgo.dev/cursor \
+		atomicgo:keyboard:v0.2.9:atomicgo_keyboard/vendor/atomicgo.dev/keyboard \
+		atomicgo:schedule:v0.1.0:atomicgo_schedule/vendor/atomicgo.dev/schedule \
+		containerd:console:v1.0.3:containerd_console/vendor/github.com/containerd/console \
+		golang:mod:v0.18.0:golang_mod/vendor/golang.org/x/mod \
+		golang:net:v0.27.0:golang_net/vendor/golang.org/x/net \
+		golang:sync:v0.7.0:golang_sync/vendor/golang.org/x/sync \
+		golang:sys:v0.22.0:golang_sys/vendor/golang.org/x/sys \
+		golang:term:v0.22.0:golang_term/vendor/golang.org/x/term \
+		golang:text:v0.16.0:golang_text/vendor/golang.org/x/text \
+		golang:tools:v0.22.0:golang_tools/vendor/golang.org/x/tools \
+		gookit:color:v1.5.4:gookit_color/vendor/github.com/gookit/color \
+		likexian:doh:v0.7.1:likexian_doh/vendor/github.com/likexian/doh \
+		likexian:gokit:v0.25.15:likexian_gokit/vendor/github.com/likexian/gokit \
+		lithammer:fuzzysearch:v1.1.8:lithammer_fuzzysearch/vendor/github.com/lithammer/fuzzysearch \
+		mattn:go-runewidth:v0.0.15:mattn_go_runewidth/vendor/github.com/mattn/go-runewidth \
+		miekg:dns:v1.1.61:miekg_dns/vendor/github.com/miekg/dns \
+		pterm:pterm:v0.12.79:pterm_pterm/vendor/github.com/pterm/pterm \
+		rivo:uniseg:v0.4.4:rivo_uniseg/vendor/github.com/rivo/uniseg \
+		sirupsen:logrus:v1.9.3:sirupsen_logrus/vendor/github.com/sirupsen/logrus \
+		xo:terminfo:abceb7e1c41e:xo_terminfo/vendor/github.com/xo/terminfo
+
+USE_RC_SUBR=	${PORTNAME}
+GO_TARGET=	./cmd/spoof-dpi:${PORTNAME}
+GO_BUILDFLAGS=	-ldflags="-s -w"
+SUB_LIST=	USER=${USERS}
+USERS=		${PORTNAME}
+GROUPS=		${PORTNAME}
+
+PLIST_FILES=	bin/${PORTNAME}
+
+.include <bsd.port.mk>
diff --git a/net/spoofdpi/distinfo b/net/spoofdpi/distinfo
new file mode 100644
index 000000000000..9d6d73175271
--- /dev/null
+++ b/net/spoofdpi/distinfo
@@ -0,0 +1,45 @@
+TIMESTAMP = 1722696172
+SHA256 (xvzc-SpoofDPI-v0.10.4_GH0.tar.gz) = 0f312d2ecf0761be6cd65d475a509f2ac2246a90d3dcf1668444c168be2f3ba1
+SIZE (xvzc-SpoofDPI-v0.10.4_GH0.tar.gz) = 22739
+SHA256 (atomicgo-cursor-v0.2.0_GH0.tar.gz) = 61760aaf6b2a0b51adcea56913104aa070b844426063a21dac60551f239e5044
+SIZE (atomicgo-cursor-v0.2.0_GH0.tar.gz) = 11330
+SHA256 (atomicgo-keyboard-v0.2.9_GH0.tar.gz) = 6855b6e6e6837de6e9cfb98e0f49f6224eb599c688bdd4ce3a0c96b2f409bd07
+SIZE (atomicgo-keyboard-v0.2.9_GH0.tar.gz) = 13554
+SHA256 (atomicgo-schedule-v0.1.0_GH0.tar.gz) = 32b125a2d10d854d96eefd47e14e55d8fca725ac002b0287b32c34cf023d4896
+SIZE (atomicgo-schedule-v0.1.0_GH0.tar.gz) = 6045
+SHA256 (containerd-console-v1.0.3_GH0.tar.gz) = 61bc166fd91d4639870a2395ce7a89cb4585d343c521fcd397bef66324772f91
+SIZE (containerd-console-v1.0.3_GH0.tar.gz) = 13712
+SHA256 (golang-mod-v0.18.0_GH0.tar.gz) = 247133e4ef1a5863af267a81c2d3f2b6e6b439f250db4e1d7e16df46d37e4d71
+SIZE (golang-mod-v0.18.0_GH0.tar.gz) = 123147
+SHA256 (golang-net-v0.27.0_GH0.tar.gz) = 7366b073182cd029815e724a6584cdf01864f46f108e1b1f6beb04597ebacaea
+SIZE (golang-net-v0.27.0_GH0.tar.gz) = 1454586
+SHA256 (golang-sync-v0.7.0_GH0.tar.gz) = 39bf56d2dc04d16baabbf5eb5d847a2ad68762b5efde7ca3a8fdb24bdcdd9461
+SIZE (golang-sync-v0.7.0_GH0.tar.gz) = 18181
+SHA256 (golang-sys-v0.22.0_GH0.tar.gz) = b5a84a20ff327803ed47aefd837a3264d511b3f644017cb8e050ff1f5bd22471
+SIZE (golang-sys-v0.22.0_GH0.tar.gz) = 1498230
+SHA256 (golang-term-v0.22.0_GH0.tar.gz) = 12263f0da55447aa51fb5d5bef6ca12e37bf2058db6c625e498d06e462fca79e
+SIZE (golang-term-v0.22.0_GH0.tar.gz) = 14742
+SHA256 (golang-text-v0.16.0_GH0.tar.gz) = 6df270cb3d696f882857c8ce02233e7f08d5ff900986e1ac669b47e088b18779
+SIZE (golang-text-v0.16.0_GH0.tar.gz) = 8972326
+SHA256 (golang-tools-v0.22.0_GH0.tar.gz) = ae80020fa6994e1e112478eb4fc3aefcf9b21500c6e2ef5c5b3bdbb3f8943f13
+SIZE (golang-tools-v0.22.0_GH0.tar.gz) = 3853706
+SHA256 (gookit-color-v1.5.4_GH0.tar.gz) = cf2b13be6a78bd60f89713afab4b7bfb284199603f5a2b1c39fd684a3d0be690
+SIZE (gookit-color-v1.5.4_GH0.tar.gz) = 2155201
+SHA256 (likexian-doh-v0.7.1_GH0.tar.gz) = 0986d356d33ecf691c380f66dd755146976856105d6fb7ba92fd180a088ff425
+SIZE (likexian-doh-v0.7.1_GH0.tar.gz) = 11623
+SHA256 (likexian-gokit-v0.25.15_GH0.tar.gz) = 59fd9cf285e174b51e470f8617f68fb1c53c4e0ac1a951b0568c6b5dff1c07c5
+SIZE (likexian-gokit-v0.25.15_GH0.tar.gz) = 113527
+SHA256 (lithammer-fuzzysearch-v1.1.8_GH0.tar.gz) = 2496ccfc16d85426eb70aaf94f773f8ca08caf96694de3ede3c29d5978e28e50
+SIZE (lithammer-fuzzysearch-v1.1.8_GH0.tar.gz) = 9373
+SHA256 (mattn-go-runewidth-v0.0.15_GH0.tar.gz) = 44a5d37bd7119a9d288d7ff61cf3b4d42c2902c66b0d94136d41d2eb3cf2ba85
+SIZE (mattn-go-runewidth-v0.0.15_GH0.tar.gz) = 18284
+SHA256 (miekg-dns-v1.1.61_GH0.tar.gz) = 90333c02da30c7ec20688e854e34f71d450831e5c4eba007d828864bb4ff4d47
+SIZE (miekg-dns-v1.1.61_GH0.tar.gz) = 217914
+SHA256 (pterm-pterm-v0.12.79_GH0.tar.gz) = 230bef0c6e733ae600392d8c085b51331eeb29d789517cb75a28c9ed3c8c578d
+SIZE (pterm-pterm-v0.12.79_GH0.tar.gz) = 297646
+SHA256 (rivo-uniseg-v0.4.4_GH0.tar.gz) = eb2837932d0a666e13ea6b4cebf698096266d4f14740faa78c63b8291cf1fb5c
+SIZE (rivo-uniseg-v0.4.4_GH0.tar.gz) = 453399
+SHA256 (sirupsen-logrus-v1.9.3_GH0.tar.gz) = cfa48a647a28c1f12fb6a9b672bc4d88b6407ff05aedcf23ce939d342646acce
+SIZE (sirupsen-logrus-v1.9.3_GH0.tar.gz) = 50320
+SHA256 (xo-terminfo-abceb7e1c41e_GH0.tar.gz) = f309fc85594b3a03d622ebe275a841b97101c4189f85fff18fc051a2e5a4878c
+SIZE (xo-terminfo-abceb7e1c41e_GH0.tar.gz) = 35180
diff --git a/net/spoofdpi/files/spoofdpi.in b/net/spoofdpi/files/spoofdpi.in
new file mode 100644
index 000000000000..3670eac051be
--- /dev/null
+++ b/net/spoofdpi/files/spoofdpi.in
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# PROVIDE: spoofdpi
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf or /etc/rc.conf.local to
+# enable spoofdpi:
+# spoofdpi_args (str):	Custom additional arguments to be passed
+#			spoofdpi (default empty).
+# spoofdpi_user (str):	User to run spoofdpi as. Default
+#			to "%%USER%%" created by the port.
+# spoofdpi_log (path):	Console log file (default /dev/null).
+
+. /etc/rc.subr
+
+case $0 in
+/etc/rc*)
+	# during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown),
+	# so get the name of the script from $_file
+	name=$_file
+	;;
+*)
+	name=$0
+	;;
+esac
+
+name=${name##*/}
+rcvar="${name}_enable"
+
+load_rc_config "${name}"
+
+eval "${rcvar}=\${${rcvar}:-'NO'}"
+eval "_args=\${${name}_args:-''}"
+eval "_user=\${${name}_user:-'%%USER%%'}"
+eval "_log=\${${name}_log:-/dev/null}"
+
+pidfile="/var/run/${name}.pid"
+
+command="/usr/sbin/daemon"
+command_args="-P ${pidfile} -u ${_user} -f -H -o ${_log} -m 3 %%PREFIX%%/bin/spoofdpi -no-banner ${_args}"
+
+run_rc_command "$1"
diff --git a/net/spoofdpi/pkg-descr b/net/spoofdpi/pkg-descr
new file mode 100644
index 000000000000..8666f8c9b68a
--- /dev/null
+++ b/net/spoofdpi/pkg-descr
@@ -0,0 +1,3 @@
+SpoofDPI is a simple and fast anti-censorship tool written in Go that
+bypasses Deep Packet Inspection (DPI) by splitting HTTPS requests into
+chunks and sending the first byte separately.