mirror of
https://github.com/bol-van/zapret.git
synced 2024-12-02 14:40:52 +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
|
||||
|
||||
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
|
||||
|
@ -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))
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user