-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AntiBlock program proxies DNS requests. The IP addresses of the specified domains are added to the routing table for routing through the specified interface. Signed-off-by: Khachatryan Karen <[email protected]>
- Loading branch information
Showing
4 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=antiblock | ||
PKG_VERSION:=2.0.0 | ||
PKG_RELEASE:=1 | ||
|
||
PKG_SOURCE_PROTO:=git | ||
PKG_SOURCE_URL:=https://github.com/karen07/antiblock | ||
PKG_SOURCE_VERSION:=f97a9790ae2310e0cb0fa97786974f0cecfda789 | ||
PKG_MIRROR_HASH:=51b37291f603a7f84e736ba0683ceccf79a8cd231788531824b1341b16cbb22a | ||
|
||
PKG_MAINTAINER:=Khachatryan Karen <[email protected]> | ||
PKG_LICENSE:=GPL-3.0-or-later | ||
|
||
include $(INCLUDE_DIR)/package.mk | ||
include $(INCLUDE_DIR)/cmake.mk | ||
|
||
define Package/antiblock | ||
SECTION:=net | ||
CATEGORY:=Network | ||
DEPENDS:=+libcurl | ||
TITLE:=AntiBlock | ||
URL:=https://github.com/karen07/antiblock | ||
endef | ||
|
||
define Package/antiblock/description | ||
AntiBlock program proxies DNS requests. | ||
The IP addresses of the specified domains are added to | ||
the routing table for routing through the specified interface. | ||
endef | ||
|
||
define Package/antiblock/conffiles | ||
/etc/config/antiblock | ||
endef | ||
|
||
define Package/antiblock/install | ||
$(INSTALL_DIR) $(1)/usr/bin | ||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/antiblock $(1)/usr/bin/antiblock | ||
|
||
$(INSTALL_DIR) $(1)/etc/init.d | ||
$(INSTALL_BIN) ./files/etc/init.d/antiblock $(1)/etc/init.d/antiblock | ||
|
||
$(INSTALL_DIR) $(1)/etc/config | ||
$(INSTALL_CONF) ./files/etc/config/antiblock $(1)/etc/config/antiblock | ||
endef | ||
|
||
$(eval $(call BuildPackage,antiblock)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
#config antiblock | ||
#At least one parameters needs to be filled: | ||
#option url 'https://antifilter.download/list/domains.lst' | ||
#option file '/root/my_urls.txt' | ||
#Required parameters: | ||
#option listen '192.168.1.1:5053' | ||
#option DNS '1.1.1.1:53' | ||
#option VPN_name 'VPN' | ||
#Optional parameters: | ||
#option log '1' | ||
#option stat '1' | ||
#option output '/tmp/antiblock' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/bin/sh /etc/rc.common | ||
|
||
START=99 | ||
USE_PROCD=1 | ||
|
||
start_service() { | ||
echo "AntiBlock start" | ||
|
||
local log="$(uci -q get antiblock.@antiblock[0].log)" | ||
local stat="$(uci -q get antiblock.@antiblock[0].stat)" | ||
local url="$(uci -q get antiblock.@antiblock[0].url)" | ||
local file="$(uci -q get antiblock.@antiblock[0].file)" | ||
local output="$(uci -q get antiblock.@antiblock[0].output)" | ||
local DNS="$(uci -q get antiblock.@antiblock[0].DNS)" | ||
local listen="$(uci -q get antiblock.@antiblock[0].listen)" | ||
local VPN_name="$(uci -q get antiblock.@antiblock[0].VPN_name)" | ||
|
||
procd_open_instance | ||
|
||
procd_set_param command "/usr/bin/antiblock" | ||
procd_set_param stdout 1 | ||
|
||
if [ -n "$log" ]; then | ||
procd_append_param command -log | ||
fi | ||
if [ -n "$stat" ]; then | ||
procd_append_param command -stat | ||
fi | ||
if [ -n "$url" ]; then | ||
procd_append_param command -url "$url" | ||
fi | ||
if [ -n "$file" ]; then | ||
procd_append_param command -file "$file" | ||
fi | ||
if [ -n "$output" ]; then | ||
mkdir -p "$output" | ||
procd_append_param command -output "$output" | ||
fi | ||
if [ -n "$DNS" ]; then | ||
procd_append_param command -DNS "$DNS" | ||
fi | ||
if [ -n "$listen" ]; then | ||
local listen_IP="$(echo "$listen" | cut -d ':' -f1)" | ||
local listen_port="$(echo "$listen" | cut -d ':' -f2)" | ||
uci -q set dhcp.@dnsmasq[0].noresolv="1" | ||
uci -q delete dhcp.@dnsmasq[0].server | ||
uci -q add_list dhcp.@dnsmasq[0].server="$listen_IP#$listen_port" | ||
|
||
procd_append_param command -listen "$listen" | ||
fi | ||
if [ -n "$VPN_name" ]; then | ||
local gateway="$(uci -q get network."$VPN_name".addresses | cut -d '/' -f1)" | ||
procd_append_param command -gateway "$gateway" | ||
fi | ||
|
||
procd_close_instance | ||
|
||
/etc/init.d/dnsmasq restart >/dev/null 2>&1 | ||
} | ||
|
||
stop_service() { | ||
echo "AntiBlock stop" | ||
|
||
uci -q revert dhcp.@dnsmasq[0] | ||
|
||
/etc/init.d/dnsmasq restart >/dev/null 2>&1 | ||
} | ||
|
||
service_triggers() { | ||
procd_add_reload_trigger "antiblock" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
antiblock | grep "AntiBlock started" |