mirror of
https://github.com/bol-van/zapret.git
synced 2024-12-02 22:50:53 +03:00
Compare commits
No commits in common. "b82dbcd0e6ca1b38954cb59f6f5c7135eb68a5ca" and "e1ea96271542f0bbe807a8da9e86e5a61796e780" have entirely different histories.
b82dbcd0e6
...
e1ea962715
@ -14,27 +14,19 @@ How to compile native programs for use in openwrt
|
|||||||
|
|
||||||
cd openwrt
|
cd openwrt
|
||||||
|
|
||||||
|
2) ./scripts/feeds update -a
|
||||||
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/custom-feed/zapret/tpws
|
|
||||||
#copy source code of nfq
|
|
||||||
copy nfq to ~/openwrt/custom-feed/zapret/nfq
|
|
||||||
#copy source code of ip2net
|
|
||||||
copy ip2net to ~/openwrt/custom-feed/zapret/ip2net
|
|
||||||
|
|
||||||
4) ./scripts/feeds update -a
|
|
||||||
./scripts/feeds install -a
|
./scripts/feeds install -a
|
||||||
|
|
||||||
|
3) #add zapret packages to build root
|
||||||
|
#copy package descriptions
|
||||||
|
copy compile/openwrt/* to ~/openwrt
|
||||||
|
#copy source code of tpws
|
||||||
|
copy tpws to ~/openwrt/package/zapret/tpws
|
||||||
|
#copy source code of nfq
|
||||||
|
copy nfq to ~/openwrt/package/zapret/nfq
|
||||||
|
#copy source code of ip2net
|
||||||
|
copy ip2net to ~/openwrt/package/zapret/ip2net
|
||||||
|
|
||||||
4) make menuconfig
|
4) make menuconfig
|
||||||
#select your target architecture
|
#select your target architecture
|
||||||
#select packages Network/Zapret/* as "M"
|
#select packages Network/Zapret/* as "M"
|
||||||
|
@ -1,27 +1,19 @@
|
|||||||
# 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_VERSION:=1.4
|
PKG_RELEASE:=1.1
|
||||||
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 DPI bypass proxy server
|
TITLE:=tpws
|
||||||
SUBMENU:=Zapret
|
SUBMENU:=Zapret
|
||||||
DEPENDS:=+zlib +libcap +libcap +iptables
|
DEPENDS:=+zlib +libcap +zlib +libcap +iptables
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/tpws/description
|
|
||||||
DPI bypass proxy
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Prepare
|
define Build/Prepare
|
||||||
@ -49,3 +41,4 @@ define Package/tpws/install
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,tpws))
|
$(eval $(call BuildPackage,tpws))
|
||||||
|
|
||||||
|
@ -2,5 +2,3 @@ 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,34 +7,32 @@ START=21
|
|||||||
CONFIGURATION=zapret
|
CONFIGURATION=zapret
|
||||||
PIDDIR=/var/run
|
PIDDIR=/var/run
|
||||||
|
|
||||||
|
|
||||||
load_fw_rules()
|
load_fw_rules()
|
||||||
{
|
{
|
||||||
for fp in $3
|
|
||||||
do
|
|
||||||
json_add_object ""
|
json_add_object ""
|
||||||
json_add_string type redirect
|
json_add_string type redirect
|
||||||
json_add_string name "Transparent Proxy Redirect port $fp"
|
json_add_string name "Transparent Proxy Redirect HTTP"
|
||||||
json_add_string src lan
|
json_add_string src lan
|
||||||
json_add_string proto tcp
|
json_add_string proto tcp
|
||||||
json_add_string dest_port "$1"
|
json_add_string dest_port "$1"
|
||||||
json_add_string src_dip "!$2"
|
json_add_string src_dip "!$2"
|
||||||
json_add_string dest_ip "$2"
|
json_add_string dest_ip "$2"
|
||||||
json_add_string src_dport "$fp"
|
json_add_string src_dport "80"
|
||||||
json_add_string dest lan
|
json_add_string dest lan
|
||||||
json_close_object
|
json_close_object
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$4" = "1" ]; then
|
|
||||||
json_add_object ""
|
json_add_object ""
|
||||||
json_add_string type rule
|
json_add_string type redirect
|
||||||
json_add_string name "deny quic traffic"
|
json_add_string name "Transparent Proxy Redirect HTTPS"
|
||||||
json_add_string src lan
|
json_add_string src lan
|
||||||
json_add_string proto udp
|
json_add_string proto tcp
|
||||||
json_add_string dest_port "443"
|
json_add_string dest_port "$1"
|
||||||
json_add_string dest wan
|
json_add_string src_dip "!$2"
|
||||||
json_add_string target "REJECT"
|
json_add_string dest_ip "$2"
|
||||||
|
json_add_string src_dport "443"
|
||||||
|
json_add_string dest lan
|
||||||
json_close_object
|
json_close_object
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service()
|
start_service()
|
||||||
@ -46,15 +44,10 @@ 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 "tpws.pid"
|
config_get pid tpws pid
|
||||||
config_get lport tpws port "8088"
|
config_get lport tpws port
|
||||||
config_get fports tpws forward_ports "80 443"
|
|
||||||
config_get_bool blockq tpws block_quic 0
|
|
||||||
|
|
||||||
config_load "network"
|
config_load "network"
|
||||||
config_get lanaddr lan ipaddr
|
config_get lanaddr lan ipaddr
|
||||||
|
|
||||||
@ -68,13 +61,14 @@ 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" "$fports" "$blockq"
|
load_fw_rules "$lport" "$lanaddr"
|
||||||
json_close_array
|
json_close_array
|
||||||
|
|
||||||
procd_close_data
|
procd_close_data
|
||||||
@ -90,18 +84,6 @@ 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