Surge for Mac 小众功能探索(一)External Proxy Provider

前言

用 Mac 的第三个年头,也是用 Surge for Mac 的第三个年头了。经历了纠结同样的价钱究竟是该把 Surge for Mac 2 Mega Licence 升级成 Surge for Mac 3 Mega Licence 还是直接新购 Surge for Mac 3 Pro Licence 之后还是选择了前者(虽然现在好像也并没有5个终端用了)。

Surge for Mac 的一些小众功能

(点击链接可查看 Surge 作者对各个功能的说明文章)

在日常使用中一些场景下提供了不错的体验,下面就简单写一写本人对以上提到三个功能的配置和使用

External Proxy Provider

之前一直会在各种社交平台上看到类似“ Surge 为什么不支持/什么时候才能支持 SSR/V2Ray”的言论,刘大爷大概也是被类似的言论逼得有点恼火,于是在 Surge 2 的某一个版本加入了 External Proxy Provider 功能(基本原理是使用Surge调用其他协议的客户端 binary 文件,再去连接这个客户端提供的 Socks 代理端口,实现无图形界面用户感知不到的的前置代理)这个功能直到现在(截止2019-3-18)的最新版本也没有提供 GUI 配置界面,配置需要手动写入 conf 文件。

* 本例中 ss-local、v2ray 的 binary 执行文件及其多个配置文件都位于 /Users/USERNAME/Surge/ 文件夹中

* json 配置文件格式应按照 ssr 标准书写,应注意每个文件中的本地端口号必须互异

在此以从 ShadowsocksX-NG 中提取的 ss-local 为例

如使用命令行启动 ss-local 调用 “ss-local-config-HKT.json” 配置的命令为

/Users/USERNAME/Surge/ss-local -c /Users/USERNAME/Surge/ss-local-config-HKT.json

则在 conf 文件中 [Proxy] 区段应对应写入

External-SSR = external, exec = "/Users/USERNAME/Surge/ss-local", args = "-c", args = "/Users/USERNAME/Surge/ss-local-config-HKT.json", local-port = 1080, addresses = 11.22.33.44

其中 “addresses” 为非必须字段,Surge 会自行判断其具体地址;其他字段均为必须区段,“local-port” 须对应 json 配置文件中的本地端口,exec 以外的空格隔开的参数均须用 args 字段隔开。

🖇SSR-HKT打机神线 = external, exec = "/Users/USERNAME/Surge/ss-local", local-port = 1096, args = "-c", args = "/Users/USERNAME/Surge/ss-local-config-HKT.json"
🖇SSR-HKT = external, exec = "/Users/USERNAME/Surge/ss-local", local-port = 1097, args = "-c", args = "/Users/USERNAME/Surge/ss-local-config-HKT2.json"
🖇SSR-WTT = external, exec = "/Users/USERNAME/Surge/ss-local", local-port = 1098, args = "-c", args = "/Users/USERNAME/Surge/ss-local-config-WTT.json"
🖇SSR-HKBN-1G = external, exec = "/Users/USERNAME/Surge/ss-local", local-port = 1095, args = "-c", args = "/Users/USERNAME/Surge/ss-local-config-HKBN.json"
🖇SSR-HKBN = external, exec = "/Users/USERNAME/Surge/ss-local", local-port = 1094, args = "-c", args = "/Users/USERNAME/Surge/ss-local-config-HKBN2.json"
🖇SSR-HKCN2 = external, exec = "/Users/USERNAME/Surge/ss-local", local-port = 1091, args = "-c", args = "/Users/USERNAME/Surge/ss-local-config-HKCN2.json"
🖇SSR-JP-M247 = external, exec = "/Users/USERNAME/Surge/ss-local", local-port = 1090, args = "-c", args = "/Users/USERNAME/Surge/ss-local-config-JPM247.json"
🖇SSR-JP-SoftBank = external, exec = "/Users/USERNAME/Surge/ss-local", local-port = 1099, args = "-c", args = "/Users/USERNAME/Surge/ss-local-config-SB.json"
🖇SSR-济南-移动1G = external, exec = "/Users/USERNAME/Surge/ss-local", local-port = 1087, args = "-c", args = "/Users/USERNAME/Surge/ss-local-config-CM1G-1087.json"
🖇SSR-郑州-联通1G = external, exec = "/Users/USERNAME/Surge/ss-local", local-port = 1088, args = "-c", args = "/Users/USERNAME/Surge/ss-local-config-CU1G-1088.json"
🌈V2Ray-KCP-PCCW = external, exec = "/Users/USERNAME/Surge/v2ray", local-port = 1117, args = "--config=/Users/USERNAME/Surge/v2ray-PCCW.json"
🌈V2Ray-KCP-HKauto = external, exec = "/Users/USERNAME/Surge/v2ray", local-port = 1124, args = "--config=/Users/USERNAME/Surge/v2ray-HKauto.json"
🌈V2Ray-KCP-HKT = external, exec = "/Users/USERNAME/Surge/v2ray", local-port = 1121, args = "--config=/Users/USERNAME/Surge/v2ray-HKT.json"
🌈V2Ray-KCP-WTT = external, exec = "/Users/USERNAME/Surge/v2ray", local-port = 1122, args = "--config=/Users/USERNAME/Surge/v2ray-WTT.json"

V2Ray节点同理可配置

配置多个代理后在 [Proxy Group] 区段写入代理组

SSR = select, 🖇SSR-HKT打机神线, 🖇SSR-HKT, 🖇SSR-WTT, 🖇SSR-HKCN2, 🖇SSR-HKBN, 🖇SSR-HKBN-1G, 🖇SSR-JP-SoftBank, 🖇SSR-JP-M247, 🖇SSR-济南-移动1G, 🖇SSR-郑州-联通1G

测试可看到全部 SSR/V2Ray 节点都可正常工作。

Surge-SSR