Compare commits

...

5 Commits

Author SHA1 Message Date
NewUse
b82dbcd0e6
Update Makefile
Add some description of package
2024-09-26 01:02:36 +03:00
NewUse
b29eea19e7
Update zapret.conf
Add additional options
2024-09-26 00:12:58 +03:00
NewUse
b5eaf13e27
Update zapret.init 2024-09-26 00:11:35 +03:00
NewUse
b4f0af275a
Update zapret.init
update autorestart trigger to correct syntax
2024-09-26 00:09:36 +03:00
NewUse
d988e8cee9
Update build_howto_openwrt.txt
Change build method to custom feed
2024-09-26 00:06:00 +03:00
4 changed files with 76 additions and 41 deletions

View File

@ -14,18 +14,26 @@ How to compile native programs for use in openwrt
cd openwrt
2) ./scripts/feeds update -a
./scripts/feeds install -a
3) #add zapret packages to build root
#copy package descriptions
copy compile/openwrt/* to ~/openwrt
2) #go to openwrt directory
cd ~/openwrt
#Create custom feed:
mkdir custom-feed
cp feeds.conf.default feeds.conf
echo "src-link custom ~/openwrt/custom-feed/" >> ~/openwrt/feeds.conf
3) #add zapret packages to custom feed
#create zapret directory structure
mkdir -p ~/openwrt/custom-feed/zapret
#copy source code of tpws
copy tpws to ~/openwrt/package/zapret/tpws
copy tpws to ~/openwrt/custom-feed/zapret/tpws
#copy source code of nfq
copy nfq to ~/openwrt/package/zapret/nfq
copy nfq to ~/openwrt/custom-feed/zapret/nfq
#copy source code of ip2net
copy ip2net to ~/openwrt/package/zapret/ip2net
copy ip2net to ~/openwrt/custom-feed/zapret/ip2net
4) ./scripts/feeds update -a
./scripts/feeds install -a
4) make menuconfig
#select your target architecture

View File

@ -1,19 +1,27 @@
#
# Copyright Zapret
# This is free software, licensed under the GNU General Public License v2.
include $(TOPDIR)/rules.mk
PKG_NAME:=tpws
PKG_RELEASE:=1.1
PKG_VERSION:=1.4
PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0-or-later
PKG_MAINTAINER:=Zapret
include $(INCLUDE_DIR)/package.mk
define Package/tpws
SECTION:=net
CATEGORY:=Network
TITLE:=tpws
TITLE:=TPWS DPI bypass proxy server
SUBMENU:=Zapret
DEPENDS:=+zlib +libcap +zlib +libcap +iptables
DEPENDS:=+zlib +libcap +libcap +iptables
endef
define Package/tpws/description
DPI bypass proxy
endef
define Build/Prepare
@ -41,4 +49,3 @@ define Package/tpws/install
endef
$(eval $(call BuildPackage,tpws))

View File

@ -2,3 +2,5 @@ config zapret tpws
option opts "--split-pos=2"
option pidfile "tpws.pid"
option port "8088"
option forward_ports "80 443"
option block_quic no

View File

@ -7,32 +7,34 @@ START=21
CONFIGURATION=zapret
PIDDIR=/var/run
load_fw_rules()
{
json_add_object ""
json_add_string type redirect
json_add_string name "Transparent Proxy Redirect HTTP"
json_add_string src lan
json_add_string proto tcp
json_add_string dest_port "$1"
json_add_string src_dip "!$2"
json_add_string dest_ip "$2"
json_add_string src_dport "80"
json_add_string dest lan
json_close_object
for fp in $3
do
json_add_object ""
json_add_string type redirect
json_add_string name "Transparent Proxy Redirect port $fp"
json_add_string src lan
json_add_string proto tcp
json_add_string dest_port "$1"
json_add_string src_dip "!$2"
json_add_string dest_ip "$2"
json_add_string src_dport "$fp"
json_add_string dest lan
json_close_object
done
json_add_object ""
json_add_string type redirect
json_add_string name "Transparent Proxy Redirect HTTPS"
json_add_string src lan
json_add_string proto tcp
json_add_string dest_port "$1"
json_add_string src_dip "!$2"
json_add_string dest_ip "$2"
json_add_string src_dport "443"
json_add_string dest lan
json_close_object
if [ "$4" = "1" ]; then
json_add_object ""
json_add_string type rule
json_add_string name "deny quic traffic"
json_add_string src lan
json_add_string proto udp
json_add_string dest_port "443"
json_add_string dest wan
json_add_string target "REJECT"
json_close_object
fi
}
start_service()
@ -44,11 +46,16 @@ start_service()
local pid
local lanaddr
local lport
local fports
local blockq
config_get opts tpws opts
config_get pid tpws pid
config_get lport tpws port
config_load "network"
config_get pid tpws pid "tpws.pid"
config_get lport tpws port "8088"
config_get fports tpws forward_ports "80 443"
config_get_bool blockq tpws block_quic 0
config_load "network"
config_get lanaddr lan ipaddr
procd_open_instance
@ -61,14 +68,13 @@ start_service()
procd_append_param command "--bind-wait-ip=10"
procd_append_param command "$opts"
procd_set_param file /etc/config/zapret
procd_set_param pidfile "$PIDDIR/$pid"
procd_set_param netdev "br-lan"
procd_open_data
json_add_array firewall
load_fw_rules "$lport" "$lanaddr"
load_fw_rules "$lport" "$lanaddr" "$fports" "$blockq"
json_close_array
procd_close_data
@ -84,6 +90,18 @@ stop_service()
echo "STOP Zapret service"
}
service_triggers()
{
procd_add_reload_trigger "zapret"
}
reload_service()
{
echo "Restarting service"
stop
start
}
service_started()
{
procd_set_config_changed firewall