Skip to content

Commit

Permalink
some fixs
Browse files Browse the repository at this point in the history
add zip.bat
add 10086.txt
  • Loading branch information
twoone-3 committed Apr 17, 2024
1 parent 8fa956f commit e749045
Show file tree
Hide file tree
Showing 8 changed files with 648 additions and 33 deletions.
20 changes: 2 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,7 @@ Anywhere停止链接
anywhere://share/J2VP8X5qVhbI2sRvhZ2hdp4467QzpcHDlkAQil7Mg6oDOLdzYgAJO+9fKKenP2M28XWZ71jveGDq1E/sCmMAhBqd5N04LZkJp0EYtrFp7Vw9xPsYBhlmwlaKWljr9iIAMGWOulpW7Zzhm/tpfaDIKjweOGfIsONgcoWq89Idmb215WTrhfju+OeoNqDicBqrOLI5iyI8fTCQifRm7m7hq53WMgN/BoYbWnyE34AeVO2hq5btVggCTBGunrftXnlweSY4ngaN8CmhTlDWQeyjMJRZMooTPHwcQm3fisvBY6McMaVV5lSLHBe+MNaK1EwnzQ0RjNJh/3eoVGQJgUUyN8swAmtakrwaNA==
```

# 原理
本插件实现方法非常简单,利用了iptables进行流量转发,将53端口的流量转发到5591也就是本插件设置的AdGuardHome端口

- apply_iptables.sh 片段
```sh
# 返回所有 AdGuardHome 的请求
iptables -t nat -A ADGUARD -m owner --uid-owner root --gid-owner net_admin -j RETURN
# 将 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
```
- service.sh 片段
```sh
setuidgid root:net_admin "$ADG_DIR/AdGuardHome" &
```

其将AdGuardHome程序的用户设置为net_admin,然后在规则排除掉net_admin的请求(否则会导致网络回环)
# 鸣谢
- [AdguardHome_magisk](https://github.com/410154425/AdGuardHome_magisk)
- [akashaProxy](https://github.com/ModuleList/akashaProxy)
- [akashaProxy](https://github.com/ModuleList/akashaProxy)
- [box_for_magisk](https://github.com/taamarin/box_for_magisk)
2 changes: 2 additions & 0 deletions apply_iptables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ iptables -t nat -N ADGUARD
# 返回所有 AdGuardHome 的请求
iptables -t nat -A ADGUARD -m owner --uid-owner root --gid-owner net_admin -j RETURN
# 将 53 端口所有 udp tcp 流量转发到 adguard home
# iptables -t nat -A ADGUARD -p udp --dport 53 -j DNAT --to-destination 127.0.0.1:5591
# iptables -t nat -A ADGUARD -p tcp --dport 53 -j DNAT --to-destination 127.0.0.1:5591
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
# 将 ADGUARD 规则添加到 OUTPUT
Expand Down
Binary file modified bin/AdGuardHome
Binary file not shown.
23 changes: 10 additions & 13 deletions bin/AdGuardHome.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ dns:
ratelimit_whitelist: []
refuse_any: true
upstream_dns:
- '#https://1.12.12.12/dns-query'
- '#https://120.53.53.53/dns-query'
- '#https://223.5.5.5/dns-query'
- '#https://223.6.6.6/dns-query'
- 223.5.5.5
- https://1.12.12.12/dns-query
- https://120.53.53.53/dns-query
- https://223.5.5.5/dns-query
- https://223.6.6.6/dns-query
upstream_dns_file: ""
bootstrap_dns:
- 0.0.0.0
- 1.1.1.1
- 8.8.8.8
fallback_dns:
- '#https://1.1.1.1/dns-query'
- https://1.1.1.1/dns-query
upstream_mode: load_balance
fastest_timeout: 1s
allowed_clients: []
Expand Down Expand Up @@ -69,7 +69,6 @@ dns:
serve_http3: false
use_http3_upstreams: false
serve_plain_dns: true
hostsfile_enabled: true
tls:
enabled: false
server_name: ""
Expand All @@ -86,14 +85,12 @@ tls:
private_key_path: ""
strict_sni_check: false
querylog:
dir_path: ""
ignored: []
interval: 6h
size_memory: 1000
enabled: true
file_enabled: true
statistics:
dir_path: ""
ignored: []
interval: 24h
enabled: true
Expand Down Expand Up @@ -137,15 +134,15 @@ filtering:
pixabay: true
yandex: true
youtube: true
blocking_mode: default
blocking_mode: null_ip
parental_block_host: family-block.dns.adguard.com
safebrowsing_block_host: standard-block.dns.adguard.com
rewrites: []
safebrowsing_cache_size: 1048576
safesearch_cache_size: 1048576
parental_cache_size: 1048576
cache_time: 30
filters_update_interval: 72
filters_update_interval: 168
blocked_response_ttl: 30
filtering_enabled: true
parental_enabled: false
Expand All @@ -171,4 +168,4 @@ os:
group: ""
user: ""
rlimit_nofile: 0
schema_version: 28
schema_version: 27
Loading

0 comments on commit e749045

Please sign in to comment.