Quantumult X: 我最爱的IOS神器

“Quantumult X is a powerful network tool on iOS”

圈X作为一款代理软件,科学上网是它最不值得一提的功能。通过配置『分流』『重写』『MitM』等规则,它能实现包括去广告,自动化签到,薅羊毛,以及破解软件VIP权限等骚操作。折腾了一段时间,算是回归平淡。

每次来来回回找一些配置文件耗费不少时间,很多大佬的仓库也确实有很多不错的脚本,可大部分都是我用不到的,过分臃肿。所以在此整理一下自己用到的配置,避免之后重写捣鼓无意义的时间开销。

[general]

模块内为一些通用的设置参数项 Quantumult X 会对 server_check_url 指定的网址进行相应测试,以确认节点的可用性;同样可以在 server_local/remote 中,为节点、订阅单独指定server_check_url参数

1
server_check_url=http://www.qualcomm.cn/generate_204

节点延迟测试超时参数,需小于 5000 毫秒才生效

1
server_check_timeout=2000

资源解析器,可用于自定义各类远程资源的转换,如节点,规则 filter,复写 rewrite 等

1
resource_parser_url=https://cdn.jsdelivr.net/gh/KOP-XIAO/QuantumultX@master/Scripts/resource-parser.js

geo_location_checker用于节点页面的节点信息展示

1
geo_location_checker=http://ip-api.com/json/?lang=zh-CN, https://raw.githubusercontent.com/KOP-XIAO/QuantumultX/master/Scripts/IP_API.js

运行模式模块,running_mode_trigger 设置,即根据网络自动切换 分流/直连/全局代理 等模式。

running-mode-trigger 模式下,跟手动切换直连/全局代理 等效,rewrite/task 模块始终会生效

1
2
3
4
# 前两个 filter 先后表示 在 [数据蜂窝网络] 跟 [一般 Wi-Fi] 下,走 filter(分流)模式
# 后面表示在 asus-5g 下切换为全局直连[all_direct],asus 切换为全局代理[all_proxy]
# 如需使用,相应 SSID 换成自己 Wi-Fi 名即可
running_mode_trigger=filter, filter, asus-5g:all_direct, asus:all_proxy

UDP 白名单,留空则默认所有为端口。不在udp白名单列表中的端口,将被丢弃处理(返回 ICMP “端口不可达” 信息)。

1
udp_whitelist=53, 80-427, 444-65535

参数 fallback_udp_policy 的值仅支持末端策略(末端策略为经由规则模块和策略模块后所命中的策略,例如:direct、reject 以及节点;不支持内置策略 proxy 以及其它自定义策略)。

1
fallback_udp_policy=direct
下列表中的内容将不经过 QuantumultX的处理,设置后建议重启设备
1
2
excluded_routes=192.168.0.0/16, 172.16.0.0/12, 100.64.0.0/10, 10.0.0.0/8
icmp_auto_reply=true

[dns]

指定 dns 服务器,并发响应选取最优结果

1
2
3
4
5
6
7
server=114.114.114.114
server=202.141.176.93
server=202.141.178.13
server=117.50.10.10
server=223.5.5.5
server=119.29.29.29:53
server=119.28.28.28

指定域名解析dns, 下面为示范,按需启用

1
2
3
4
5
6
7
8
server=/*.taobao.com/223.5.5.5
server=/*.tmall.com/223.5.5.5
server=/*.qq.com/119.28.28.28
server=/*.163.com/119.29.29.29
server=/*.netease.com/119.29.29.29
;server=/*.mi.com/119.29.29.29
;server=/*testflight.apple.com/23.76.66.98
;server=8.8.8.8

[policy]

static 策略组中,你需要手动选择想要的节点/策略组。 url-latency-benchmark 延迟策略组,选取延迟最优节点。

1
2
3
4
5
6
7
8
9
10
# img-url 参数用于指定策略组图标
# server-tag-regex 以及 resource-tag-regex 参数用于正则筛选来建立策略组
static=国内, direct, proxy, img-url=https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/DomesticMedia.png
static=全球加速, 香港, 台湾, 日本, 新加坡, 美国, proxy, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/Global.png

url-latency-benchmark=香港, server-tag-regex=(?=.*(港|HK|(?i)Hong))^((?!(台|日|韩|新|美)).)*$, check-interval=86400, tolerance=0, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/HK.png
url-latency-benchmark=台湾, server-tag-regex=(?=.*(台|TW|(?i)Taiwan))^((?!(港|日|韩|新|美)).)*$, check-interval=86400, tolerance=0, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/TW.png
url-latency-benchmark=日本, server-tag-regex=(?=.*(日|JP|(?i)Japan))^((?!(港|台|韩|新|美)).)*$, check-interval=86400, tolerance=0, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/JP.png
url-latency-benchmark=新加坡, server-tag-regex=(?=.*(新|SG|(?i)Singapore))^((?!(港|台|日|韩|美)).)*$, check-interval=86400, tolerance=0, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/SG.png
url-latency-benchmark=美国, server-tag-regex=(?=.*(美|US|(?i)States|American))^((?!(港|台|日|韩|新)).)*$, check-interval=86400, tolerance=0, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/US.png

服务器

[server_remote]

远程服务器订阅模块,可直接订阅SSR,SS链接,以及Quantumult X格式的vmess/trojan/https订阅

其它格式可用 opt-parser 参数开启解析器导入使用

img-url参数用于指定图标,格式要求同样为 108*108 的 png 图片,可远程,可本地

1
2
3
4
# "tag" 跟 "enabled" 为可选参数,分别表示 “标签”及“开启状态”, true 为开启,false 关闭.
# update-interval 为更新时间参数,单位 秒, 默认更新时间为 24*60*60=86400 秒,也就是24小时.
# opt-parser=true/false 用于控制是否对本订阅 开启资源解析器,不写或者 false 表示不启用解析器;
https://xxx, tag=机场订阅示范, update-interval=86400, opt-parser=true, img-url=https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Quantumult_X.png, enabled=true

[server_local]

支持本地/iCloud的节点文件/片段,位于Quantumult X/Profiles路径下

1
;servers.snippet, tag=本地服务器, img-url=https://raw.githubusercontent.com/crossutility/Quantumult-X/master/quantumult-x.png, enabled=false

规则分流

[filter_remote]

远程分流模块,可使用force-policy来强制使用策略偏好, 替换远程规则内所指定的策略组

1
2
3
4
5
6
7
8
9
10
https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Unbreak.list, tag=规则修正, force-policy=direct, update-interval=172800, opt-parser=true, enabled=true
https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Guard/Advertising.list, tag=广告拦截, force-policy=reject, update-interval=172800, opt-parser=true, enabled=true
https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Guard/AdvertisingPlus.list#type=domain-set, tag=广告拦截, force-policy=reject, update-interval=172800, opt-parser=true, enabled=true
https://raw.githubusercontent.com/NobyDa/Script/master/Surge/AdRule.list, tag=广告拦截, force-policy=reject, update-interval=172800, opt-parser=true, enabled=true
https://raw.githubusercontent.com/app2smile/rules/master/rule/tieba-ad-qx.list, tag=贴吧广告, force-policy=reject, update-interval=172800, opt-parser=false, enabled=true
https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Guard/Hijacking.list, tag=运营劫持, force-policy=reject, update-interval=172800, opt-parser=true, enabled=true
https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Guard/Privacy.list, tag=隐私保护, force-policy=reject, update-interval=172800, opt-parser=true, enabled=true

https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Global.list, tag=全球加速, force-policy=全球加速, update-interval=172800, opt-parser=true, enabled=true
https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/China.list, tag=国内网站, force-policy=direct, update-interval=172800, opt-parser=true, enabled=true

[filter_local]

本地分流规则(对于完全相同的某条规则,本地的将优先生效)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
;host, www.google.com, proxy
host-keyword, adsite, reject
;host-suffix, googleapis.com, proxy

# ip 规则
ip-cidr, 10.0.0.0/8, direct
ip-cidr, 127.0.0.0/8, direct
ip-cidr, 172.16.0.0/12, direct
ip-cidr, 192.168.0.0/16, direct
ip-cidr, 224.0.0.0/24, direct

#ipv6 规则
;ip6-cidr, 2001:4860:4860::8888/32, direct

# 已采用 ip 池数据,因此注释掉 geoip cn
;geoip, cn, direct

#不在上述规则中(远程以及本地)的剩余请求,将走final 指定的节点/策略,这里是直连
final, direct

重写

[rewrite_remote]

远程重写模块,内包含主机名hostname以及重写规则

1
2
3
4
5
https://raw.githubusercontent.com/DivineEngine/Profiles/master/Quantumult/Rewrite/Block/Advertising.conf, tag=神机去广告, update-interval=172800, opt-parser=true, enabled=true

https://raw.githubusercontent.com/app2smile/rules/master/module/bilibili-qx.conf, tag=Bilibili去广告, update-interval=172800, opt-parser=false, enabled=false

https://raw.githubusercontent.com/Orz-3/QuantumultX/master/TikTok.conf, tag=Tiktok解锁, update-interval=172800, opt-parser=false, enabled=true

[rewrite_local]

#支持本地/iCloud的复写规则文件,位于Quantumult X/Profiles路径下

1
;rewrite.txt, tag=本地复写, opt-parser=false, enabled=false

[task_local]

包含3种类型: cron 定时任务,UI交互脚本,网络切换脚本

  1. 任务模块,可用于签到,天气话费查询等 js文件放于iCloud或者本机的Quantumult X/Scripts 路径下。TF版本可直接使用远程js链接

    1
    2
    3
    4
    # 每天 12 点 2 分,自动执行一次;
    # tag参数为 task 命名标识;
    # img-url参数用于指定 task 的图标(108*108)
    2 12 * * * https://raw.githubusercontent.com/crossutility/Quantumult-X/master/sample-task.js, tag=远程示范(点击缓存/更新脚本), enabled=false, img-url=https://raw.githubusercontent.com/crossutility/Quantumult-X/master/quantumult-x.png

  2. UI交互查询脚本示范,在首页长按 节点/策略组 唤出

    1
    event-interaction https://raw.githubusercontent.com/KOP-XIAO/QuantumultX/master/Scripts/streaming-ui-check.js, tag = 流媒体 - 解锁查询,img-url=checkmark.seal.system, enabled=true

  3. 网络切换/变化时 触发的脚本类型

    1
    ;event-network sample-taks.js

[http_backend]

BoxJS访问地址设定为 http://boxjs.com:9999/

1
https://raw.githubusercontent.com/chavyleung/scripts/master/chavy.box.js, host=boxjs.com, tag=BoxJS, path=^/, enabled=true

[mitm]

1
2
3
4
5
;skip_validating_cert = false
;force_sni_domain_name = false
//以下为证书参数,可去UI界面自行生成并安装证书,会在此生成对应信息
;passphrase =
;p12 =

Reference

Quantumult X 不完全教程

速看,针对小白QuantumultX的简单上手教程! | 坚果极客 (nutgeek.com)

erdongchanyo/Rules

KOP-XIAO配置说明

Orz-3/QuantumultX


Quantumult X: 我最爱的IOS神器
https://nessaj7.github.io/2021/10/09/62a04f5b8b05.html
作者
kuhn
发布于
2021年10月9日
许可协议