Skip to content

Commit

Permalink
improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
twoone-3 committed Jan 1, 2024
1 parent a36588a commit 9c644c6
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 31 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
# AdGuardHome for Magisk
> 一个通过过滤DNS请求来屏蔽广告的 Magisk 模块,也能防止DNS污染,无需配置,在 Magisk 里安装重启即可使用,使用前需关闭私人dns,AdGuardHome 后台管理地址为 http://127.0.0.1:3000,用户名/密码root
一个通过过滤DNS请求来屏蔽广告的 Magisk 模块,也能防止DNS污染,

![Static Badge](https://img.shields.io/badge/arm--64-support-blue)
![GitHub all releases](https://img.shields.io/github/downloads/twoone-3/AdguardHome/total)

加入我们的 [Telegram](https://t.me/adguardhome_for_magisk_release) 频道获取最新信息以及FAQ

# 用法
- 在 Magisk/KernelSU 刷入后重启即可使用
- 使用前需在设置里关闭 `私人/专用dns`在 Magisk/KernelSU 刷入后重启即可使用,AdGuardHome 后台管理地址为 http://127.0.0.1:3000,用户名/密码root

# 特性
- DNS上游为DoH,稳定,减少污染
- 仅内置[秋风广告规则](https://github.com/TG-Twilight/AWAvenue-Ads-Rule),省电,不误杀
- DNS 上游为腾讯阿里 DoT,备用 DNS 为 Google 和 CloudFlare 的 DoT
- 仅内置[秋风广告规则](https://github.com/TG-Twilight/AWAvenue-Ads-Rule),省电,少误杀
- 可配合第三方软件进行启动停止,通过执行位于 /data/adb/modules/AdGuardHome/bin/ 的 apply_iptables.sh 和 flush_iptables.sh,这里给出Anywhere的快捷导入链接(复制到剪贴板即可导入)

Anywhere启动链接
```
anywhere://share/J2VP8X5qVhbI2sRvhZ6JXLZdx7Y6JLmsCgw9Wd7k7qce3ERvOaJlWHt61Y8oalvceraVdBkTbIymWLyhgxRQLeICFi3/GKuZYkqPJ3A6WQ8+xW4nTvmC9SwzER2X/9PFEtjgZsphvy2R8suN6BOE3Pm10gwmsdoLwCuLxs0uIA2VmP25Ur1GHTCogIgJoWBpJpz0QT1/LvBtNXXdFwkilQNF8VvcKAO3cgKns+I3hUk0T2rbsjVfj4UwxgYxi5Yg9yiV53hOzIzVZ9uZki3uy6TNTnThFXM+Hg88m8dron/cJM9Qg5Y979j0YTVrA9XakpnXKlF7UvaDM85FSjXZpkXCzbn00lWcvQ==
```
Anywhere停止链接
```
anywhere://share/J2VP8X5qVhbI2sRvhZ2hdp4467QzpcHDlkAQil7Mg6oDOLdzYgAJO+9fKKenP2M28XWZ71jveGDq1E/sCmMAhBqd5N04LZkJp0EYtrFp7Vw9xPsYBhlmwlaKWljr9iIAMGWOulpW7Zzhm/tpfaDIKjweOGfIsONgcoWq89Idmb215WTrhfju+OeoNqDicBqrOLI5iyI8fTCQifRm7m7hq53WMgN/BoYbWnyE34AeVO2hq5btVggCTBGunrftXnlweSY4ngaN8CmhTlDWQeyjMJRZMooTPHwcQm3fisvBY6McMaVV5lSLHBe+MNaK1EwnzQ0RjNJh/3eoVGQJgUUyN8swAmtakrwaNA==
```

# 鸣谢
- [AdguardHome_magisk](https://github.com/410154425/AdGuardHome_magisk)
Expand Down
3 changes: 0 additions & 3 deletions apply_iptables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@ iptables -t nat -A ADGUARD -m owner --uid-owner root --gid-owner net_raw -j RETU
# 将 53 端口所有 udp tcp 流量转发到 adguard home
iptables -t nat -A ADGUARD -p udp --dport 53 -j REDIRECT --to-ports 5591
iptables -t nat -A ADGUARD -p tcp --dport 53 -j REDIRECT --to-ports 5591
# ip6 缺少nat表,待查问题
# ip6tables -t nat -A ADGUARD -p udp --dport 53 -j REDIRECT --to-ports 5591
# ip6tables -t nat -A ADGUARD -p tcp --dport 53 -j REDIRECT --to-ports 5591
# 将 ADGUARD 规则添加到 OUTPUT
iptables -t nat -I OUTPUT 1 -j ADGUARD
19 changes: 10 additions & 9 deletions bin/AdGuardHome.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ dns:
ratelimit_whitelist: []
refuse_any: true
upstream_dns:
- tls://dot.pub
- tls://dns.alidns.com
- tls://1.12.12.12
- tls://223.5.5.5
- tls://120.53.53.53
- tls://223.6.6.6
upstream_dns_file: ""
bootstrap_dns:
- 223.5.5.5
- 119.29.29.29
- 0.0.0.0
fallback_dns:
- tls://dns.google
- tls://1dot1dot1dot1.cloudflare-dns.com
all_servers: true
- tls://1.1.1.1
- tls://8.8.8.8
all_servers: false
fastest_addr: false
fastest_timeout: 1s
allowed_clients: []
Expand Down Expand Up @@ -86,7 +87,7 @@ tls:
strict_sni_check: false
querylog:
ignored: []
interval: 1h
interval: 6h
size_memory: 1000
enabled: true
file_enabled: true
Expand Down Expand Up @@ -143,7 +144,7 @@ filtering:
parental_cache_size: 1048576
cache_time: 30
filters_update_interval: 72
blocked_response_ttl: 10
blocked_response_ttl: 30
filtering_enabled: true
parental_enabled: false
safebrowsing_enabled: false
Expand Down
3 changes: 0 additions & 3 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@ fi

ADG_DIR="$MODPATH/bin"
chmod +x "$ADG_DIR/AdGuardHome" "$MODPATH/apply_iptables.sh" "$MODPATH/flush_iptables.sh"
# TODO: 研究用户组对程序运行有什么影响
# chgrp net_raw "$ADG_DIR/AdGuardHome"
# chgrp net_raw "$ADG_DIR/AdGuardHome.yaml"

ui_print "安装成功,请重启设备"
6 changes: 1 addition & 5 deletions flush_iptables.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
iptables -t nat -D OUTPUT 1
iptables -t nat -F ADGUARD
iptables -t nat -X ADGUARD

# ip6tables -t nat -D ADGUARD 1
# ip6tables -t nat -F ADGUARD
# ip6tables -t nat -X ADGUARD
iptables -t nat -X ADGUARD
6 changes: 3 additions & 3 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=AdGuardHome
name=AdGuardHome for Magisk
version=20231223
versionCode=8
version=20240101
versionCode=9
author=twoone3
description=通过DNS层面过滤广告、防DNS劫持,后台地址http://127.0.0.1:3000,用户名/密码root
description=Filter ads at the DNS level
5 changes: 1 addition & 4 deletions service.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# until [ $(getprop sys.boot_completed) ]; do
# sleep 1
# done
MODDIR="${0%/*}"
ADG_DIR="$MODDIR/bin"
# 输出重定向
exec 1>"$ADG_DIR/stdout.log"
exec 2>"$ADG_DIR/stderr.log"

setuidgid root:net_raw "$ADG_DIR/AdGuardHome" 2>&1 &
setuidgid root:net_raw "$ADG_DIR/AdGuardHome" &

"$MODDIR/apply_iptables.sh"

0 comments on commit 9c644c6

Please sign in to comment.