└── README.md /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Debian系统 smartdns 配置教程,基于WSL 4 | #### author: bilibili@im-cwuom | date: 2023/7/17 5 | 6 | # 如何部署? 7 | ## 1. 配置中科大镜像源 8 | ``` shell 9 | cat > /etc/apt/sources.list << EOF 10 | deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free non-free-firmware 11 | 12 | # deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free non-free-firmware 13 | deb http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free non-free-firmware 14 | # deb-src http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free non-free-firmware 15 | 16 | # deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free non-free-firmware 17 | # deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free non-free-firmware 18 | EOF 19 | ``` 20 | 21 | ``` shell 22 | apt-get update 23 | ``` 24 | 25 | > 中科大源不是必须的,如果你网的质量比较好甚至可以用默认镜像,若其他源有更快的下载速度,可使用其他源替代。 26 | 27 | ## 2. 安装环境 28 | ``` shell 29 | apt install vim -y 30 | apt install smartdns -y 31 | apt install git -y 32 | apt install wget -y 33 | apt install net-tools -y 34 | apt install dnsutils -y 35 | ``` 36 | 37 | 38 | ## 3. SSL自动续期配置 39 | ``` shell 40 | git clone https://github.com/acmesh-official/acme.sh.git 41 | cd ./acme.sh 42 | ./acme.sh --install -m [你的邮箱] 43 | 44 | alias acme.sh=~/.acme.sh/acme.sh 45 | ``` 46 | 47 | ### 配置阿里云账号AccessKey,其他平台购入的域名请自行检索相关页面。 48 | ``` shell 49 | export Ali_Key="sddiwjedfasSDFSFsdaf" 50 | export Ali_Secret="jlsdsddiwjedfasSDFSFkljlfdsaklkjflsa" 51 | ``` 52 | 53 | > 阿里云账号AccessKey申请地址: https://usercenter.console.aliyun.com/#/manage/ak 54 | > 腾讯云请参考文章: [如何获取阿里云、腾讯云Access Key - 简书 (jianshu.com)](https://www.jianshu.com/p/ac489e7e779f) 55 | 56 | 57 | ### 验证域名所有权 58 | ``` shell 59 | acme.sh --issue --dns dns_ali -d [你的域名] -d *.[你的域名] --dnssleep 60 | ``` 61 | > 腾讯云请参考文章: [使用acme.sh申请Let's Encrypt免费的SSL证书-腾讯云开发者社区-腾讯云 (tencent.com)](https://cloud.tencent.com/developer/article/1877928) 62 | 63 | ### 成功返回示例 64 | ``` 65 | [Mon Jul 17 11:22:10 PM CST 2023] Using CA: https://acme.zerossl.com/v2/DV90 66 | [Mon Jul 17 11:22:10 PM CST 2023] Multi domain='DNS:[你的域名],DNS:*.[你的域名]' 67 | [Mon Jul 17 11:22:10 PM CST 2023] Getting domain auth token for each domain 68 | 69 | [Mon Jul 17 11:22:20 PM CST 2023] Getting webroot for domain='[你的域名]' 70 | [Mon Jul 17 11:22:20 PM CST 2023] Getting webroot for domain='*.[你的域名]' 71 | [Mon Jul 17 11:22:20 PM CST 2023] Adding txt value: OZPZdIQyL00Cs08a9E9YDj0UoR2ZK4dtnOwYAeYFhak for domain: _acme-challenge.[你的域名] 72 | [Mon Jul 17 11:22:29 PM CST 2023] The txt record is added: Success. 73 | [Mon Jul 17 11:22:29 PM CST 2023] Adding txt value: _cbQoQ-3hzVc0tzSvhoFZBSyDSrP0altPpBQAknTcM0 for domain: _acme-challenge.[你的域名] 74 | [Mon Jul 17 11:22:34 PM CST 2023] The txt record is added: Success. 75 | [Mon Jul 17 11:22:34 PM CST 2023] Let's check each DNS record now. Sleep 20 seconds first. 76 | [Mon Jul 17 11:22:55 PM CST 2023] You can use '--dnssleep' to disable public dns checks. 77 | [Mon Jul 17 11:22:55 PM CST 2023] See: https://github.com/acmesh-official/acme.sh/wiki/dnscheck 78 | [Mon Jul 17 11:22:55 PM CST 2023] Checking [你的域名] for _acme-challenge.[你的域名] 79 | [Mon Jul 17 11:23:00 PM CST 2023] Domain [你的域名] '_acme-challenge.[你的域名]' success. 80 | [Mon Jul 17 11:23:00 PM CST 2023] Checking [你的域名] for _acme-challenge.[你的域名] 81 | [Mon Jul 17 11:23:01 PM CST 2023] Domain [你的域名] '_acme-challenge.[你的域名]' success. 82 | [Mon Jul 17 11:23:01 PM CST 2023] All success, let's return 83 | [Mon Jul 17 11:23:01 PM CST 2023] Verifying: [你的域名] 84 | [Mon Jul 17 11:23:05 PM CST 2023] Processing, The CA is processing your order, please just wait. (1/30) 85 | [Mon Jul 17 11:23:11 PM CST 2023] Success 86 | [Mon Jul 17 11:23:11 PM CST 2023] Verifying: *.[你的域名] 87 | [Mon Jul 17 11:23:13 PM CST 2023] Processing, The CA is processing your order, please just wait. (1/30) 88 | [Mon Jul 17 11:23:18 PM CST 2023] Success 89 | [Mon Jul 17 11:23:18 PM CST 2023] Removing DNS records. 90 | [Mon Jul 17 11:23:18 PM CST 2023] Removing txt: OZPZdIQyL00Cs08a9E9YDj0UoR2ZK4dtnOwYAeYFhak for domain: _acme-challenge.[你的域名] 91 | [Mon Jul 17 11:23:28 PM CST 2023] Removed: Success 92 | [Mon Jul 17 11:23:28 PM CST 2023] Removing txt: _cbQoQ-3hzVc0tzSvhoFZBSyDSrP0altPpBQAknTcM0 for domain: _acme-challenge.[你的域名] 93 | 94 | [Mon Jul 17 11:23:36 PM CST 2023] Removed: Success 95 | [Mon Jul 17 11:23:36 PM CST 2023] Verify finished, start to sign. 96 | [Mon Jul 17 11:23:36 PM CST 2023] Lets finalize the order. 97 | [Mon Jul 17 11:23:36 PM CST 2023] Le_OrderFinalize='https://acme.zerossl.com/v2/DV90/order/vTAkmnaNULEm7_3jOKMw4w/finalize' 98 | [Mon Jul 17 11:23:38 PM CST 2023] Order status is processing, lets sleep and retry. 99 | [Mon Jul 17 11:23:38 PM CST 2023] Retry after: 15 100 | [Mon Jul 17 11:23:54 PM CST 2023] Polling order status: https://acme.zerossl.com/v2/DV90/order/vTAkmnaNULEm7_3jOKMw4w 101 | [Mon Jul 17 11:23:57 PM CST 2023] Downloading cert. 102 | [Mon Jul 17 11:23:57 PM CST 2023] Le_LinkCert='https://acme.zerossl.com/v2/DV90/cert/F5qUPoVIciJSqbDncd1j1w' 103 | [Mon Jul 17 11:24:00 PM CST 2023] Cert success. 104 | -----BEGIN CERTIFICATE----- 105 | MIIECjCCA5CgAwIBAgIPFnF4E352XmBwlKrjuQo4MAoGCCqGSM49BAMDMEsxCzAJ 106 | ****gsTG4khP 107 | -----END CERTIFICATE----- 108 | [Mon Jul 17 11:24:00 PM CST 2023] Your cert is in: /root/.acme.sh/[你的域名]_ecc/[你的域名].cer 109 | [Mon Jul 17 11:24:00 PM CST 2023] Your cert key is in: /root/.acme.sh/[你的域名]_ecc/[你的域名].key 110 | [Mon Jul 17 11:24:00 PM CST 2023] The intermediate CA cert is in: /root/.acme.sh/[你的域名]_ecc/ca.cer 111 | [Mon Jul 17 11:24:00 PM CST 2023] And the full chain certs is there: /root/.acme.sh/[你的域名]_ecc/fullchain.cer 112 | ``` 113 | 114 | 115 | 116 | ### 需要记下的信息 117 | - /root/.acme.sh/[你的域名]_ecc/fullchain.cer 118 | - /root/.acme.sh/[你的域名]_ecc/[你的域名].key 119 | 120 | 121 | ## 4. 替换配置文件 122 | ``` shell 123 | cat > /etc/smartdns/smartdns.conf << EOF 124 | bind-tcp [::]:53 125 | bind-tls [::]:853 126 | bind [::]:53 127 | 128 | 129 | # 域名结果缓存 130 | cache-size 32768 131 | cache-persist yes 132 | prefetch-domain yes 133 | serve-expired yes 134 | serve-expired-ttl 259200 135 | # TCP链接空闲超时 136 | tcp-idle-time 300 137 | 138 | # 设置审计启用 139 | audit-enable no 140 | 141 | bind-cert-file [你的fullchain] 142 | bind-cert-key-file [你的key] 143 | 144 | server 2400:3200::1 145 | server 8.8.8.8 146 | server 114.114.114.114 147 | server 119.29.29.29 148 | 149 | 150 | server-tls 2001:4860:4860::8888 -group abroad 151 | server-tls 1.0.0.1 -group abroad 152 | server-tls 4.2.2.2 -group abroad 153 | nameserver /google.com/abroad 154 | nameserver /google.com.hk/abroad 155 | nameserver /youtube.com/abroad 156 | nameserver /google/abroad 157 | 158 | nameserver /github.com/abroad 159 | nameserver /nodeload.github.com/abroad 160 | nameserver /api.github.com/abroad 161 | nameserver /codeload.github.com/abroad 162 | nameserver /raw.github.com/abroad 163 | nameserver /training.github.com/abroad 164 | nameserver /assets-cdn.github.com/abroad 165 | nameserver /documentcloud.github.com/abroad 166 | nameserver /help.github.com/abroad 167 | 168 | nameserver /github.global.ssl.fastly.net/abroad 169 | nameserver /raw.githubusercontent.com/abroad 170 | nameserver /pkg-containers.githubusercontent.com/abroad 171 | nameserver /cloud.githubusercontent.com/abroad 172 | nameserver /gist.githubusercontent.com/abroad 173 | nameserver /marketplace-screenshots.githubusercontent.com/abroad 174 | nameserver /repository-images.githubusercontent.com/abroad 175 | nameserver /user-images.githubusercontent.com/abroad 176 | nameserver /desktop.githubusercontent.com/abroad 177 | 178 | nameserver /wikipedia.org/abroad 179 | 180 | # 测速模式选择 181 | speed-check-mode ping,tcp:53 182 | # 过期缓存服务 183 | serve-expired no 184 | #双栈IP优选 185 | dualstack-ip-selection yes 186 | dualstack-ip-selection-threshold 10 187 | # 上游 TCP DNS 188 | ## 189 | # 上游 UDP DNS 190 | server 117.50.10.10 -group china 191 | server 52.80.52.52 -group china 192 | server 117.50.60.30 -group china 193 | server 52.80.60.30 -group china 194 | # 上游 加密 DNS 195 | server-https https://1.0.0.1/dns-query -group gfw 196 | server-https https://1.1.1.1/dns-query -group gfw 197 | # 黑名单IP地址 198 | blacklist-ip 113.197.104.0/23 199 | blacklist-ip 203.208.32.0/19 200 | # 指定域名使用server组 CHINA 201 | nameserver /baidu.com/china 202 | nameserver /cn.bing.com/china 203 | 204 | # 指定域名使用server组 Apple 205 | nameserver /a1.mzstatic.com/china 206 | nameserver /a2.mzstatic.com/china 207 | nameserver /a3.mzstatic.com/china 208 | nameserver /a4.mzstatic.com/china 209 | nameserver /a5.mzstatic.com/china 210 | nameserver /adcdownload.apple.com.akadns.net/china 211 | nameserver /adcdownload.apple.com/china 212 | nameserver /appldnld.apple.com/china 213 | nameserver /appldnld.g.aaplimg.com/china 214 | nameserver /appleid.cdn-apple.com/china 215 | nameserver /apps.apple.com/china 216 | nameserver /apps.mzstatic.com/china 217 | nameserver /cdn-cn1.apple-mapkit.com/china 218 | nameserver /cdn-cn2.apple-mapkit.com/china 219 | nameserver /cdn-cn3.apple-mapkit.com/china 220 | nameserver /cdn-cn4.apple-mapkit.com/china 221 | nameserver /cdn.apple-mapkit.com/china 222 | nameserver /cdn1.apple-mapkit.com/china 223 | nameserver /cdn2.apple-mapkit.com/china 224 | nameserver /cdn3.apple-mapkit.com/china 225 | nameserver /cdn4.apple-mapkit.com/china 226 | nameserver /cds-cdn.v.aaplimg.com/china 227 | nameserver /cds.apple.com.akadns.net/china 228 | nameserver /cds.apple.com/china 229 | nameserver /cl1-cdn.origin-apple.com.akadns.net/china 230 | nameserver /cl1.apple.com/china 231 | nameserver /cl2-cn.apple.com/china 232 | nameserver /cl2.apple.com.edgekey.net.globalredir.akadns.net/china 233 | nameserver /cl2.apple.com/china 234 | nameserver /cl3-cdn.origin-apple.com.akadns.net/china 235 | nameserver /cl3.apple.com/china 236 | nameserver /cl4-cdn.origin-apple.com.akadns.net/china 237 | nameserver /cl4-cn.apple.com/china 238 | nameserver /cl4.apple.com/china 239 | nameserver /cl5-cdn.origin-apple.com.akadns.net/china 240 | nameserver /cl5.apple.com/china 241 | nameserver /clientflow.apple.com.akadns.net/china 242 | nameserver /clientflow.apple.com/china 243 | nameserver /configuration.apple.com.akadns.net/china 244 | nameserver /configuration.apple.com/china 245 | nameserver /cstat.apple.com/china 246 | nameserver /dd-cdn.origin-apple.com.akadns.net/china 247 | nameserver /download.developer.apple.com/china 248 | nameserver /gs-loc-cn.apple.com/china 249 | nameserver /gs-loc.apple.com/china 250 | nameserver /gsp10-ssl-cn.ls.apple.com/china 251 | nameserver /gsp11-cn.ls.apple.com/china 252 | nameserver /gsp12-cn.ls.apple.com/china 253 | nameserver /gsp13-cn.ls.apple.com/china 254 | nameserver /gsp4-cn.ls.apple.com.edgekey.net.globalredir.akadns.net/china 255 | nameserver /gsp4-cn.ls.apple.com.edgekey.net/china 256 | nameserver /gsp4-cn.ls.apple.com/china 257 | nameserver /gsp5-cn.ls.apple.com/china 258 | nameserver /gsp85-cn-ssl.ls.apple.com/china 259 | nameserver /gspe19-cn-ssl.ls.apple.com/china 260 | nameserver /gspe19-cn.ls-apple.com.akadns.net/china 261 | nameserver /gspe19-cn.ls.apple.com/china 262 | nameserver /gspe21-ssl.ls.apple.com/china 263 | nameserver /gspe21.ls.apple.com/china 264 | nameserver /gspe35-ssl.ls.apple.com/china 265 | nameserver /iadsdk.apple.com/china 266 | nameserver /icloud-cdn.icloud.com.akadns.net/china 267 | nameserver /icloud.cdn-apple.com/china 268 | nameserver /images.apple.com.akadns.net/china 269 | nameserver /images.apple.com.edgekey.net.globalredir.akadns.net/china 270 | nameserver /images.apple.com/china 271 | nameserver /init-p01md-lb.push-apple.com.akadns.net/china 272 | nameserver /init-p01md.apple.com/china 273 | nameserver /init-p01st-lb.push-apple.com.akadns.net/china 274 | nameserver /init-p01st.push.apple.com/china 275 | nameserver /init-s01st-lb.push-apple.com.akadns.net/china 276 | nameserver /init-s01st.push.apple.com/china 277 | nameserver /iosapps.itunes.g.aaplimg.com/china 278 | nameserver /iphone-ld.apple.com/china 279 | nameserver /is1-ssl.mzstatic.com/china 280 | nameserver /is1.mzstatic.com/china 281 | nameserver /is2-ssl.mzstatic.com/china 282 | nameserver /is2.mzstatic.com/china 283 | nameserver /is3-ssl.mzstatic.com/china 284 | nameserver /is3.mzstatic.com/china 285 | nameserver /is4-ssl.mzstatic.com/china 286 | nameserver /is4.mzstatic.com/china 287 | nameserver /is5-ssl.mzstatic.com/china 288 | nameserver /is5.mzstatic.com/china 289 | nameserver /itunes-apple.com.akadns.net/china 290 | nameserver /itunes.apple.com/china 291 | nameserver /itunesconnect.apple.com/china 292 | nameserver /mesu-cdn.apple.com.akadns.net/china 293 | nameserver /mesu-china.apple.com.akadns.net/china 294 | nameserver /mesu.apple.com/china 295 | nameserver /music.apple.com/china 296 | nameserver /ocsp-lb.apple.com.akadns.net/china 297 | nameserver /ocsp.apple.com/china 298 | nameserver /oscdn.apple.com/china 299 | nameserver /oscdn.origin-apple.com.akadns.net/china 300 | nameserver /pancake.apple.com/china 301 | nameserver /pancake.cdn-apple.com.akadns.net/china 302 | nameserver /phobos.apple.com/china 303 | nameserver /prod-support.apple-support.akadns.net/china 304 | nameserver /reserve-prime.apple.com/china 305 | nameserver /s.mzstatic.com/china 306 | nameserver /stocks-sparkline-lb.apple.com.akadns.net/china 307 | nameserver /store.apple.com.edgekey.net.globalredir.akadns.net/china 308 | nameserver /store.apple.com.edgekey.net/china 309 | nameserver /store.apple.com/china 310 | nameserver /store.storeimages.apple.com.akadns.net/china 311 | nameserver /store.storeimages.cdn-apple.com/china 312 | nameserver /support-china.apple-support.akadns.net/china 313 | nameserver /support.apple.com/china 314 | nameserver /swcatalog-cdn.apple.com.akadns.net/china 315 | nameserver /swcatalog.apple.com/china 316 | nameserver /swcdn.apple.com/china 317 | nameserver /swcdn.g.aaplimg.com/china 318 | nameserver /swdist.apple.com.akadns.net/china 319 | nameserver /swdist.apple.com/china 320 | nameserver /swscan-cdn.apple.com.akadns.net/china 321 | nameserver /swscan.apple.com/china 322 | nameserver /updates-http.cdn-apple.com.akadns.net/china 323 | nameserver /updates-http.cdn-apple.com/china 324 | nameserver /updates.cdn-apple.com/china 325 | nameserver /valid.apple.com/china 326 | nameserver /valid.origin-apple.com.akadns.net/china 327 | nameserver /www.apple.com.edgekey.net.globalredir.akadns.net/china 328 | nameserver /www.apple.com.edgekey.net/china 329 | nameserver /www.apple.com/china 330 | EOF 331 | ``` 332 | > 上述配置文件可能比较杂乱,有能力的建议自己根据使用场景整理一份。 333 | 334 | ## 5. 重启服务 335 | ``` shell 336 | service smartdns restart 337 | ``` 338 | 339 | ---- 340 | 341 | 342 | # 如何使用? 343 | ## 1. 查看WSL的IPv4、IPv6地址 344 | ``` 345 | root@cwuom:~# ifconfig 346 | eth0: flags=4163 mtu 1500 347 | inet 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 348 | inet6 2409:8a28:6071:ec60:e33e:4393:449c:6262 prefixlen 64 scopeid 0x0 349 | inet6 2409:8a28:6071:ec60:e05d:e14f:fc12:5712 prefixlen 128 scopeid 0x0 350 | inet6 fe80::1e39:50c7:2ac2:1a9f prefixlen 64 scopeid 0xfd 351 | ether 04:42:1a:08:0e:9b (Ethernet) 352 | RX packets 0 bytes 0 (0.0 B) 353 | RX errors 0 dropped 0 overruns 0 frame 0 354 | TX packets 0 bytes 0 (0.0 B) 355 | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 356 | 357 | eth2: flags=4163 mtu 1500 358 | inet 172.26.80.1 netmask 255.255.240.0 broadcast 172.26.95.255 359 | inet6 fe80::62ef:8f39:bb70:3837 prefixlen 64 scopeid 0xfd 360 | ether 00:15:5d:8c:44:a0 (Ethernet) 361 | RX packets 0 bytes 0 (0.0 B) 362 | RX errors 0 dropped 0 overruns 0 frame 0 363 | TX packets 0 bytes 0 (0.0 B) 364 | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 365 | 366 | eth3: flags=4163 mtu 1500 367 | inet 192.168.96.1 netmask 255.255.240.0 broadcast 192.168.111.255 368 | inet6 fe80::1a00:9ed0:37eb:3cd4 prefixlen 64 scopeid 0xfd 369 | ether 00:15:5d:19:e4:25 (Ethernet) 370 | RX packets 0 bytes 0 (0.0 B) 371 | RX errors 0 dropped 0 overruns 0 frame 0 372 | TX packets 0 bytes 0 (0.0 B) 373 | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 374 | 375 | lo: flags=73 mtu 1500 376 | inet 127.0.0.1 netmask 255.0.0.0 377 | inet6 ::1 prefixlen 128 scopeid 0xfe 378 | loop (Local Loopback) 379 | RX packets 0 bytes 0 (0.0 B) 380 | RX errors 0 dropped 0 overruns 0 frame 0 381 | TX packets 0 bytes 0 (0.0 B) 382 | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 383 | 384 | ``` 385 | 386 | ## 2. 在其他设备中配置DNS并将IPv4、IPv6指向WSL 387 | 具体操作方式可自行搜索,此处不赘述。 388 | 389 | ## 常见问题 390 | ### ifconfig输出的地址不在同一网段且ping不通怎么办? 391 | 这是wsl2的特性,将wsl2降级为wsl1即可解决。 392 | ``` 393 | wsl -l -v 394 | wsl --set-version 1 395 | ``` 396 | 397 | ### 对网络有什么要求吗? 398 | 有,使用请先行前往路由器/光猫管理界面开启IPv4/v6的支持。纯IPv4可能无法直接访问Google之类解析返回为纯IPv6地址的网站。 399 | 400 | # 进阶 401 | ## 绕过SNI阻断 402 | 这里只是常见问题,更多信息请前往[URenko/Accesser: 🌏一个解决SNI RST导致维基百科、Pixiv等站点无法访问的工具 | A tool for solving SNI RST (github.com)](https://github.com/URenko/Accesser)查看 403 | 404 | ### 1. 我在局域网的其它设备中搭建了此项目,我该如何应用到除这个设备外的的平台? 405 | - 在Accesser运行根目录创建一个名为pac且不带后缀的文件。 406 | ```js 407 | var domains = { 408 | "apkmirror.com": 1, 409 | "appledaily.com": 1, 410 | "archiveofourown.org": 1, 411 | "artstation.com": 1, 412 | "bbc.com": 1, 413 | "disqus.com": 1, 414 | "dmc.nico": 1, 415 | "dropbox.com": 1, 416 | "dropboxapi.com": 1, 417 | "dropbox-dns.com": 1, 418 | "dw.com": 1, 419 | "e-hentai.org": 1, 420 | "epochtimes.com": 1, 421 | "euronews.com": 1, 422 | "exhentai.org": 1, 423 | "ftchinese.com": 1, 424 | "github.com": 1, 425 | "githubassets.com": 1, 426 | "githubusercontent.com": 1, 427 | "imgur.com": 1, 428 | "instagram.com": 1, 429 | "i.pximg.net": 1, 430 | "kobo.com": 1, 431 | "medium.com": 1, 432 | "mega.nz": 1, 433 | "nicovideo.jp": 1, 434 | "nyaa.si": 1, 435 | "nytimes.com": 1, 436 | "phncdn.com": 1, 437 | "pinterest.com": 1, 438 | "pixiv.net": 1, 439 | "pornhub.com": 1, 440 | "quora.com": 1, 441 | "redd.it": 1, 442 | "reddit.com": 1, 443 | "redditmedia.com": 1, 444 | "redditstatic.com":1, 445 | "startpage.com": 1, 446 | "steamcommunity.com": 1, 447 | "theepochtimes.com": 1, 448 | "thetvdb.com": 1, 449 | "tumblr.com": 1, 450 | "tumblr.co": 1, 451 | "uptodown.com": 1, 452 | "vimeo.com": 1, 453 | "wenxuecity.com": 1, 454 | "store.steampowered.com": 1, 455 | "wikipedia.org": 1 456 | }; 457 | 458 | var shexps = { 459 | "*://api.openai.com/*": 1, 460 | "*://steamcommunity-a.akamaihd.net/*": 1, 461 | "*://steamuserimages-a.akamaihd.net/*": 1, 462 | "*://*.amazon.co.jp/*": 1, 463 | "*://*onedrive.live.com/*": 1, 464 | "*://*.bbc.co.uk/*": 1, 465 | "*://*.bbci.co.uk/*": 1, 466 | "*://*.japantimes.co.jp/*": 1, 467 | "*://*.yahoo.co.jp/*": 1, 468 | "*://*.cna.com.tw/*": 1, 469 | "*://*.discord.com/*": 1, 470 | "*://*.discordapp.com/*": 1, 471 | "*://*.discord.gg/*": 1, 472 | "*://media.discordapp.net/*": 1, 473 | "*://*.duckduckgo.com/*": 1, 474 | "*://*.v2ex.com/*":1, 475 | "*://*.twitch.tv/*":1 476 | }; 477 | 478 | var proxy = "PROXY 192.168.1.3:7654;"; 479 | 480 | var direct = 'DIRECT;'; 481 | 482 | var hasOwnProperty = Object.hasOwnProperty; 483 | 484 | function shExpMatchs(str, shexps) { 485 | for (shexp in shexps) { 486 | if (shExpMatch(str, shexp)) { 487 | return true; 488 | } 489 | } 490 | return false; 491 | } 492 | 493 | function FindProxyForURL(url, host) { 494 | var suffix; 495 | var pos = host.lastIndexOf('.'); 496 | pos = host.lastIndexOf('.', pos - 1); 497 | while(1) { 498 | if (pos <= 0) { 499 | if (hasOwnProperty.call(domains, host)) { 500 | return proxy; 501 | } else if (shExpMatchs(url, shexps)) { 502 | return proxy; 503 | } else { 504 | return direct; 505 | } 506 | } 507 | suffix = host.substring(pos + 1); 508 | if (hasOwnProperty.call(domains, suffix)) { 509 | return proxy; 510 | } 511 | pos = host.lastIndexOf('.', pos - 1); 512 | } 513 | } 514 | 515 | ``` 516 | - 将pac文件中的"192.168.1.3:7654"指向你局域网中正在使用此项目的服务器的IP和端口。 517 | - 在另一个设备中安装证书,并在代理中启用"使用设置脚本",并输入目标服务器IP和端口 518 | 519 | ### 证书问题、不安全的站点 520 | - 请到此项目原作者写的的[FAQ · URenko/Accesser Wiki (github.com)](https://github.com/URenko/Accesser/wiki/FAQ)中查看 521 | 522 | 523 | # 误区 524 | 请注意,部署这些≠梯子。您的IP自始至终都不会改变,上述操作只能加速国内外网站的解析速度,例如 google.com 依旧无法直接访问,www.google.com.hk 的连接稳定性也不好保证。制作这个的目的还是为了防止污染让一些本该能正常访问的境外服务能够直连,而不是用来专门看外网的工具(这就是为什么还要设置国内DNS) 525 | 526 | # https://t.me/cwuoms_group 527 | --------------------------------------------------------------------------------