├── CONFIG.md ├── ICLOUD.md ├── README.md └── Smart.conf /CONFIG.md: -------------------------------------------------------------------------------- 1 | # 自定义配置 2 | ## 前言 3 | Wingy基于 [NEKit](https://github.com/zhuhaow/NEKit) 开发,同样,自定义配置也遵循其 V2 版本规范,可参考基于 V1 版本规范的 [SpechtLite](https://github.com/zhuhaow/SpechtLite) 4 | ##语法 5 | 自定义配置使用YAML标准格式,通过 [YAML官网](http://www.yaml.org/) 或 [docs.ansible.com](http://docs.ansible.com/ansible/YAMLSyntax.html) 了解语法 6 | 7 | > 强调一点:YAML对缩进非常严格,并且只能用空格 8 | 9 | 10 | ##基本概念 11 | rule 和 adapter 是自定义配置的两个核心概念:rule表示规则,用于匹配网络请求,网络请求匹配到某条规则之后,会被分配到相应的adapter上。示例是一条 Country rule,当请求对应的IP归属中国,那么请求将被分配到名为 adapterName 的 adapter 上。 12 | 13 | ``` 14 | - type: country 15 | country: CN 16 | match: true 17 | adapter: adapterName 18 | ``` 19 | 20 | 一个自定义规则中可以包含多个 rule 和 adapter。除了 direct 这个内置的 adapter,每个 adapter 需要定义唯一的 id 。每条 rule 我们需要给它指定相应的 adapter 。 21 | 22 | 一个自定义配置的框架如下: 23 | 24 | ``` 25 | version: 2 26 | adapter: 27 | - id: adapter1 28 | ... 29 | - id: adapter2 30 | ... 31 | rule: 32 | - type: iplist 33 | adapter: adapter1 34 | ... 35 | - type: country 36 | adapter: adapter2 37 | ... 38 | ``` 39 | ##Version说明 40 | 每个自定义规则必须声明格式版本,如果不声明将被默认为 V1 版本格式 41 | >由于Wingy基于V2版本运行,请务必声明 version 为 2 42 | 43 | 44 | ``` 45 | version: 2 46 | 47 | ``` 48 | 49 | 50 | ##Adapter详解 51 | Wingy支持以下几个类型的Adapter 52 | ####HTTP 53 | HTTP(S)代理 54 | 55 | ``` 56 | - id: httpAdapterName 57 | type: http 58 | host: http.host 59 | port: 8080 60 | secured: true #可选,是否为HTTPS代理,默认false 61 | auth: true #可选,是否需要身份验证 62 | username: proxy_username #可选 63 | password: proxy_password #可选 64 | ``` 65 | ####SOCK5 66 | socks5代理 67 | 68 | ``` 69 | - id: socks5AdapterName 70 | type: socks5 71 | host: socks5.host 72 | port: 3128 73 | ``` 74 | ####SS 75 | SS代理 76 | 77 | ``` 78 | - id: ssAdapterName 79 | type: ss 80 | host: ss.host 81 | port: 1024 82 | method: AES-128-CFB 83 | password: ss_password 84 | protocol: origin #可选 origin(无)、verify_sha1(OTA) 85 | obfs: origin #可选 origin(无)、http_simple、tls1.2_ticket_auth 86 | obfs_param: "" 87 | ``` 88 | ####Speed 89 | speed用于选择最快连接成功的线路, 90 | >每次网络请求, speed 都会连接所有线路,选择最快连接成功的线路。由于iOS对线程控制严格,speed 容易导致VPN意外断开。强烈建议iOS不使用该 adapter ,或者严格控制同时请求的线路。 91 | 92 | ``` 93 | - id: speedAdapterName 94 | type: speed 95 | adapters: 96 | - id: adapter1 97 | delay: 300 # 延时300毫秒 98 | - id: adapter2 99 | delay: 300 100 | - id: adapter3 101 | delay: 300 102 | - id: direct 103 | delay: 0 104 | ``` 105 | ####Reject 106 | reject会抛弃网络请求 107 | 108 | ``` 109 | - id: reject 110 | type: reject 111 | delay: 300 #延时300毫秒 112 | ``` 113 | ####Direct 114 | 直连网络 115 | 116 | ``` 117 | 内置 adapter ,不需要定义 118 | ``` 119 | ##Rule详解 120 | >rule 自上而下匹配的,以第一次匹配为准,所以rule书写的前后顺序会影响结果 121 | 122 | ####Country 123 | 同个IP判断归属国家 124 | 125 | ``` 126 | - type: country 127 | country: CN # ISO Country code,‘--’表示未知国家 128 | match: true #是否匹配 129 | adapter: adapterName 130 | ``` 131 | ####Domain List 132 | 匹配域名列表,criteria中的p,k,s,r分别表示 prefix (前缀),keyword(关键词),suffix(后缀),regex(正则表达式) 133 | 134 | >由于iOS不方便多文件,标准格式中的file列表暂时没有被支持 135 | 136 | ``` 137 | - type: domainlist 138 | #file: ~/.SpechtLite/adlist 139 | criteria: 140 | - p,ad 141 | - k,google 142 | - s,ad.com 143 | - r,google+.\.com 144 | adapter: adapterName 145 | ``` 146 | 147 | ####IP List 148 | 匹配IP列表 149 | 150 | >由于iOS不方便多文件,标准格式中的file列表暂时没有被支持 151 | 152 | ``` 153 | - type: iplist 154 | criteria: 155 | - 127.0.0.0/8 156 | - 192.168.0.0/16 157 | - 10.0.0.0/8 158 | - 224.0.0.0/8 159 | - 169.254.0.0/16 160 | adapter: adapterName 161 | ``` 162 | ####DNSFail 163 | DNS解析错误的时候匹配 164 | 165 | ``` 166 | - type: dnsfail 167 | adapter: adapterName 168 | ``` 169 | ####All 170 | 匹配所有网络请求 171 | 172 | ``` 173 | - type: all 174 | adapter: adapterName 175 | ``` 176 | ##示例 177 | ####所有请求走SS代理 178 | 这是最简单的一个自定义规则 179 | 180 | ``` 181 | version: 2 182 | adapter: 183 | - id: ss_proxy 184 | type: ss 185 | method: ss_method 186 | host: ss_host 187 | port: ss_port 188 | password: ss_password 189 | rule: 190 | - type: all 191 | adapter: ss_proxy 192 | ``` 193 | ####稍微复杂一点的规则 194 | 内网IP和中国IP不走代理,美国和日本的网站连接位于东京的SS代理,其他国外网站连接香港的HTTPS代理。 195 | >注:不同的 rule 可以指向相同的 adapter 196 | 197 | 198 | ``` 199 | version: 2 200 | adapter: 201 | - id: tokyo_ss_proxy 202 | type: ss 203 | method: ss_method 204 | host: ss_host 205 | port: ss_port 206 | password: ss_password 207 | - id: hk_https_proxy 208 | type: http 209 | host: http.host 210 | port: 8080 211 | secured: true 212 | auth: true 213 | username: proxy_username 214 | password: proxy_password 215 | rule: 216 | - type: domainlist 217 | criteria: 218 | - 127.0.0.0/8 219 | - 192.168.0.0/16 220 | - 10.0.0.0/8 221 | - 224.0.0.0/8 222 | - 169.254.0.0/16 223 | adapter: direct 224 | - type: country 225 | country: US 226 | match: true 227 | adapter: tokyo_ss_proxy 228 | - type: country 229 | country: JP 230 | match: true 231 | adapter: tokyo_ss_proxy 232 | - type: country 233 | country: CN 234 | match: true 235 | adapter: direct 236 | - type: all 237 | adapter: hk_https_proxy 238 | ``` 239 | ##自定义配置模板 240 | 感谢以下朋友分享配置模板,也欢迎更多朋友分享 241 | 242 | * [@kimanlo](https://github.com/kimanlo/WingyConfig) 243 | * [Wingy 内置规则(SS代理为例)](https://github.com/hellowingy/wingy-announcement/blob/master/Smart.conf) -------------------------------------------------------------------------------- /ICLOUD.md: -------------------------------------------------------------------------------- 1 | ##iCloud同步规则 2 | 3 | * Wingy 的 iCloud 同步功能自动开启,只需要保证系统中开启了iCloud Drive 4 | * iCloud Drive “WingyConfig”目录下所有“.conf”格式的文件将被同步到Wingy App,文件名作为配置备注 5 | * Wingy app 的所有自定义配置自动保存到iCloud的“WingyConfig”目录,以“备注.conf”文件名保存 6 | * Wingy app 和 iCloud Drive中如果出现同名配置,最后更新的将覆盖教早更新得配置 7 | * iCloud Drive中删除配置不会同步删除 Wingy app 的配置(删除配置只能通过Wingy app 进行) 8 | * Wingy app 删除配置会同步删除iCloud Drive中同名的配置 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Wingy 2 | 3 | ![](https://cdn.rawgit.com/shadowsocks/Potatso/master/Download.svg) 4 | 5 | 6 | - [关注 Telegram 频道获取更新通知](https://telegram.me/WingyAnnouncement) 7 | - [加入 Telegram 讨论组](https://telegram.me/wingytg) 8 | - [Twitter](https://twitter.com/HelloWingy) 9 | - [BUG请通过Issues提交](https://github.com/hellowingy/wingy-announcement/issues) 10 | - [申请TestFlight](https://t.co/v1SEDoLlOt) 11 | 12 | 13 | ## Recommend 14 | 15 | Mac用户推荐使用 [Specht](https://github.com/zhuhaow/SpechtLite) 16 | 17 | ## Supported Proxy 18 | 19 | [Shadowsocks](https://shadowsocks.org) Http Https Socks5 20 | 21 | ## Todo-List 22 | - Bug Fix 23 | - 支持远程自定义规则(每次启动通过Url更新) -------------------------------------------------------------------------------- /Smart.conf: -------------------------------------------------------------------------------- 1 | adapter: 2 | #ss代理 3 | - id: proxyAdapter 4 | type: ss 5 | #修改ss_host为服务器地址 6 | host: ss_host 7 | #修改ss_port为端口号 8 | port: ss_port 9 | #修改ss_password为密码 10 | password: ss_password 11 | #修改ss_method为加密方式 12 | method: ss_method 13 | #speed代理,尝试直连,延时500毫秒后再连接代理,使用最先完成连接的线路 14 | - id: speed 15 | type: SPEED 16 | adapters: 17 | - id: direct 18 | delay: 0 19 | - id: proxyAdapter 20 | delay: 500 21 | rule: 22 | #这些域名直连 23 | - type: domainlist 24 | adapter: direct 25 | criteria: 26 | - s,apple.com 27 | - s,icloud.com 28 | - s,itunes.com 29 | - s,crashlytics.com 30 | - s,mzstatic.com 31 | - s,localhost 32 | - s,.cn 33 | #这些域名走代理,防止IP污染 34 | - type: domainlist 35 | adapter: proxyAdapter 36 | criteria: 37 | - k,instagram 38 | - k,cdninstagram 39 | - k,twitter 40 | - k,twimg 41 | - k,facebook 42 | - k,fbcdn 43 | - k,google 44 | - s,gstatic.com 45 | #内网IP不走代理 46 | - type: iplist 47 | adapter: direct 48 | criteria: 49 | - 127.0.0.0/8 50 | - 192.168.0.0/16 51 | - 10.0.0.0/8 52 | - 224.0.0.0/8 53 | - 169.254.0.0/16 54 | #污染IP走代理 55 | - type: iplist 56 | adapter: proxyAdapter 57 | criteria: 58 | - 4.36.66.178/32 59 | - 8.7.198.45/32 60 | - 23.89.5.60/32 61 | - 37.61.54.158/32 62 | - 46.82.174.68/32 63 | - 49.2.123.56/32 64 | - 54.76.135.1/32 65 | - 59.24.3.173/32 66 | - 64.33.88.161/32 67 | - 64.33.99.47/32 68 | - 64.66.163.251/32 69 | - 65.104.202.252/32 70 | - 65.160.219.113/32 71 | - 66.45.252.237/32 72 | - 72.14.205.99/32 73 | - 72.14.205.104/32 74 | - 77.4.7.92/32 75 | - 78.16.49.15/32 76 | - 93.46.8.89/32 77 | - 118.5.49.6/32 78 | - 128.121.126.139/32 79 | - 159.106.121.75/32 80 | - 169.132.13.103/32 81 | - 188.5.4.96/32 82 | - 189.163.17.5/32 83 | - 192.67.198.6/32 84 | - 197.4.4.12/32 85 | - 202.106.1.2/32 86 | - 202.181.7.85/32 87 | - 203.98.7.65/32 88 | - 203.161.230.171/32 89 | - 207.12.88.98/32 90 | - 208.56.31.43/32 91 | - 209.36.73.33/32 92 | - 209.145.54.50/32 93 | - 209.220.30.174/32 94 | - 211.94.66.147/32 95 | - 213.169.251.35/32 96 | - 216.221.188.182/32 97 | - 216.234.179.13/32 98 | - 243.185.187.39/32 99 | - 249.129.46.48/32 100 | - 253.157.14.165/32 101 | - 74.125.31.113/32 102 | - 74.125.39.102/32 103 | - 74.125.39.113/32 104 | - 74.125.127.102/32 105 | - 74.125.130.47/32 106 | - 74.125.155.102/32 107 | - 209.85.229.138/32 108 | - 210.242.125.20/32 109 | - 2.1.1.2/32 110 | - 4.193.80.0/32 111 | - 8.105.84.0/32 112 | - 12.87.133.0/32 113 | - 16.63.155.0/32 114 | - 20.139.56.0/32 115 | - 24.51.184.0/32 116 | - 28.121.126.139/32 117 | - 28.13.216.0/32 118 | - 46.20.126.252/32 119 | - 46.38.24.209/32 120 | - 61.54.28.6/32 121 | - 66.206.11.194/32 122 | - 74.117.57.138/32 123 | - 89.31.55.106/32 124 | - 113.11.194.190/32 125 | - 118.5.49.6/32 126 | - 122.218.101.190/32 127 | - 123.50.49.171/32 128 | - 123.126.249.238/32 129 | - 125.230.148.48/32 130 | - 173.201.216.6/32 131 | - 203.199.57.81/32 132 | - 208.109.138.55/32 133 | - 211.5.133.18/32 134 | - 211.8.69.27/32 135 | - 213.186.33.5/32 136 | - 216.139.213.144/32 137 | - 221.8.69.27/32 138 | - 243.185.187.3/32 139 | - 243.185.187.30/32 140 | #DNS无法解析走代理 141 | - type: DNSFail 142 | adapter: proxyAdapter 143 | #中国的IP直连 144 | - type: country 145 | country: CN 146 | match: true 147 | adapter: direct 148 | #无法判断IP归属地走speed测速 149 | - type: country 150 | country: -- 151 | match: true 152 | adapter: speed 153 | #其它情况走代理 154 | - type: all 155 | adapter: proxyAdapter 156 | --------------------------------------------------------------------------------