mirror of
https://github.com/bol-van/zapret.git
synced 2024-12-02 22:50:53 +03:00
Compare commits
5 Commits
e1ea962715
...
b82dbcd0e6
Author | SHA1 | Date | |
---|---|---|---|
|
b82dbcd0e6 | ||
|
b29eea19e7 | ||
|
b5eaf13e27 | ||
|
b4f0af275a | ||
|
d988e8cee9 |
@ -14,18 +14,26 @@ How to compile native programs for use in openwrt
|
|||||||
|
|
||||||
cd openwrt
|
cd openwrt
|
||||||
|
|
||||||
2) ./scripts/feeds update -a
|
|
||||||
./scripts/feeds install -a
|
|
||||||
|
|
||||||
3) #add zapret packages to build root
|
2) #go to openwrt directory
|
||||||
#copy package descriptions
|
cd ~/openwrt
|
||||||
copy compile/openwrt/* to ~/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 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 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 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
|
4) make menuconfig
|
||||||
#select your target architecture
|
#select your target architecture
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
#
|
# Copyright Zapret
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=tpws
|
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
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
define Package/tpws
|
define Package/tpws
|
||||||
SECTION:=net
|
SECTION:=net
|
||||||
CATEGORY:=Network
|
CATEGORY:=Network
|
||||||
TITLE:=tpws
|
TITLE:=TPWS DPI bypass proxy server
|
||||||
SUBMENU:=Zapret
|
SUBMENU:=Zapret
|
||||||
DEPENDS:=+zlib +libcap +zlib +libcap +iptables
|
DEPENDS:=+zlib +libcap +libcap +iptables
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/tpws/description
|
||||||
|
DPI bypass proxy
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Prepare
|
define Build/Prepare
|
||||||
@ -41,4 +49,3 @@ define Package/tpws/install
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,tpws))
|
$(eval $(call BuildPackage,tpws))
|
||||||
|
|
||||||
|
@ -2,3 +2,5 @@ config zapret tpws
|
|||||||
option opts "--split-pos=2"
|
option opts "--split-pos=2"
|
||||||
option pidfile "tpws.pid"
|
option pidfile "tpws.pid"
|
||||||
option port "8088"
|
option port "8088"
|
||||||
|
option forward_ports "80 443"
|
||||||
|
option block_quic no
|
||||||
|
@ -7,32 +7,34 @@ START=21
|
|||||||
CONFIGURATION=zapret
|
CONFIGURATION=zapret
|
||||||
PIDDIR=/var/run
|
PIDDIR=/var/run
|
||||||
|
|
||||||
|
|
||||||
load_fw_rules()
|
load_fw_rules()
|
||||||
{
|
{
|
||||||
json_add_object ""
|
for fp in $3
|
||||||
json_add_string type redirect
|
do
|
||||||
json_add_string name "Transparent Proxy Redirect HTTP"
|
json_add_object ""
|
||||||
json_add_string src lan
|
json_add_string type redirect
|
||||||
json_add_string proto tcp
|
json_add_string name "Transparent Proxy Redirect port $fp"
|
||||||
json_add_string dest_port "$1"
|
json_add_string src lan
|
||||||
json_add_string src_dip "!$2"
|
json_add_string proto tcp
|
||||||
json_add_string dest_ip "$2"
|
json_add_string dest_port "$1"
|
||||||
json_add_string src_dport "80"
|
json_add_string src_dip "!$2"
|
||||||
json_add_string dest lan
|
json_add_string dest_ip "$2"
|
||||||
json_close_object
|
json_add_string src_dport "$fp"
|
||||||
|
json_add_string dest lan
|
||||||
|
json_close_object
|
||||||
|
done
|
||||||
|
|
||||||
json_add_object ""
|
if [ "$4" = "1" ]; then
|
||||||
json_add_string type redirect
|
json_add_object ""
|
||||||
json_add_string name "Transparent Proxy Redirect HTTPS"
|
json_add_string type rule
|
||||||
json_add_string src lan
|
json_add_string name "deny quic traffic"
|
||||||
json_add_string proto tcp
|
json_add_string src lan
|
||||||
json_add_string dest_port "$1"
|
json_add_string proto udp
|
||||||
json_add_string src_dip "!$2"
|
json_add_string dest_port "443"
|
||||||
json_add_string dest_ip "$2"
|
json_add_string dest wan
|
||||||
json_add_string src_dport "443"
|
json_add_string target "REJECT"
|
||||||
json_add_string dest lan
|
json_close_object
|
||||||
json_close_object
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service()
|
start_service()
|
||||||
@ -44,11 +46,16 @@ start_service()
|
|||||||
local pid
|
local pid
|
||||||
local lanaddr
|
local lanaddr
|
||||||
local lport
|
local lport
|
||||||
|
local fports
|
||||||
|
local blockq
|
||||||
|
|
||||||
config_get opts tpws opts
|
config_get opts tpws opts
|
||||||
config_get pid tpws pid
|
config_get pid tpws pid "tpws.pid"
|
||||||
config_get lport tpws port
|
config_get lport tpws port "8088"
|
||||||
config_load "network"
|
config_get fports tpws forward_ports "80 443"
|
||||||
|
config_get_bool blockq tpws block_quic 0
|
||||||
|
|
||||||
|
config_load "network"
|
||||||
config_get lanaddr lan ipaddr
|
config_get lanaddr lan ipaddr
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
@ -61,14 +68,13 @@ start_service()
|
|||||||
procd_append_param command "--bind-wait-ip=10"
|
procd_append_param command "--bind-wait-ip=10"
|
||||||
procd_append_param command "$opts"
|
procd_append_param command "$opts"
|
||||||
|
|
||||||
procd_set_param file /etc/config/zapret
|
|
||||||
procd_set_param pidfile "$PIDDIR/$pid"
|
procd_set_param pidfile "$PIDDIR/$pid"
|
||||||
procd_set_param netdev "br-lan"
|
procd_set_param netdev "br-lan"
|
||||||
|
|
||||||
procd_open_data
|
procd_open_data
|
||||||
|
|
||||||
json_add_array firewall
|
json_add_array firewall
|
||||||
load_fw_rules "$lport" "$lanaddr"
|
load_fw_rules "$lport" "$lanaddr" "$fports" "$blockq"
|
||||||
json_close_array
|
json_close_array
|
||||||
|
|
||||||
procd_close_data
|
procd_close_data
|
||||||
@ -84,6 +90,18 @@ stop_service()
|
|||||||
echo "STOP Zapret service"
|
echo "STOP Zapret service"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service_triggers()
|
||||||
|
{
|
||||||
|
procd_add_reload_trigger "zapret"
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service()
|
||||||
|
{
|
||||||
|
echo "Restarting service"
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
service_started()
|
service_started()
|
||||||
{
|
{
|
||||||
procd_set_config_changed firewall
|
procd_set_config_changed firewall
|
||||||
|
Loading…
Reference in New Issue
Block a user