hev-socks5-tunnel: add new package
authorRay Wang <[email protected]>
Wed, 14 Aug 2024 13:17:18 +0000 (21:17 +0800)
committerTianling Shen <[email protected]>
Tue, 3 Sep 2024 02:22:03 +0000 (10:22 +0800)
HevSocks5Tunnel is a high-performance tun2socks for Unix.

More details: https://github.com/heiher/hev-socks5-tunnel

Signed-off-by: Ray Wang <[email protected]>
net/hev-socks5-tunnel/Makefile [new file with mode: 0644]
net/hev-socks5-tunnel/files/hev-socks5-tunnel.config [new file with mode: 0644]
net/hev-socks5-tunnel/files/hev-socks5-tunnel.init [new file with mode: 0644]
net/hev-socks5-tunnel/test.sh [new file with mode: 0755]

diff --git a/net/hev-socks5-tunnel/Makefile b/net/hev-socks5-tunnel/Makefile
new file mode 100644 (file)
index 0000000..753d501
--- /dev/null
@@ -0,0 +1,53 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=hev-socks5-tunnel
+PKG_VERSION:=2.7.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://github.com/heiher/hev-socks5-tunnel/releases/download/$(PKG_VERSION)
+PKG_HASH:=613c4132cfed26ccd6e9f59a3e8590723f07969ac677f4957cbe000b13737fea
+
+PKG_MAINTAINER:=Ray Wang <[email protected]>
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=License
+
+PKG_BUILD_FLAGS:=no-mips16
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/hev-socks5-tunnel
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A high-performance tun2socks for Unix
+  URL:=https://github.com/heiher/hev-socks5-tunnel
+endef
+
+define Package/hev-socks5-tunnel/description
+hev-socks5-tunnel is a fast and lightweight tool that routes internet traffic
+through a SOCKS5 proxy, enhancing privacy and bypassing restrictions. It’s known
+for its efficiency, simplicity, and low resource usage, making it ideal for secure
+and optimized online connections.
+endef
+
+define Package/hev-socks5-tunnel/conffiles
+/etc/config/hev-socks5-tunnel
+/etc/hev-socks5-tunnel/
+endef
+
+define Package/hev-socks5-tunnel/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/hev-socks5-tunnel $(1)/usr/bin/
+
+       $(INSTALL_DIR) $(1)/etc/hev-socks5-tunnel/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/main.yml $(1)/etc/hev-socks5-tunnel/main.yml
+
+       $(INSTALL_DIR) $(1)/etc/config/
+       $(INSTALL_CONF) ./files/hev-socks5-tunnel.config $(1)/etc/config/hev-socks5-tunnel
+
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) ./files/hev-socks5-tunnel.init $(1)/etc/init.d/hev-socks5-tunnel
+endef
+
+$(eval $(call BuildPackage,hev-socks5-tunnel))
diff --git a/net/hev-socks5-tunnel/files/hev-socks5-tunnel.config b/net/hev-socks5-tunnel/files/hev-socks5-tunnel.config
new file mode 100644 (file)
index 0000000..fd6de1b
--- /dev/null
@@ -0,0 +1,3 @@
+config hev-socks5-tunnel 'config'
+       option enabled '0'
+       option conffile '/etc/hev-socks5-tunnel/main.yml'
diff --git a/net/hev-socks5-tunnel/files/hev-socks5-tunnel.init b/net/hev-socks5-tunnel/files/hev-socks5-tunnel.init
new file mode 100644 (file)
index 0000000..7cd524c
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh /etc/rc.common
+
+USE_PROCD=1
+START=99
+
+CONF="hev-socks5-tunnel"
+PROG="/usr/bin/hev-socks5-tunnel"
+
+start_service() {
+       config_load "$CONF"
+
+       local enabled
+       config_get_bool enabled "config" "enabled" "0"
+       [ "$enabled" -eq "1" ] || return 1
+
+       local conffile
+       config_get conffile "config" "conffile"
+
+       procd_open_instance "$CONF"
+       procd_set_param command "$PROG" "$conffile"
+       procd_set_param file "$conffile"
+
+       procd_set_param limits core="unlimited"
+       procd_set_param limits nofile="1000000 1000000"
+       procd_set_param stdout 1
+       procd_set_param stderr 1
+       procd_set_param respawn
+
+       procd_close_instance
+}
+
+service_triggers() {
+       procd_add_reload_trigger "$CONF"
+}
diff --git a/net/hev-socks5-tunnel/test.sh b/net/hev-socks5-tunnel/test.sh
new file mode 100755 (executable)
index 0000000..9ae615c
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+"$1" 2>&1 | grep "$2"