Skip to content

Commit

Permalink
Changes to be committed:
Browse files Browse the repository at this point in the history
	modified:   module.prop
	modified:   script.sh
  • Loading branch information
twoone-3 committed Nov 26, 2023
1 parent 169eca2 commit d026021
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=AdGuardHome
name=AdGuardHome For Magisk
version=20231125
versionCode=1
version=20231126
versionCode=2
author=top大佬(酷安)/twoone3
description=通过DNS层面过滤广告、防DNS劫持,使用前请先详读mode.conf文件,支持订阅过滤规则,可兼容VPN、免模块、翻模块、校园网、热点共享等特殊使用环境,后台地址http://127.0.0.1:3000,用户名/密码root
10 changes: 6 additions & 4 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ MODDIR=${0%/*}
# 读取配置文件的端口
port_yaml="$(cat "$MODDIR/AdGuardHome.yaml" | egrep '^ port: ' | sed -n 's/ port: //g;s/ //g;$p')"
# 新建规则链
iptables -t nat -N ADGUARDHOME
iptables -t nat -A ADGUARDHOME -p udp --dport 53 -j DNAT --to-destination "127.0.0.1:$port_yaml"
iptables -t nat -A ADGUARDHOME -p tcp --dport 53 -j DNAT --to-destination "127.0.0.1:$port_yaml"
iptables -t nat -I OUTPUT -j ADGUARDHOME
iptables -t nat -N ADHOME
# 将 53 端口所有 upd tcp 流量转发到 adguard home
iptables -t nat -A ADHOME -p udp --dport 53 -j DNAT --to-destination "127.0.0.1:$port_yaml"
iptables -t nat -A ADHOME -p tcp --dport 53 -j DNAT --to-destination "127.0.0.1:$port_yaml"
# 将 ADHOME 规则添加到 OUTPUT
iptables -t nat -I OUTPUT -j ADHOME

0 comments on commit d026021

Please sign in to comment.