Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能否增加smartdns 规则 #104

Open
YoKv opened this issue Jan 4, 2025 · 1 comment
Open

能否增加smartdns 规则 #104

YoKv opened this issue Jan 4, 2025 · 1 comment

Comments

@YoKv
Copy link

YoKv commented Jan 4, 2025

参考 https://pymumu.github.io/smartdns/config/ad-block/

参考脚本

#!/bin/bash

# 定义URL、下载文件名以及目标配置文件路径
URL="https://gcore.jsdelivr.net/gh/217heidai/adblockfilters@main/rules/adblockdnsmasq.txt"
DOWNLOAD_FILE="/tmp/adblockdnsmasq.txt"
CONFIG_FILE_PATH="/etc/smartdns/conf.d/adblockfilters.conf"

# 清空目标配置文件,确保不会累加
> $CONFIG_FILE_PATH

# 下载文件到临时文件中
echo "Fetching the latest adblock filter rules from: $URL"
wget -qO- $URL > $DOWNLOAD_FILE

# 使用cat, grep和awk处理文件并保存到配置文件中
cat $DOWNLOAD_FILE | grep local= | awk -F= '{print "address "$2"#"}' >> $CONFIG_FILE_PATH

echo "Configuration file updated successfully."
@217heidai
Copy link
Owner

已支持,试下规则 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants