<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>影子屋 (文章分类：naiveproxy)</title><link>https://blog.bgme.me/</link><description></description><atom:link href="https://blog.bgme.me/categories/naiveproxy.xml" rel="self" type="application/rss+xml"></atom:link><language>zh_cn</language><copyright>Contents © 2024 &lt;a href="mailto:i@bgme.me"&gt;无影人&lt;/a&gt; 
&lt;a rel="license noopener nofollow" target="_blank" href="http://creativecommons.org/licenses/by-sa/4.0/" class="ui image" title="如无特别说明，本站文章均遵循 CC BY-SA 4.0 协议，转载请注明作者及出处。"&gt;
&lt;img alt="Creative Commons Attribution-ShareAlike 4.0 International License" src="/license.png"&gt;
&lt;/a&gt;
</copyright><lastBuildDate>Wed, 24 Apr 2024 12:02:15 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>三分钟梯子教程</title><link>https://blog.bgme.me/posts/2019/naiveproxy/</link><dc:creator>无影人</dc:creator><description>&lt;p&gt;本文将教你如何快速搭建一个 naiveproxy 代理。&lt;/p&gt;
&lt;!-- TEASER_END --&gt;
&lt;section id="naiveproxy"&gt;
&lt;h2&gt;为什么要使用 naiveproxy？&lt;/h2&gt;
&lt;p&gt;首先贴上大佬对目前能用的翻墙协议的&lt;a class="reference external" href="https://twitter.com/gfwrev/status/1081802626243514370"&gt;简单评价&lt;/a&gt; 。&lt;/p&gt;
&lt;div class="no-margin-img"&gt;
  &lt;img src="https://blog.bgme.me/images/2019/naiveproxy/gfwrev_1.png" alt="gfwrev_1"&gt;&lt;br&gt;
  &lt;img src="https://blog.bgme.me/images/2019/naiveproxy/gfwrev_2.png" alt="gfwrev_2"&gt;&lt;br&gt;
  &lt;img src="https://blog.bgme.me/images/2019/naiveproxy/gfwrev_3.png" alt="gfwrev_3"&gt;
&lt;/div&gt;
&lt;style media="screen"&gt;
  div.no-margin-img img {
    margin-top: 0 !important;
    margin-bottom: 0!important;
  }
&lt;/style&gt;&lt;p&gt;为什么要使用 &lt;a class="reference external" href="https://github.com/klzgrad/naiveproxy"&gt;naiveproxy&lt;/a&gt;？
这个问题，直接摘录 naiveproxy 的 README 就可以回答。&lt;/p&gt;
&lt;figure class="align-center"&gt;
&lt;a class="reference external image-reference" href="https://blog.bgme.me/images/2019/naiveproxy/naiveproxy_1.png"&gt;&lt;img alt="/images/2019/naiveproxy/naiveproxy_1.thumbnail.png" src="https://blog.bgme.me/images/2019/naiveproxy/naiveproxy_1.thumbnail.png"&gt;&lt;/a&gt;
&lt;figcaption&gt;
&lt;p&gt;The README.md of naiveproxy&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;与 naiveproxy 相似的项目还有 &lt;a class="reference external" href="https://github.com/trojan-gfw/trojan"&gt;trojan&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;二者都是使用 &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;TLS&lt;/a&gt; 协议穿越 &lt;a class="reference external" href="https://zh.wikipedia.org/wiki/%E9%98%B2%E7%81%AB%E9%95%BF%E5%9F%8E"&gt;GFW&lt;/a&gt;，以减少流量特征，抵抗主动/被动检测以及运营商的 &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Quality_of_service"&gt;Qos&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;如同大佬所说 &lt;code class="docutils literal"&gt;今天能用的协议就是好协议；但是今天能用不等于明天能用&lt;/code&gt;，所以我们需要早做打算。&lt;/p&gt;
&lt;/section&gt;
&lt;section id="caddy-proxy"&gt;
&lt;h2&gt;快速搭建 Caddy Proxy&lt;/h2&gt;
&lt;p&gt;本节只是导入，如果想直接进入正文，请点击&lt;a class="reference internal" href="https://blog.bgme.me/posts/2019/naiveproxy/#naiveproxy-6"&gt;这里&lt;/a&gt;。&lt;/p&gt;
&lt;section id="caddy"&gt;
&lt;h3&gt;安装 &lt;a class="reference external" href="https://caddyserver.com/"&gt;Caddy&lt;/a&gt;&lt;/h3&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_d84ea2d22c094b7fb9ce611f84e1d7c0-1" name="rest_code_d84ea2d22c094b7fb9ce611f84e1d7c0-1" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d84ea2d22c094b7fb9ce611f84e1d7c0-1"&gt;&lt;/a&gt;curl https://getcaddy.com | sudo bash -s personal http.forwardproxy
&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id="section-1"&gt;
&lt;h3&gt;创建配置文件&lt;/h3&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-1" name="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-1" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41a5efd09c8747beb7e6bda3f61d13b2-1"&gt;&lt;/a&gt;example.com {
&lt;a id="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-2" name="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-2" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41a5efd09c8747beb7e6bda3f61d13b2-2"&gt;&lt;/a&gt;gzip
&lt;a id="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-3" name="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-3" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41a5efd09c8747beb7e6bda3f61d13b2-3"&gt;&lt;/a&gt;tls i@example.com
&lt;a id="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-4" name="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-4" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41a5efd09c8747beb7e6bda3f61d13b2-4"&gt;&lt;/a&gt;forwardproxy {
&lt;a id="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-5" name="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-5" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41a5efd09c8747beb7e6bda3f61d13b2-5"&gt;&lt;/a&gt;  basicauth Username Password
&lt;a id="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-6" name="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-6" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41a5efd09c8747beb7e6bda3f61d13b2-6"&gt;&lt;/a&gt;  hide_ip
&lt;a id="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-7" name="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-7" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41a5efd09c8747beb7e6bda3f61d13b2-7"&gt;&lt;/a&gt;  hide_via
&lt;a id="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-8" name="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-8" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41a5efd09c8747beb7e6bda3f61d13b2-8"&gt;&lt;/a&gt;  probe_resistance secert.localhost
&lt;a id="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-9" name="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-9" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41a5efd09c8747beb7e6bda3f61d13b2-9"&gt;&lt;/a&gt;  }
&lt;a id="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-10" name="rest_code_41a5efd09c8747beb7e6bda3f61d13b2-10" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41a5efd09c8747beb7e6bda3f61d13b2-10"&gt;&lt;/a&gt;}
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;修改 &lt;code class="docutils literal"&gt;Username&lt;/code&gt;、&lt;code class="docutils literal"&gt;Password&lt;/code&gt;、&lt;code class="docutils literal"&gt;secert&lt;/code&gt; 后将上述内容写入 &lt;code class="docutils literal"&gt;Caddyfile&lt;/code&gt;。&lt;/p&gt;
&lt;/section&gt;
&lt;section id="caddy-1"&gt;
&lt;h3&gt;启动 Caddy&lt;/h3&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_e7394e514da44158aee31111b8948903-1" name="rest_code_e7394e514da44158aee31111b8948903-1" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_e7394e514da44158aee31111b8948903-1"&gt;&lt;/a&gt;caddy
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;如果出现报错，运行 &lt;code class="docutils literal"&gt;sudo setcap &lt;span class="pre"&gt;cap_net_bind_service=+ep&lt;/span&gt; $(which caddy)&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;如果没有报错，Caddy Proxy 搭建完成。&lt;/p&gt;
&lt;/section&gt;
&lt;section id="section-2"&gt;
&lt;h3&gt;设置代理&lt;/h3&gt;
&lt;p&gt;在浏览器中将代理设置为 &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;https://example.com&lt;/span&gt;&lt;/code&gt; ，然后访问 &lt;code class="docutils literal"&gt;secert.localhost&lt;/code&gt; ，在弹出的提示框中输入 &lt;code class="docutils literal"&gt;Username&lt;/code&gt;、&lt;code class="docutils literal"&gt;Password&lt;/code&gt; 即可。&lt;/p&gt;
&lt;hr class="docutils"&gt;
&lt;p&gt;到此为止，你已经有了一个可用的 HTTP/2 proxy，但是为什么不直接使用这个 HTTP/2 proxy 呢？&lt;/p&gt;
&lt;p&gt;对于这个问题可以阅读项目的 &lt;a class="reference external" href="https://github.com/klzgrad/naiveproxy#why-not-use-http2-proxy-from-browser-directly"&gt;FAQ&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;简而言之，TLS-in-TLS 在包长度上会有明显的特征，很容易被 GFW 探测出来然后封杀。&lt;/p&gt;
&lt;p&gt;用作者的话来说，NaiveProxy 只是做了以下工作。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;NaiveProxy does HTTP Fast CONNECT similar to TCP Fast Open, i.e. send subsequent data immediately after CONNECT. Also, you may have to type in the password for the proxy everytime you open the browser. NaiveProxy sends the password automatically.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/section&gt;
&lt;/section&gt;
&lt;section id="naiveproxy-2"&gt;
&lt;h2&gt;搭建 NaiveProxy&lt;/h2&gt;
&lt;p&gt;下面开始正文，以下演示基于 Debian 9 系统。&lt;/p&gt;
&lt;section id="libnss3"&gt;
&lt;h3&gt;安装 libnss3&lt;/h3&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_9e192b9181ef4b8298b87637a9b25ec5-1" name="rest_code_9e192b9181ef4b8298b87637a9b25ec5-1" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9e192b9181ef4b8298b87637a9b25ec5-1"&gt;&lt;/a&gt;sudo apt install libnss3 xz-utils zip
&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id="section-3"&gt;
&lt;h3&gt;创建前端网页&lt;/h3&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_744b6b3a7295437b9c6589c81d89403d-1" name="rest_code_744b6b3a7295437b9c6589c81d89403d-1" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_744b6b3a7295437b9c6589c81d89403d-1"&gt;&lt;/a&gt;cd /tmp/
&lt;a id="rest_code_744b6b3a7295437b9c6589c81d89403d-2" name="rest_code_744b6b3a7295437b9c6589c81d89403d-2" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_744b6b3a7295437b9c6589c81d89403d-2"&gt;&lt;/a&gt;wget https://github.com/jiashigrsyt/jiashigrsyt.github.io/archive/master.zip
&lt;a id="rest_code_744b6b3a7295437b9c6589c81d89403d-3" name="rest_code_744b6b3a7295437b9c6589c81d89403d-3" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_744b6b3a7295437b9c6589c81d89403d-3"&gt;&lt;/a&gt;unzip master.zip
&lt;a id="rest_code_744b6b3a7295437b9c6589c81d89403d-4" name="rest_code_744b6b3a7295437b9c6589c81d89403d-4" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_744b6b3a7295437b9c6589c81d89403d-4"&gt;&lt;/a&gt;find jiashigrsyt.github.io-master/ -name "*.html" | xargs -n 1 sed -e "s/jiashigrsyt\.github\.io/example.com/g" -i
&lt;a id="rest_code_744b6b3a7295437b9c6589c81d89403d-5" name="rest_code_744b6b3a7295437b9c6589c81d89403d-5" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_744b6b3a7295437b9c6589c81d89403d-5"&gt;&lt;/a&gt;find jiashigrsyt.github.io-master/ -name "*.md" | xargs -n 1 sed -e "s/jiashigrsyt\.github\.io/example.com/g" -i
&lt;a id="rest_code_744b6b3a7295437b9c6589c81d89403d-6" name="rest_code_744b6b3a7295437b9c6589c81d89403d-6" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_744b6b3a7295437b9c6589c81d89403d-6"&gt;&lt;/a&gt;sudo -u www-data cp -r jiashigrsyt.github.io-master/ /var/www/html
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;仅做演示，请根据自己情况，自行修改，切莫无脑使用。&lt;/p&gt;
&lt;/section&gt;
&lt;section id="naiveproxy-3"&gt;
&lt;h3&gt;下载 naiveproxy&lt;/h3&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_41b7f5c2ece34f3886c66ab487831a8d-1" name="rest_code_41b7f5c2ece34f3886c66ab487831a8d-1" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41b7f5c2ece34f3886c66ab487831a8d-1"&gt;&lt;/a&gt;cd /tmp
&lt;a id="rest_code_41b7f5c2ece34f3886c66ab487831a8d-2" name="rest_code_41b7f5c2ece34f3886c66ab487831a8d-2" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41b7f5c2ece34f3886c66ab487831a8d-2"&gt;&lt;/a&gt;wget https://github.com/klzgrad/naiveproxy/releases/download/v71.0.3578.98-2/naiveproxy-v71.0.3578.98-2-linux.tar.xz
&lt;a id="rest_code_41b7f5c2ece34f3886c66ab487831a8d-3" name="rest_code_41b7f5c2ece34f3886c66ab487831a8d-3" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41b7f5c2ece34f3886c66ab487831a8d-3"&gt;&lt;/a&gt;tar -xf naiveproxy-v71.0.3578.98-2-linux.tar.xz
&lt;a id="rest_code_41b7f5c2ece34f3886c66ab487831a8d-4" name="rest_code_41b7f5c2ece34f3886c66ab487831a8d-4" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41b7f5c2ece34f3886c66ab487831a8d-4"&gt;&lt;/a&gt;
&lt;a id="rest_code_41b7f5c2ece34f3886c66ab487831a8d-5" name="rest_code_41b7f5c2ece34f3886c66ab487831a8d-5" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41b7f5c2ece34f3886c66ab487831a8d-5"&gt;&lt;/a&gt;cd naiveproxy-v71.0.3578.98-2-linux/
&lt;a id="rest_code_41b7f5c2ece34f3886c66ab487831a8d-6" name="rest_code_41b7f5c2ece34f3886c66ab487831a8d-6" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_41b7f5c2ece34f3886c66ab487831a8d-6"&gt;&lt;/a&gt;cp naive /usr/local/bin/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;请适当修改下载地址，下载地址请至 &lt;a class="reference external" href="https://github.com/klzgrad/naiveproxy/releases/latest"&gt;latest release&lt;/a&gt; 查看。&lt;/p&gt;
&lt;/section&gt;
&lt;section id="naiveproxy-4"&gt;
&lt;h3&gt;创建 naiveproxy 配置文件&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;服务端&lt;/strong&gt;&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code json"&gt;&lt;a id="rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-1" name="rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-1" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-1"&gt;&lt;/a&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-2" name="rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-2" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-2"&gt;&lt;/a&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;"listen"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http://127.0.0.1:8080"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-3" name="rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-3" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-3"&gt;&lt;/a&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;"padding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-4" name="rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-4" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_c4ee3bfa59594ff98c89002f3e69d7e2-4"&gt;&lt;/a&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;客户端&lt;/strong&gt;&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code json"&gt;&lt;a id="rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-1" name="rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-1" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-1"&gt;&lt;/a&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-2" name="rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-2" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-2"&gt;&lt;/a&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;"listen"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"socks://127.0.0.1:1080"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-3" name="rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-3" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-3"&gt;&lt;/a&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;"proxy"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://Username:Password@example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-4" name="rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-4" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-4"&gt;&lt;/a&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;"padding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;
&lt;a id="rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-5" name="rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-5" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_e16ad58ddb3a4661a2dfbf2f9fc4975c-5"&gt;&lt;/a&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id="naiveproxy-5"&gt;
&lt;h3&gt;添加 naiveproxy 服务&lt;/h3&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-1" name="rest_code_9042eb55f21642b39dd1762c19a4debd-1" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-1"&gt;&lt;/a&gt;# /etc/systemd/system/navieproxy.service
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-2" name="rest_code_9042eb55f21642b39dd1762c19a4debd-2" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-2"&gt;&lt;/a&gt;[Unit]
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-3" name="rest_code_9042eb55f21642b39dd1762c19a4debd-3" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-3"&gt;&lt;/a&gt;Description=NaiveProxy Server Service
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-4" name="rest_code_9042eb55f21642b39dd1762c19a4debd-4" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-4"&gt;&lt;/a&gt;After=network-online.target
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-5" name="rest_code_9042eb55f21642b39dd1762c19a4debd-5" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-5"&gt;&lt;/a&gt;
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-6" name="rest_code_9042eb55f21642b39dd1762c19a4debd-6" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-6"&gt;&lt;/a&gt;[Service]
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-7" name="rest_code_9042eb55f21642b39dd1762c19a4debd-7" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-7"&gt;&lt;/a&gt;Type=simple
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-8" name="rest_code_9042eb55f21642b39dd1762c19a4debd-8" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-8"&gt;&lt;/a&gt;User=nobody
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-9" name="rest_code_9042eb55f21642b39dd1762c19a4debd-9" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-9"&gt;&lt;/a&gt;CapabilityBoundingSet=CAP_NET_BIND_SERVICE
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-10" name="rest_code_9042eb55f21642b39dd1762c19a4debd-10" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-10"&gt;&lt;/a&gt;ExecStart=/usr/local/bin/naive /etc/naive/config.json
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-11" name="rest_code_9042eb55f21642b39dd1762c19a4debd-11" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-11"&gt;&lt;/a&gt;
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-12" name="rest_code_9042eb55f21642b39dd1762c19a4debd-12" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-12"&gt;&lt;/a&gt;[Install]
&lt;a id="rest_code_9042eb55f21642b39dd1762c19a4debd-13" name="rest_code_9042eb55f21642b39dd1762c19a4debd-13" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_9042eb55f21642b39dd1762c19a4debd-13"&gt;&lt;/a&gt;WantedBy=multi-user.target
&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id="caddy-2"&gt;
&lt;h3&gt;配置 Caddy&lt;/h3&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-1" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-1" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-1"&gt;&lt;/a&gt;example.com {
&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-2" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-2" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-2"&gt;&lt;/a&gt;gzip
&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-3" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-3" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-3"&gt;&lt;/a&gt;tls i@example.com
&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-4" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-4" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-4"&gt;&lt;/a&gt;root /var/www/html
&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-5" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-5" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-5"&gt;&lt;/a&gt;forwardproxy {
&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-6" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-6" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-6"&gt;&lt;/a&gt;  basicauth Username Password
&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-7" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-7" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-7"&gt;&lt;/a&gt;  hide_ip
&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-8" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-8" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-8"&gt;&lt;/a&gt;  hide_via
&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-9" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-9" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-9"&gt;&lt;/a&gt;  probe_resistance secert.localhost
&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-10" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-10" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-10"&gt;&lt;/a&gt;  upstream http://127.0.0.1:8080
&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-11" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-11" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-11"&gt;&lt;/a&gt;  }
&lt;a id="rest_code_d6d87061dc6b4f449501584ff780c8c9-12" name="rest_code_d6d87061dc6b4f449501584ff780c8c9-12" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_d6d87061dc6b4f449501584ff780c8c9-12"&gt;&lt;/a&gt;}
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;a class="reference external" href="https://caddyserver.com/"&gt;Caddy&lt;/a&gt; 相关内容请阅读&lt;a class="reference external" href="https://blog.ddiu.site/caddy-server/"&gt;这篇博文&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;如需自启，请自行创建服务。&lt;/p&gt;
&lt;/section&gt;
&lt;section id="section-4"&gt;
&lt;h3&gt;参数调优&lt;/h3&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_f959aacaef8f4df6b8206374339ccb0f-1" name="rest_code_f959aacaef8f4df6b8206374339ccb0f-1" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_f959aacaef8f4df6b8206374339ccb0f-1"&gt;&lt;/a&gt;net.ipv4.tcp_congestion_control = bbr
&lt;a id="rest_code_f959aacaef8f4df6b8206374339ccb0f-2" name="rest_code_f959aacaef8f4df6b8206374339ccb0f-2" href="https://blog.bgme.me/posts/2019/naiveproxy/#rest_code_f959aacaef8f4df6b8206374339ccb0f-2"&gt;&lt;/a&gt;net.ipv4.tcp_slow_start_after_idle = 0
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;将上述内容写入 &lt;code class="docutils literal"&gt;`/etc/sysctl.d/local.conf&lt;/code&gt; 。&lt;/p&gt;
&lt;/section&gt;
&lt;section id="naiveproxy-6"&gt;
&lt;h3&gt;使用 NaiveProxy&lt;/h3&gt;
&lt;figure class="align-center"&gt;
&lt;img alt="/images/2019/naiveproxy/zip.png" src="https://blog.bgme.me/images/2019/naiveproxy/zip.png"&gt;
&lt;figcaption&gt;
&lt;p&gt;压缩包&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;&lt;p&gt;至 &lt;a class="reference external" href="https://github.com/klzgrad/naiveproxy/releases/latest"&gt;latest release&lt;/a&gt; 页面，根据系统下载相应的压缩包，解压。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;修改 &lt;code class="docutils literal"&gt;config.json&lt;/code&gt; 文件（参见&lt;a class="reference internal" href="https://blog.bgme.me/posts/2019/naiveproxy/#naiveproxy-4"&gt;创建 naiveproxy 配置文件&lt;/a&gt;）。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;在命令行界面，当前目录下运行 &lt;code class="docutils literal"&gt;./naive config.json&lt;/code&gt;。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;本地 1080 端口已经监听一个 socks5代理，仿照 Shadowsocks 使用该 socks5代理。&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
&lt;/section&gt;</description><category>naiveproxy</category><category>教程</category><category>梯子</category><guid>https://blog.bgme.me/posts/2019/naiveproxy/</guid><pubDate>Mon, 04 Feb 2019 11:46:08 GMT</pubDate></item></channel></rss>