[{"data":1,"prerenderedAt":389},["ShallowReactive",2],{"blog_tun-mode":3,"\u002Fblog\u002Ftun-mode-surround":378},{"id":4,"title":5,"authors":6,"badge":11,"body":13,"date":366,"description":367,"extension":368,"image":369,"meta":370,"navigation":371,"path":372,"readingTime":373,"seo":374,"stem":375,"tags":376,"__hash__":377},"blog\u002Fblog\u002Ftun-mode.md","代码写得溜，API 连不上？开发者必看：救命的 TUN 模式到底是什么？",[7],{"name":8,"avatar":9},"星驰VPN",{"src":10},"\u002Flogo-rounded.png",{"label":12},"开发者工具, TUN 模式, 系统代理",{"type":14,"value":15,"toc":352},"minimark",[16,20,61,71,74,79,85,88,106,108,112,126,131,138,156,158,162,166,173,177,250,254,271,273,277,280,310,312,315,326,334,336,339,348],[17,18,19],"p",{},"作为一名开发者，你一定遇到过这种“玄学”时刻：",[21,22,23,31,38,54],"ul",{},[24,25,26,30],"li",{},[27,28,29],"strong",{},"浏览器","里访问 Google、OpenAI 丝滑顺畅。",[24,32,33,34,37],{},"但在 ",[27,35,36],{},"VS Code"," 里写 Copilot 提示连不上服务器。",[24,39,40,41,44,45,49,50,53],{},"在 ",[27,42,43],{},"终端 (Terminal)"," 里跑 ",[46,47,48],"code",{},"pip install"," 或 ",[46,51,52],{},"npm install"," 频繁超时。",[24,55,56,57,60],{},"调用的某个海外 API 接口，在代码里死活返回 ",[46,58,59],{},"Connection Timeout","。",[62,63,65],"caution",{"type":64},"error",[17,66,67,70],{},[27,68,69],{},"真相只有一个："," 你的程序“出轨”了——它们根本没走你的 VPN 代理通道。",[72,73],"hr",{},[75,76,78],"h2",{"id":77},"为什么系统代理对代码无效","🧐 为什么“系统代理”对代码无效？",[17,80,81,82,60],{},"大多数人使用的传统 VPN（或机场客户端）默认开启的是 ",[27,83,84],{},"系统代理 (System Proxy)",[17,86,87],{},"简单来说，系统代理像是一个“建议”。它在系统设置里挂了个牌子：“各位 App，想翻墙的请走 7890 端口”。",[21,89,90,96],{},[24,91,92,95],{},[27,93,94],{},"听话的 App："," 比如 Chrome、Edge 浏览器，它们会主动去看牌子，按规矩走。",[24,97,98,101,102,105],{},[27,99,100],{},"不听话的 App："," 很多 IDE（如 VS Code）、编程语言运行环境（Python、Node.js、Go）、以及各种命令行工具，它们",[27,103,104],{},"直接无视","这个牌子，坚持从本地网卡直接冲向国际互联网，结果自然是被墙撞得头破血流。",[72,107],{},[75,109,111],{"id":110},"️-救星降临什么是-tun-模式","🛡️ 救星降临：什么是 TUN 模式？",[17,113,114,115,118,119,122,123,60],{},"如果说“系统代理”是给 App 下发的一份",[27,116,117],{},"倡议书","，那么 ",[27,120,121],{},"TUN 模式"," 就是直接修了一条",[27,124,125],{},"强制性高速公路",[127,128,130],"h3",{"id":129},"原理简述生动版","原理简述（生动版）",[17,132,133,134,137],{},"TUN 模式会在你的电脑里生成一张",[27,135,136],{},"虚拟网卡 (Virtual Network Interface)","。\n当你开启 TUN 模式后，系统底层会将所有网络流量（不仅仅是浏览器，也包括你的代码、数据库连接、SSH 等）全部接管并转发给 VPN 节点。",[139,140,142],"card",{"title":141},"形象对比：代理 vs TUN",[21,143,144,150],{},[24,145,146,149],{},[27,147,148],{},"系统代理 (HTTP\u002FSOCKS5)："," 像是给 App 递了个“翻墙梯子”，爱爬不爬。",[24,151,152,155],{},[27,153,154],{},"TUN 模式："," 像是把整栋房子直接搬到了海外，只要你在房子里，开门就是外网。",[72,157],{},[75,159,161],{"id":160},"开发者实测tun-模式解决的典型痛点","💻 开发者实测：TUN 模式解决的典型痛点",[127,163,165],{"id":164},"_1-vs-code-jetbrains-插件不再断连","1. VS Code \u002F JetBrains 插件不再断连",[17,167,168,169,172],{},"无论是 GitHub Copilot 还是 Cursor，这些 AI 插件经常在后台发起请求。开启 TUN 模式后，你无需在 IDE 设置里折腾复杂的 ",[46,170,171],{},"http.proxy","，它们会自动恢复连接。",[127,174,176],{"id":175},"_2-编程语言库的调用","2. 编程语言库的调用",[178,179,180,222],"code-group",{},[181,182,188],"pre",{"className":183,"code":184,"filename":185,"language":186,"meta":187,"style":187},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import requests\n# 没开 TUN：requests.exceptions.ConnectionError\n# 开启 TUN：瞬间拿到 OpenAI API 的响应\nresponse = requests.get(\"https:\u002F\u002Fapi.openai.com\u002Fv1\u002Fmodels\")\nprint(response.json())\n","Python","python","",[46,189,190,198,204,210,216],{"__ignoreMap":187},[191,192,195],"span",{"class":193,"line":194},"line",1,[191,196,197],{},"import requests\n",[191,199,201],{"class":193,"line":200},2,[191,202,203],{},"# 没开 TUN：requests.exceptions.ConnectionError\n",[191,205,207],{"class":193,"line":206},3,[191,208,209],{},"# 开启 TUN：瞬间拿到 OpenAI API 的响应\n",[191,211,213],{"class":193,"line":212},4,[191,214,215],{},"response = requests.get(\"https:\u002F\u002Fapi.openai.com\u002Fv1\u002Fmodels\")\n",[191,217,219],{"class":193,"line":218},5,[191,220,221],{},"print(response.json())\n",[181,223,228],{"className":224,"code":225,"filename":226,"language":227,"meta":187,"style":187},"language-javascript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const axios = require('axios');\n\u002F\u002F 没开 TUN：ETIMEDOUT\n\u002F\u002F 开启 TUN：200 OK\naxios.get('https:\u002F\u002Fgithub.com').then(res => console.log('Success!'));\n","Node.js","javascript",[46,229,230,235,240,245],{"__ignoreMap":187},[191,231,232],{"class":193,"line":194},[191,233,234],{},"const axios = require('axios');\n",[191,236,237],{"class":193,"line":200},[191,238,239],{},"\u002F\u002F 没开 TUN：ETIMEDOUT\n",[191,241,242],{"class":193,"line":206},[191,243,244],{},"\u002F\u002F 开启 TUN：200 OK\n",[191,246,247],{"class":193,"line":212},[191,248,249],{},"axios.get('https:\u002F\u002Fgithub.com').then(res => console.log('Success!'));\n",[127,251,253],{"id":252},"_3-命令行工具-cli","3. 命令行工具 (CLI)",[17,255,256,257,260,261,260,264,260,267,270],{},"不再需要每次都输入 ",[46,258,259],{},"export https_proxy=...","、",[46,262,263],{},"git clone",[46,265,266],{},"docker pull",[46,268,269],{},"terraform init"," 等指令从此再无障碍。",[72,272],{},[127,274,276],{"id":275},"为什么选择-星驰-vpn-开启-tun-模式","🚀 为什么选择 星驰 VPN 开启 TUN 模式？",[17,278,279],{},"虽然很多开源客户端支持 TUN，但配置起来像是在“修火箭”。 星驰 的客户端将这一过程简化到了极致：",[281,282,283],"blockquote",{},[284,285,286,292,298,304],"ol",{},[24,287,288,291],{},[27,289,290],{},"一键开启："," 在设置中找到“TUN 模式”开关，点一下，全系统接管。",[24,293,294,297],{},[27,295,296],{},"高性能骨干网："," 依托 5Gbps 带宽，TUN 模式下的流量损耗极低，编译打包下载依赖像闪电一样快。",[24,299,300,303],{},[27,301,302],{},"智能分流："," 星驰 VPN 实现了精准的 IP 分流。访问百度、淘宝等国内流量依然直连，只有真正被墙的请求才会走 TUN 通道，工作娱乐两不误。",[24,305,306,309],{},[27,307,308],{},"全平台支持："," 无论是 Windows 上的 VS Code 还是 macOS 上的 Xcode，体验完全一致。",[72,311],{},[75,313,314],{"id":314},"总结",[17,316,317,318,321,322,325],{},"对于普通用户，系统代理够用了；但对于",[27,319,320],{},"开发者","，或者一些不遵循系统代理的App，TUN 模式是",[27,323,324],{},"刚需","。它让你告别繁琐的代理配置，把精力集中在代码逻辑本身，而不是在网络环境上浪费时间。",[327,328,331],"u-link",{"href":329,"target":330},"\u002F#cta","_blank",[17,332,333],{},"下载我们的客户端，开启一键 TUN 极速开发",[72,335],{},[75,337,338],{"id":338},"延伸阅读",[17,340,341],{},[342,343,347],"a",{"href":344,"rel":345,"target":330},"https:\u002F\u002Fwww.google.com\u002Fsearch?q=vscode-remote-dev-guide",[346],"nofollow","如何配置 VS Code 的远程开发环境？",[349,350,351],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":187,"searchDepth":200,"depth":200,"links":353},[354,355,358,364,365],{"id":77,"depth":200,"text":78},{"id":110,"depth":200,"text":111,"children":356},[357],{"id":129,"depth":206,"text":130},{"id":160,"depth":200,"text":161,"children":359},[360,361,362,363],{"id":164,"depth":206,"text":165},{"id":175,"depth":206,"text":176},{"id":252,"depth":206,"text":253},{"id":275,"depth":206,"text":276},{"id":314,"depth":200,"text":314},{"id":338,"depth":200,"text":338},"2025-11-08","为什么 VS Code 插件连不上 GitHub？为什么 Python 脚本抓不到数据？一篇文章带你彻底搞懂系统代理与 TUN 模式的区别。","md","\u002Fimg\u002Fcover_6.png",{},true,"\u002Fblog\u002Ftun-mode",null,{"title":5,"description":367},"blog\u002Ftun-mode","开发者工具, TUN 模式, 系统代理, 科学上网知识","FBqKe2wx43c0WrjR36xeulRAKSdvdhDwFeO6ncHBbt0",[379,384],{"title":380,"path":381,"stem":382,"description":383,"children":-1},"OPPO手机防掉线教程","\u002Fblog\u002Foppo-tutorial","blog\u002Foppo-tutorial","详细介绍如何在OPPO手机上优化系统配置，防止星驰VPN连接掉线，造成不好的使用体验",{"title":385,"path":386,"stem":387,"description":388,"children":-1},"vivo手机防掉线教程","\u002Fblog\u002Fvivo-tutorial","blog\u002Fvivo-tutorial","详细介绍如何在vivo手机上优化系统配置，防止星驰VPN连接掉线，造成不好的使用体验",1776668416139]