@ 符号用法
当您希望将规则存放在远程服务器或本地项目文件中,并让 Whistle 自动同步更新时,可以利用规则中的 @ 符号实现。
语法规则
1. 引入规则文件 (@path)
动态加载外部规则文件内容,Whistle 会定时从规则文件更新内容。
使用格式: @文件路径或URL
支持类型:
- 远程 URL:
@https://example.com/rules.txt - 本地文件:
@~/projects/rules.txt(支持所有操作系统路径) - 插件接口:
@whistle.nohost/api/rules(需插件实现接口)
Windows 路径兼容性:支持混用
/和\作为路径分隔符:txt@C:/whistle/rules.txt @D:\config\proxy.rules
配置示例
引入远程规则文件
txt
@https://raw.githubusercontent.com/your-org/configs/master/whistle-rules.txt引入本地项目规则
txt
@/Users/username/projects/my-app/whistle-config.txt
@~/dev/configs/rules.txt # 使用用户目录引入插件提供的规则
txt
@whistle.nohost/api/rules混合使用示例
txt
# 引入团队共享的基础规则
@https://team.example.com/configs/base-rules.txt
# 引入个人项目特定规则
@~/projects/my-app/whistle-overrides.txt文件格式要求
引入的外部文件应包含标准的 Whistle 规则语法:
txt
# 远程规则文件示例
www.example.com proxy://127.0.0.1:8080
api.example.com resCors://*
static.example.com cache://3600