Files
trojan-go/advance/plugin/index.html
T
2020-06-22 12:06:09 +00:00

155 lines
11 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>使用Shadowsocks插件/可插拔传输层 - Trojan-Go Docs</title>
<meta name="description" content="An unidentifiable mechanism that helps you bypass GFW.">
<meta name="generator" content="Hugo 0.69.2" />
<link href="https://p4gefau1t.github.io/trojan-goindex.xml" rel="alternate" type="application/rss+xml">
<link rel="canonical" href="https://p4gefau1t.github.io/trojan-go/advance/plugin/">
<link rel="stylesheet" href="https://p4gefau1t.github.io/trojan-go/css/theme.min.css">
<script src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<link rel="stylesheet" href="https://p4gefau1t.github.io/trojan-go/css/chroma.min.css">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.easing@1.4.1/jquery.easing.min.js"></script>
<script src="https://p4gefau1t.github.io/trojan-go/js/bundle.js"></script><style>
:root {}
</style>
<meta property="og:title" content="使用Shadowsocks插件/可插拔传输层" />
<meta property="og:description" content="注意,Trojan-GFW版本不支持这个特性 Trojan-Go支持可插拔的传输层。原则上,Trojan-Go可以使用任何有TCP隧道功能的软" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://p4gefau1t.github.io/trojan-go/advance/plugin/" />
<meta property="og:image" content="https://p4gefau1t.github.io/trojan-go/images/og-image.png"/>
<meta property="og:site_name" content="Trojan-Go Docs" />
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="https://p4gefau1t.github.io/trojan-go/images/og-image.png"/>
<meta name="twitter:title" content="使用Shadowsocks插件/可插拔传输层"/>
<meta name="twitter:description" content="注意,Trojan-GFW版本不支持这个特性 Trojan-Go支持可插拔的传输层。原则上,Trojan-Go可以使用任何有TCP隧道功能的软"/>
<meta itemprop="name" content="使用Shadowsocks插件/可插拔传输层">
<meta itemprop="description" content="注意,Trojan-GFW版本不支持这个特性 Trojan-Go支持可插拔的传输层。原则上,Trojan-Go可以使用任何有TCP隧道功能的软">
<meta itemprop="wordCount" content="906">
<meta itemprop="image" content="https://p4gefau1t.github.io/trojan-go/images/og-image.png"/>
<meta itemprop="keywords" content="" /></head>
<body><div class="container"><header>
<h1>Trojan-Go Docs</h1>
<a href="https://github.com/p4gefau1t/trojan-go" class="github"><i class="fab fa-github"></i></a>
<p class="description">An unidentifiable mechanism that helps you bypass GFW.</p>
</header>
<div class="global-menu">
<nav>
<ul>
<li><a href="/trojan-go/">Home</a></li>
<li><a href="https://github.com/p4gefau1t">GitHub</a></li></ul>
</nav>
</div>
<div class="content-container">
<main><h1>使用Shadowsocks插件/可插拔传输层</h1>
<h3 id="注意trojan-gfw版本不支持这个特性">注意,Trojan-GFW版本不支持这个特性</h3>
<p>Trojan-Go支持可插拔的传输层。原则上,Trojan-Go可以使用任何有TCP隧道功能的软件作为传输层,如v2ray、shadowsocks、kcp等。同时,Trojan-Go也兼容Shadowsocks的SIP003插件标准,如GoQuietv2ray-plugin等。也可以使用Tor的传输层插件,如obfs4,meek等。</p>
<p>你可以使用这些插件,替换Trojan-Go的TLS传输层。</p>
<p>开启可插拔传输层插件后,Trojan-Go客户端将会把<strong>流量明文</strong>直接传输给客户端本地的插件处理。由客户端插件负责进行加密和混淆,并将流量传输给服务端的插件。服务端的插件接收到流量,进行解密和解析,将<strong>流量明文</strong>传输给服务端本地的Trojan-Go服务端。</p>
<p>你可以使用任何插件对流量进行加密和混淆,只需添加&quot;transport_plugin&quot;选项,并指定插件的可执行文件的路径,并做好配置即可。</p>
<p>我们更建议<strong>自行设计协议并开发相应插件</strong>。因为目前现有的所有插件无法对接Trojan-Go的对抗主动探测的特性,而且部分插件并无加密能力。如果你对开发插件有兴趣,欢迎在&quot;实现细节和开发指南&quot;一节中查看插件设计的指南。</p>
<p>例如,可以使用符合SIP003标准的v2ray-plugin,下面是一个例子:</p>
<p><strong>这个配置中使用了websocket明文传输未经加密的trojan协议,存在安全隐患。这个配置仅作为演示使用。</strong></p>
<p><strong>不要在任何情况下使用这个配置穿透GFW。</strong></p>
<p>服务端配置:</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-json" data-lang="json"><span style="color:#960050;background-color:#1e0010">...(省略)</span>
<span style="color:#e6db74">&#34;transport_plugin&#34;</span><span style="color:#960050;background-color:#1e0010">:</span> {
<span style="color:#f92672">&#34;enabled&#34;</span>: <span style="color:#66d9ef">true</span>,
<span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;shadowsocks&#34;</span>,
<span style="color:#f92672">&#34;command&#34;</span>: <span style="color:#e6db74">&#34;./v2ray-plugin&#34;</span>,
<span style="color:#f92672">&#34;arg&#34;</span>: [<span style="color:#e6db74">&#34;-server&#34;</span>, <span style="color:#e6db74">&#34;-host&#34;</span>, <span style="color:#e6db74">&#34;www.baidu.com&#34;</span>]
}
</code></pre></div><p>客户端配置:</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-json" data-lang="json"><span style="color:#960050;background-color:#1e0010">...(省略)</span>
<span style="color:#e6db74">&#34;transport_plugin&#34;</span><span style="color:#960050;background-color:#1e0010">:</span> {
<span style="color:#f92672">&#34;enabled&#34;</span>: <span style="color:#66d9ef">true</span>,
<span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;shadowsocks&#34;</span>,
<span style="color:#f92672">&#34;command&#34;</span>: <span style="color:#e6db74">&#34;./v2ray-plugin&#34;</span>,
<span style="color:#f92672">&#34;arg&#34;</span>: [<span style="color:#e6db74">&#34;-host&#34;</span>, <span style="color:#e6db74">&#34;www.baidu.com&#34;</span>]
}
</code></pre></div><p>注意,v2ray-plugin插件需要指定<code>-server</code>参数来区分客户端和服务端。更多关于该插件详细的说明,参考v2ray-plugin的文档。</p>
<p>启动Trojan-Go后,你可以看到v2ray-plugin启动的输出。插件将把流量伪装为Websocket流量并传输。</p>
<p>非SIP003标准的插件可能需要不同的配置,你可以指定<code>type</code>&quot;other&rdquo;,并自行指定插件地址,插件启动参数、环境变量。</p>
<div class="edit-meta">
<br><a href="https://github.com/p4gefau1t/trojan-go/docs/edit/master/content/advance/plugin.md" class="edit-page"><i class="fas fa-pen-square"></i> Edit on GitHub</a></div><nav class="pagination"><a class="nav nav-prev" href="https://p4gefau1t.github.io/trojan-go/advance/nginx-relay/" title="一种基于SNI代理的多路径分流中继方案"><i class="fas fa-arrow-left" aria-hidden="true"></i> Prev - 一种基于SNI代理的多路径分流中继方案</a>
<a class="nav nav-next" href="https://p4gefau1t.github.io/trojan-go/advance/aead/" title="使用Shadowsocks AEAD进行二次加密">Next - 使用Shadowsocks AEAD进行二次加密 <i class="fas fa-arrow-right" aria-hidden="true"></i></a>
</nav><footer><p class="powered">Powered by <a href="https://gohugo.io">Hugo</a>. Theme by <a href="https://themes.gohugo.io/hugo-theme-techdoc/">TechDoc</a>. Designed by <a href="https://github.com/thingsym/hugo-theme-techdoc">Thingsym</a>.</p>
</footer>
</main><div class="sidebar">
<nav class="open-menu">
<ul>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go">Home</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/basic/">基本配置</a>
<ul class="sub-menu">
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/basic/trojan/">Trojan基本原理</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/basic/config/">正确配置Trojan-Go</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/basic/full-config/">完整的配置文件</a></li>
</ul>
</li>
<li class="parent"><a href="https://p4gefau1t.github.io/trojan-go/advance/">高级配置</a>
<ul class="sub-menu">
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/advance/mux/">启用多路复用提升网络并发性能</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/advance/websocket/">使用Websocket进行CDN转发和抵抗中间人攻击</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/advance/router/">国内直连和广告屏蔽</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/advance/forward/">隧道和反向代理</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/advance/nginx-relay/">一种基于SNI代理的多路径分流中继方案</a></li>
<li class="active"><a href="https://p4gefau1t.github.io/trojan-go/advance/plugin/">使用Shadowsocks插件/可插拔传输层</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/advance/aead/">使用Shadowsocks AEAD进行二次加密</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/advance/customize-protocol-stack/">自定义协议栈</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/advance/api/">使用API动态管理用户</a></li>
</ul>
</li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/">实现细节和开发指南</a>
<ul class="sub-menu">
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/overview/">基本介绍</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/build/">编译和自定义Trojan-Go</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/trojan/">Trojan协议</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/mux/">多路复用</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/websocket/">Websocket</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/simplesocks/">SimpleSocks协议</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/api/">API开发</a></li>
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/plugin/">可插拔传输层插件开发</a></li>
</ul>
</li>
</ul>
</nav>
<div class="sidebar-footer"></div>
</div>
</div><a href="#" id="backtothetop-fixed" class="backtothetop"
data-backtothetop-duration="600"
data-backtothetop-easing="easeOutQuart"
data-backtothetop-fixed-fadeIn="1000"
data-backtothetop-fixed-fadeOut="1000"
data-backtothetop-fixed-bottom="10"
data-backtothetop-fixed-right="20">
<span class="fa-layers fa-fw">
<i class="fas fa-circle"></i>
<i class="fas fa-arrow-circle-up"></i>
</span></a>
</div>
</body>
</html>