mirror of
https://github.com/p4gefau1t/trojan-go.git
synced 2024-04-21 12:21:34 +00:00
deploy: fccba27a47
This commit is contained in:
@@ -89,6 +89,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<meta itemprop="name" content="使用API动态管理用户">
|
||||
<meta itemprop="description" content="注意,Trojan不支持这个特性 Trojan-Go使用gRPC提供了一组API,API支持以下功能: 用户信息增删改查 流量统计 速度统计 IP连接">
|
||||
|
||||
<meta itemprop="wordCount" content="738">
|
||||
<meta itemprop="wordCount" content="721">
|
||||
<meta itemprop="image" content="https://p4gefau1t.github.io/trojan-go/images/og-image.png"/>
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<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-shell" data-lang="shell">./trojan-go -api-addr 127.0.0.1:10000 -api list -add-profile -target-password password
|
||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">./trojan-go -api-addr 127.0.0.1:10000 -api set -add-profile -target-password password
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>删除一个用户信息</p>
|
||||
@@ -127,7 +127,7 @@
|
||||
</span><span style="color:#ae81ff"></span> -ip-limit <span style="color:#ae81ff">3</span> <span style="color:#ae81ff">\
|
||||
</span><span style="color:#ae81ff"></span> -upload-speed-limit <span style="color:#ae81ff">5242880</span> <span style="color:#ae81ff">\
|
||||
</span><span style="color:#ae81ff"></span> -download-speed-limit <span style="color:#ae81ff">5242880</span>
|
||||
</code></pre></div><p>这个命令将密码为password的用户上传和下载速度限制为5MiB/s,同时连接的IP数量限制为3个,注意这里5242880的单位是字节。如果不填写这些限制或填写0,则维持原状。如果填写负数,则表示不进行限制。</p>
|
||||
</code></pre></div><p>这个命令将密码为password的用户上传和下载速度限制为5MiB/s,同时连接的IP数量限制为3个,注意这里5242880的单位是字节。如果填写0或者负数,则表示不进行限制。</p>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="edit-meta">
|
||||
@@ -180,6 +180,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -400,6 +400,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -144,6 +144,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -82,7 +82,7 @@ iptables -t mangle -A PREROUTING -p udp -i $INTERFACE -j TROJAN_GO
|
||||
<span style="color:#75715e"># 添加路由,打上标记的包重新进入本地回环</span>
|
||||
ip route add local default dev lo table <span style="color:#ae81ff">100</span>
|
||||
ip rule add fwmark <span style="color:#ae81ff">1</span> lookup <span style="color:#ae81ff">100</span>
|
||||
</code></pre></div><p>配置完成后以root权限启动Trojan-Go客户端:</p>
|
||||
</code></pre></div><p>配置完成后<strong>以root权限启动</strong>Trojan-Go客户端:</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-shell" data-lang="shell">sudo trojan-go
|
||||
</code></pre></div><div class="edit-meta">
|
||||
|
||||
@@ -134,6 +134,7 @@ ip rule add fwmark <span style="color:#ae81ff">1</span> lookup <span style="colo
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -179,6 +179,7 @@ Trojan 的配置和通常配置方法无异,这里还是提供一份例子。
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -129,6 +129,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -159,6 +159,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<meta itemprop="name" content="使用Websocket进行CDN转发和抵抗中间人攻击">
|
||||
<meta itemprop="description" content="注意,Trojan不支持这个特性 Trojan-Go支持使用TLS+Websocket承载Trojan协议,使得利用CDN进行流量中转成为可能">
|
||||
|
||||
<meta itemprop="wordCount" content="706">
|
||||
<meta itemprop="wordCount" content="650">
|
||||
<meta itemprop="image" content="https://p4gefau1t.github.io/trojan-go/images/og-image.png"/>
|
||||
|
||||
|
||||
@@ -54,15 +54,15 @@
|
||||
<h3 id="注意trojan不支持这个特性">注意,Trojan不支持这个特性</h3>
|
||||
<p>Trojan-Go支持使用TLS+Websocket承载Trojan协议,使得利用CDN进行流量中转成为可能。</p>
|
||||
<p>Trojan协议本身不带加密,安全性依赖外层的TLS。但流量一旦经过CDN,TLS对CDN是透明的。其服务提供者可以对TLS的明文内容进行审查。<strong>如果你使用的是不可信任的CDN(任何在中国大陆注册备案的CDN服务均应被视为不可信任),请务必开启Shadowsocks AEAD对Webosocket流量进行加密,以避免遭到识别和审查。</strong></p>
|
||||
<p>服务器和客户端配置文件中同时添加websocket选项,并将其<code>enabled</code>字段设置为true,并填写<code>path</code>字段和<code>hostname</code>字段即可启用Websocket支持。下面是一个完整的Websocket选项:</p>
|
||||
<p>服务器和客户端配置文件中同时添加websocket选项,并将其<code>enabled</code>字段设置为true,并填写<code>path</code>字段和<code>host</code>字段即可启用Websocket支持。下面是一个完整的Websocket选项:</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:#e6db74">"websocket"</span><span style="color:#960050;background-color:#1e0010">:</span> {
|
||||
<span style="color:#f92672">"enabled"</span>: <span style="color:#66d9ef">true</span>,
|
||||
<span style="color:#f92672">"path"</span>: <span style="color:#e6db74">"/imaurlpath"</span>,
|
||||
<span style="color:#f92672">"hostname"</span>: <span style="color:#e6db74">"www.your_awesome_domain_name.com"</span>
|
||||
<span style="color:#f92672">"path"</span>: <span style="color:#e6db74">"/your-websocket-path"</span>,
|
||||
<span style="color:#f92672">"host"</span>: <span style="color:#e6db74">"example.com"</span>
|
||||
}
|
||||
</code></pre></div><p><code>hostname</code>是主机名,一般填写域名。客户端<code>hostname</code>是可选的,填写你的域名。如果留空,将会使用<code>remote_addr</code>填充,服务端必须填写<code>hostname</code>,Trojan-Go可以以此转发Websocket请求,以抵抗针对Websocket的主动检测。</p>
|
||||
</code></pre></div><p><code>host</code>是主机名,一般填写域名。客户端<code>host</code>是可选的,填写你的域名。如果留空,将会使用<code>remote_addr</code>填充。</p>
|
||||
<p><code>path</code>指的是websocket所在的URL路径,必须以斜杠("/")开始。路径并无特别要求,满足URL基本格式即可,但要保证客户端和服务端的<code>path</code>一致。<code>path</code>应当选择较长的字符串,以避免遭到GFW直接的主动探测。</p>
|
||||
<p>客户端的<code>hostname</code>将发送给CDN服务器,必须有效;服务端和客户端<code>path</code>必须一致,否则Websocket握手无法进行。</p>
|
||||
<p>客户端的<code>host</code>将包含在Websocket的握手HTTP请求中,发送给CDN服务器,必须有效;服务端和客户端<code>path</code>必须一致,否则Websocket握手无法进行。</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:#f92672">"run_type"</span>: <span style="color:#e6db74">"client"</span>,
|
||||
@@ -76,7 +76,7 @@
|
||||
<span style="color:#f92672">"websocket"</span>: {
|
||||
<span style="color:#f92672">"enabled"</span>: <span style="color:#66d9ef">true</span>,
|
||||
<span style="color:#f92672">"path"</span>: <span style="color:#e6db74">"/your-websocket-path"</span>,
|
||||
<span style="color:#f92672">"hostname"</span>: <span style="color:#e6db74">"www.your_awesome_domain_name.com"</span>
|
||||
<span style="color:#f92672">"host"</span>: <span style="color:#e6db74">"example.com"</span>
|
||||
},
|
||||
<span style="color:#f92672">"shadowsocks"</span>: {
|
||||
<span style="color:#f92672">"enabled"</span>: <span style="color:#66d9ef">true</span>,
|
||||
@@ -133,6 +133,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<meta itemprop="name" content="正确配置Trojan-Go">
|
||||
<meta itemprop="description" content="下面将介绍如何正确配置Trojan-Go以完全隐藏你的代理节点特征。 在开始之前,你需要 一个服务器,且未被GFW封锁 一个域名,可以使用免费的域">
|
||||
|
||||
<meta itemprop="wordCount" content="2021">
|
||||
<meta itemprop="wordCount" content="2029">
|
||||
<meta itemprop="image" content="https://p4gefau1t.github.io/trojan-go/images/og-image.png"/>
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<p>Trojan-Go,可以从release页面下载</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>证书密钥对,可以从letsencrpyt等机构免费申请签发</p>
|
||||
<p>证书和密钥,可以从letsencrpyt等机构免费申请签发</p>
|
||||
</li>
|
||||
</ul>
|
||||
<h3 id="服务端配置">服务端配置</h3>
|
||||
@@ -84,7 +84,6 @@
|
||||
<span style="color:#f92672">"ssl"</span>: {
|
||||
<span style="color:#f92672">"cert"</span>: <span style="color:#e6db74">"server.crt"</span>,
|
||||
<span style="color:#f92672">"key"</span>: <span style="color:#e6db74">"server.key"</span>,
|
||||
<span style="color:#f92672">"sni"</span>: <span style="color:#e6db74">"your-domain-name.com"</span>,
|
||||
<span style="color:#f92672">"fallback_port"</span>: <span style="color:#ae81ff">1234</span>
|
||||
}
|
||||
}
|
||||
@@ -98,7 +97,7 @@
|
||||
<p>如果TLS握手成功,并且被确认是Trojan协议头部,并且其中的密码正确,那么服务器将解析来自客户端的请求并进行代理,否则和上一步的处理方法相同。</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>如果TLS握手失败,说明对方使用的不是TLS协议进行连接。此时Trojan-Go将这个TCP连接代理到本地127.0.0.1:1234上运行的HTTPS服务,返回一个展示400 Bad Reqeust的HTTP页面。<code>fallback_port</code>是一个可选选项,如果没有填写,Trojan-Go会直接终止连接。虽然是可选的,但是还是强烈建议填写。</p>
|
||||
<p>如果TLS握手失败,说明对方使用的不是TLS协议进行连接。此时Trojan-Go将这个TCP连接代理到本地127.0.0.1:1234上运行的HTTPS服务(或者HTTP服务),返回一个展示400 Bad Reqeust的HTTP页面。<code>fallback_port</code>是一个可选选项,如果没有填写,Trojan-Go会直接终止连接。虽然是可选的,但是还是强烈建议填写。</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>你可以通过使用浏览器访问你的域名<code>https://your-domain-name.com</code>来验证。如果工作正常,你的浏览器会显示一个正常的HTTPS保护的Web页面,页面内容与服务器本机80端口上的页面一致。你还可以使用<code>http://your-domain-name.com:443</code>验证<code>fallback_port</code>工作是否正常。</p>
|
||||
@@ -177,6 +176,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<meta itemprop="name" content="完整的配置文件">
|
||||
<meta itemprop="description" content="下面是一个完整的配置文件,其中的必填选项有 run_type local_addr local_port remote_addr remote_port 对于服务器server,key和cert为必填。 对于客户端client,反向代理隧道fo">
|
||||
|
||||
<meta itemprop="wordCount" content="6706">
|
||||
<meta itemprop="wordCount" content="6755">
|
||||
<meta itemprop="image" content="https://p4gefau1t.github.io/trojan-go/images/og-image.png"/>
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<span style="color:#f92672">"log_file"</span>: <span style="color:#e6db74">""</span>,
|
||||
<span style="color:#f92672">"password"</span>: [],
|
||||
<span style="color:#f92672">"disable_http_check"</span>: <span style="color:#66d9ef">false</span>,
|
||||
<span style="color:#f92672">"udp_timeout"</span>: <span style="color:#ae81ff">10</span>,
|
||||
<span style="color:#f92672">"udp_timeout"</span>: <span style="color:#ae81ff">60</span>,
|
||||
<span style="color:#f92672">"ssl"</span>: {
|
||||
<span style="color:#f92672">"verify"</span>: <span style="color:#66d9ef">true</span>,
|
||||
<span style="color:#f92672">"verify_hostname"</span>: <span style="color:#66d9ef">true</span>,
|
||||
@@ -127,7 +127,7 @@
|
||||
<span style="color:#f92672">"websocket"</span>: {
|
||||
<span style="color:#f92672">"enabled"</span>: <span style="color:#66d9ef">false</span>,
|
||||
<span style="color:#f92672">"path"</span>: <span style="color:#e6db74">""</span>,
|
||||
<span style="color:#f92672">"hostname"</span>: <span style="color:#e6db74">""</span>
|
||||
<span style="color:#f92672">"host"</span>: <span style="color:#e6db74">""</span>
|
||||
},
|
||||
<span style="color:#f92672">"shadowsocks"</span>: {
|
||||
<span style="color:#f92672">"enabled"</span>: <span style="color:#66d9ef">false</span>,
|
||||
@@ -158,12 +158,6 @@
|
||||
<span style="color:#f92672">"password"</span>: <span style="color:#e6db74">""</span>,
|
||||
<span style="color:#f92672">"check_rate"</span>: <span style="color:#ae81ff">60</span>
|
||||
},
|
||||
<span style="color:#f92672">"redis"</span>: {
|
||||
<span style="color:#f92672">"enabled"</span>: <span style="color:#66d9ef">false</span>,
|
||||
<span style="color:#f92672">"server_addr"</span>: <span style="color:#e6db74">"localhost"</span>,
|
||||
<span style="color:#f92672">"server_port"</span>: <span style="color:#ae81ff">6379</span>,
|
||||
<span style="color:#f92672">"password"</span>: <span style="color:#e6db74">""</span>
|
||||
},
|
||||
<span style="color:#f92672">"api"</span>: {
|
||||
<span style="color:#f92672">"enabled"</span>: <span style="color:#66d9ef">false</span>,
|
||||
<span style="color:#f92672">"api_addr"</span>: <span style="color:#e6db74">""</span>,
|
||||
@@ -211,7 +205,7 @@
|
||||
<p><code>verify</code>表示客户端(client/nat/forward)是否校验服务端提供的证书合法性,默认开启。出于安全性考虑,这个选项不应该在实际场景中选择false,否则可能遭受中间人攻击。如果使用自签名或者自签发的证书,开启<code>verify</code>会导致校验失败。这种情况下,应当保持<code>verify</code>开启,然后在<code>cert</code>中填写服务端的证书,即可正常连接。</p>
|
||||
<p><code>verify_hostname</code>表示服务端是否校验客户端提供的SNI与服务端设置的一致性。如果服务端SNI字段留空,认证将被强制关闭。</p>
|
||||
<p>服务端必须填入<code>cert</code>和<code>key</code>,对应服务器的证书和私钥文件,请注意证书是否有效/过期。如果使用权威CA签发的证书,客户端(client/nat/forward)可以不填写<code>cert</code>。如果使用自签名或者自签发的证书,应当在的<code>cert</code>处填入服务器证书文件,否则可能导致校验失败。</p>
|
||||
<p><code>sni</code>指的是TLS客户端请求中的服务器名字段,一般和证书的Common Name相同。如果你使用let’sencrypt等机构签发的证书,这里填入你的域名。如果这一项未填,将使用<code>remote_addr</code>填充。你应当指定一个有效的SNI(和远端证书CN一致),否则客户端可能无法验证远端证书有效性从而无法连接。</p>
|
||||
<p><code>sni</code>指的是TLS客户端请求中的服务器名字段,一般和证书的Common Name相同。如果你使用let’sencrypt等机构签发的证书,这里填入你的域名。对于客户端,如果这一项未填,将使用<code>remote_addr</code>填充。你应当指定一个有效的SNI(和远端证书CN一致),否则客户端可能无法验证远端证书有效性从而无法连接;对于服务端,若此项不填,则使用证书中Common Name作为SNI校验依据,支持通配符如*.example.com。</p>
|
||||
<p><code>fingerprint</code>用于指定客户端TLS Client Hello指纹伪造类型,以抵抗GFW对于TLS Client Hello指纹的特征识别和阻断。trojan-go使用<a href="https://github.com/refraction-networking/utls">utls</a>进行指纹伪造,默认伪造Firefox的指纹。合法的值有</p>
|
||||
<ul>
|
||||
<li>
|
||||
@@ -286,9 +280,9 @@
|
||||
<p>Websocket传输是trojan-go的特性。在<strong>正常的直接连接代理节点</strong>的情况下,开启这个选项不会改善你的链路速度(甚至有可能下降),也不会提升你的连接安全性。你只应该在需要利用CDN进行中转,或利用nginx等服务器根据路径分发的情况下,使用websocket。</p>
|
||||
<p><code>enabled</code>表示是否启用Websocket承载流量,服务端开启后同时支持一般Trojan协议和基于websocket的Trojan协议,客户端开启后将只使用websocket承载所有Trojan协议流量。</p>
|
||||
<p><code>path</code>指的是Websocket使用的URL路径,必须以斜杠("/")开头,如”/longlongwebsocketpath”,并且服务器和客户端必须一致。</p>
|
||||
<p><code>hostname</code>Websocket握手时使用的主机名,客户端如果留空则使用<code>remote_addr</code>填充。如果使用了CDN,这个选项一般填入域名。不正确的<code>hostname</code>可能导致CDN无法转发请求。</p>
|
||||
<p><code>host</code>Websocket握手时,HTTP请求中使用的主机名。客户端如果留空则使用<code>remote_addr</code>填充。如果使用了CDN,这个选项一般填入域名。不正确的<code>host</code>可能导致CDN无法转发请求。</p>
|
||||
<h3 id="shadowsocks-aead加密选项"><code>shadowsocks</code> AEAD加密选项</h3>
|
||||
<p>此选项用于替代弃用的混淆加密和双重TLS。如果此选项被设置启用,Trojan协议层下将插入一层Shadowsocks AEAD加密层。也即(已经加密的)TLS隧道内,所有的Trojan协议将再使用AEAD加密。注意,此选项和Websocket是否开启无关。无论Websocket是否开启,所有Trojan流量都会被再进行一次加密。</p>
|
||||
<p>此选项用于替代弃用的混淆加密和双重TLS。如果此选项被设置启用,Trojan协议层下将插入一层Shadowsocks AEAD加密层。也即(已经加密的)TLS隧道内,所有的Trojan协议将再使用AEAD方法进行加密。注意,此选项和Websocket是否开启无关。无论Websocket是否开启,所有Trojan流量都会被再进行一次加密。</p>
|
||||
<p>注意,开启这个选项将有可能降低传输性能,你只应该在不信任承载Trojan协议的传输信道的情况下,启用这个选项。例如:</p>
|
||||
<ul>
|
||||
<li>
|
||||
@@ -343,11 +337,11 @@
|
||||
<p><code>keep_alive</code>是否启用TCP心跳存活检测。</p>
|
||||
<p><code>prefer_ipv4</code>是否优先使用IPv4地址。</p>
|
||||
<h3 id="mysql数据库选项"><code>mysql</code>数据库选项</h3>
|
||||
<p>trojan-go兼容trojan-gfw的基于mysql的用户管理方式,但更推荐的方式是使用API。</p>
|
||||
<p>trojan-go兼容trojan的基于mysql的用户管理方式,但更推荐的方式是使用API。</p>
|
||||
<p><code>enabled</code>表示是否启用mysql数据库进行用户验证。</p>
|
||||
<p><code>check_rate</code>是trojan-go从MySQL获取用户数据并更新缓存的间隔时间,单位为秒。</p>
|
||||
<p>其他选项可以顾名思义,不再赘述。</p>
|
||||
<p>users表结构和trojan-gfw版本定义一致,下面是一个创建users表的例子。注意这里的password指的是密码经过SHA224散列之后的值(字符串),流量download, upload, quota的单位是字节。你可以通过修改数据库users表中的用户记录的方式,添加和删除用户,或者指定用户的流量配额。trojan-go会根据所有的用户流量配额,自动更新当前有效的用户列表。如果download+upload>quota,trojan-go服务器将拒绝该用户的连接。</p>
|
||||
<p>users表结构和trojan版本定义一致,下面是一个创建users表的例子。注意这里的password指的是密码经过SHA224散列之后的值(字符串),流量download, upload, quota的单位是字节。你可以通过修改数据库users表中的用户记录的方式,添加和删除用户,或者指定用户的流量配额。trojan-go会根据所有的用户流量配额,自动更新当前有效的用户列表。如果download+upload>quota,trojan-go服务器将拒绝该用户的连接。</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-mysql" data-lang="mysql"><span style="color:#66d9ef">CREATE</span> <span style="color:#66d9ef">TABLE</span> <span style="color:#a6e22e">users</span> (
|
||||
id <span style="color:#66d9ef">INT</span> <span style="color:#66d9ef">UNSIGNED</span> <span style="color:#66d9ef">NOT</span> <span style="color:#66d9ef">NULL</span> <span style="color:#66d9ef">AUTO_INCREMENT</span>,
|
||||
username <span style="color:#66d9ef">VARCHAR</span>(<span style="color:#ae81ff">64</span>) <span style="color:#66d9ef">NOT</span> <span style="color:#66d9ef">NULL</span>,
|
||||
@@ -435,6 +429,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/simplesocks/">SimpleSocks协议</a></li>
|
||||
<li class="active"><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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -117,6 +117,7 @@ go build -tags <span style="color:#e6db74">"server mysql"</span> <span s
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -82,5 +82,14 @@
|
||||
<description>Trojan-Go鼓励开发传输层插件,以丰富协议类型,增加与GFW对抗的战略纵深。 传输层插件的作用,是替代tansport隧道的TLS进行传</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>URL方案(草案)</title>
|
||||
<link>https://p4gefau1t.github.io/trojan-go/developer/url/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://p4gefau1t.github.io/trojan-go/developer/url/</guid>
|
||||
<description>概述 感谢 @DuckSoft @StudentMain @phlinhng 对 Trojan-Go URL 方案的讨论和贡献。目前 URL 方案为草案,需要更多的实践和讨论。 Trojan-Go客户端可以接受URL,以定位服务器资源。原则</description>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
@@ -133,6 +133,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -265,6 +265,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<div class="edit-meta">
|
||||
|
||||
<br><a href="https://github.com/p4gefau1t/trojan-go/docs/edit/master/content/developer/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/developer/api/" title="API开发"><i class="fas fa-arrow-left" aria-hidden="true"></i> Prev - API开发</a>
|
||||
<a class="nav nav-next" href="https://p4gefau1t.github.io/trojan-go/developer/overview/" title="基本介绍">Next - 基本介绍 <i class="fas fa-arrow-right" aria-hidden="true"></i></a>
|
||||
<a class="nav nav-next" href="https://p4gefau1t.github.io/trojan-go/developer/url/" title="URL方案(草案)">Next - URL方案(草案) <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">
|
||||
@@ -134,6 +134,7 @@
|
||||
<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="active"><a href="https://p4gefau1t.github.io/trojan-go/developer/plugin/">可插拔传输层插件开发</a></li>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
<li class="active"><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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
<!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>URL方案(草案) - 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/developer/url/">
|
||||
<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="URL方案(草案)" />
|
||||
<meta property="og:description" content="概述 感谢 @DuckSoft @StudentMain @phlinhng 对 Trojan-Go URL 方案的讨论和贡献。目前 URL 方案为草案,需要更多的实践和讨论。 Trojan-Go客户端可以接受URL,以定位服务器资源。原则" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="https://p4gefau1t.github.io/trojan-go/developer/url/" />
|
||||
<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="URL方案(草案)"/>
|
||||
<meta name="twitter:description" content="概述 感谢 @DuckSoft @StudentMain @phlinhng 对 Trojan-Go URL 方案的讨论和贡献。目前 URL 方案为草案,需要更多的实践和讨论。 Trojan-Go客户端可以接受URL,以定位服务器资源。原则"/>
|
||||
<meta itemprop="name" content="URL方案(草案)">
|
||||
<meta itemprop="description" content="概述 感谢 @DuckSoft @StudentMain @phlinhng 对 Trojan-Go URL 方案的讨论和贡献。目前 URL 方案为草案,需要更多的实践和讨论。 Trojan-Go客户端可以接受URL,以定位服务器资源。原则">
|
||||
|
||||
<meta itemprop="wordCount" content="1276">
|
||||
<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>URL方案(草案)</h1>
|
||||
<h2 id="概述">概述</h2>
|
||||
<p>感谢 @DuckSoft @StudentMain @phlinhng 对 Trojan-Go URL 方案的讨论和贡献。<strong>目前 URL 方案为草案,需要更多的实践和讨论。</strong></p>
|
||||
<p>Trojan-Go<strong>客户端</strong>可以接受URL,以定位服务器资源。原则如下:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>遵守 URL 格式规范</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>保证人类可读,对机器友好</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>URL 的作用,是定位 Trojan-Go 节点资源,方便资源分享</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>需要注意,基于人类可读性的考虑,禁止将 base64 等编码数据嵌入 URL 中。首先, base64 编码不能保证传输安全,其意义在于在 ASCII 信道传输非 ASCII 数据。其次,如果需要保证分享URL时的传输安全,请对明文URL进行加密,而不是修改URL格式。</p>
|
||||
<h2 id="格式">格式</h2>
|
||||
<p>基本格式如下,<code>$()</code> 代表此处需要 <code>encodeURIComponent</code>。</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-text" data-lang="text">trojan-go://
|
||||
$(trojan-password)
|
||||
@
|
||||
trojan-host
|
||||
:
|
||||
port
|
||||
/?
|
||||
sni=$(tls-sni.com)&
|
||||
type=$(original|ws|h2|h2+ws)&
|
||||
host=$(websocket-host.com)&
|
||||
path=$(/websocket/path)&
|
||||
encryption=$(ss;aes-256-gcm;ss-password)&
|
||||
plugin=$(...)
|
||||
#$(descriptive-text)
|
||||
</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-text" data-lang="text">trojan-go://password1234@google.com/?sni=microsoft.com&type=ws&host=youtube.com&path=%2Fgo&encryption=ss%3Baes-256-gcm%3Bfuckgfw
|
||||
</code></pre></div><p>由于 Trojan-Go 兼容 Trojan,所以对于 Trojan 的 URL 方案</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-text" data-lang="text">trojan://password@remote_host:remote_port
|
||||
</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-text" data-lang="text">trojan-go://password@remote_host:remote_port
|
||||
</code></pre></div><p>需要注意的是,一旦服务器使用了非Trojan兼容的功能,必须使用<code>trojan-go://</code>定位服务器。这样设计的目的是使得 Trojan-Go 的 URL 不会被 Trojan 错误接受,避免污染 Trojan 用户的 URL 分享。同时,Trojan-Go 确保可以兼容接受 Trojan 的 URL。</p>
|
||||
<h2 id="详述">详述</h2>
|
||||
<p>注意:所有参数名和常数字符串均区分大小写。</p>
|
||||
<h3 id="trojan-password"><code>trojan-password</code></h3>
|
||||
<p>Trojan 的密码。
|
||||
不可省略,不能为空字符串,不建议含有非 ASCII 可打印字符。
|
||||
必须使用 <code>encodeURIComponent</code> 编码。</p>
|
||||
<h3 id="trojan-host"><code>trojan-host</code></h3>
|
||||
<p>节点 IP / 域名。
|
||||
不可省略,不能为空字符串。
|
||||
IPv6 地址必须扩方括号。
|
||||
IDN 域名(如“百度.cn”)必须使用 <code>xn--xxxxxx</code> 格式。</p>
|
||||
<h3 id="port"><code>port</code></h3>
|
||||
<p>节点端口。
|
||||
省略时默认为 <code>443</code>。
|
||||
必须取 <code>[1,65535]</code> 中的整数。</p>
|
||||
<h3 id="tls或allowinsecure"><code>tls</code>或<code>allowInsecure</code></h3>
|
||||
<p>没有这个字段。
|
||||
TLS 默认一直启用,除非有传输插件禁用它。
|
||||
TLS 认证必须开启。无法使用根CA校验服务器身份的节点,不适合分享。</p>
|
||||
<h3 id="sni"><code>sni</code></h3>
|
||||
<p>自定义 TLS 的 SNI。
|
||||
省略时默认与 <code>trojan-host</code> 同值。不得为空字符串。</p>
|
||||
<p>必须使用 <code>encodeURIComponent</code> 编码。</p>
|
||||
<h3 id="type"><code>type</code></h3>
|
||||
<p>传输类型。
|
||||
省略时默认为 <code>original</code>,但不可为空字符串。
|
||||
目前可选值只有 <code>original</code> 和 <code>ws</code>,未来可能会有 <code>h2</code>、<code>h2+ws</code> 等取值。</p>
|
||||
<p>当取值为 <code>original</code> 时,使用原始 Trojan 传输方式,无法方便通过 CDN。
|
||||
当取值为 <code>ws</code> 时,使用 Websocket over TLS 传输。</p>
|
||||
<h3 id="host"><code>host</code></h3>
|
||||
<p>自定义 HTTP <code>Host</code> 头。
|
||||
可以省略,省略时值同 <code>trojan-host</code>。
|
||||
可以为空字符串,但可能带来非预期情形。</p>
|
||||
<p>警告:若你的端口非标准端口(不是 80 / 443),RFC 标准规定 <code>Host</code> 应在主机名后附上端口号,例如 <code>example.com:44333</code>。至于是否遵守,请自行斟酌。</p>
|
||||
<p>必须使用 <code>encodeURIComponent</code> 编码。</p>
|
||||
<h3 id="path"><code>path</code></h3>
|
||||
<p>当传输类型 <code>type</code> 取 <code>ws</code>、<code>h2</code>、<code>h2+ws</code> 时,此项有效。
|
||||
不可省略,不可为空。
|
||||
必须以 <code>/</code> 开头。
|
||||
可以使用 URL 中的 <code>&</code> <code>#</code> <code>?</code> 等字符,但应当是合法的 URL 路径。</p>
|
||||
<p>必须使用 <code>encodeURIComponent</code> 编码。</p>
|
||||
<h3 id="mux"><code>mux</code></h3>
|
||||
<p>没有这个字段。
|
||||
当前服务器默认一直支持 <code>mux</code>。
|
||||
启用 <code>mux</code> 与否各有利弊,应由客户端决定自己是否启用。URL的作用,是定位服务器资源,而不是规定用户使用偏好。</p>
|
||||
<h3 id="encryption"><code>encryption</code></h3>
|
||||
<p>用于保证 Trojan 流量密码学安全的加密层。
|
||||
可省略,默认为 <code>none</code>,即不使用加密。
|
||||
不可以为空字符串。</p>
|
||||
<p>必须使用 encodeURIComponent 编码。</p>
|
||||
<p>使用 Shadowsocks 算法进行流量加密时,其格式为:</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-text" data-lang="text">ss;method;password
|
||||
</code></pre></div><p>其中 ss 是固定内容,method 是加密方法,必须为下列之一:</p>
|
||||
<ul>
|
||||
<li><code>aes-128-gcm</code></li>
|
||||
<li><code>aes-256-gcm</code></li>
|
||||
<li><code>chacha20-ietf-poly1305</code></li>
|
||||
</ul>
|
||||
<p>其中的 <code>password</code> 是 Shadowsocks 的密码,不得为空字符串。
|
||||
<code>password</code> 中若包含分号,不需要进行转义。
|
||||
<code>password</code> 应为英文可打印 ASCII 字符。</p>
|
||||
<p>其他加密方案待定。</p>
|
||||
<h3 id="plugin"><code>plugin</code></h3>
|
||||
<p>额外的插件选项。本字段保留。
|
||||
可省略,但不可以为空字符串。</p>
|
||||
<h3 id="url-fragment--后内容">URL Fragment (# 后内容)</h3>
|
||||
<p>节点说明。
|
||||
不建议省略,不建议为空字符串。</p>
|
||||
<p>必须使用 <code>encodeURIComponent</code> 编码。</p>
|
||||
<div class="edit-meta">
|
||||
|
||||
<br><a href="https://github.com/p4gefau1t/trojan-go/docs/edit/master/content/developer/url.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/developer/plugin/" title="可插拔传输层插件开发"><i class="fas fa-arrow-left" aria-hidden="true"></i> Prev - 可插拔传输层插件开发</a>
|
||||
<a class="nav nav-next" href="https://p4gefau1t.github.io/trojan-go/developer/overview/" title="基本介绍">Next - 基本介绍 <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=""><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=""><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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/advance/nat/">透明代理</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="parent"><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>
|
||||
<li class="active"><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</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>
|
||||
@@ -143,6 +143,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -199,5 +199,14 @@
|
||||
<description>Trojan-Go鼓励开发传输层插件,以丰富协议类型,增加与GFW对抗的战略纵深。 传输层插件的作用,是替代tansport隧道的TLS进行传</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>URL方案(草案)</title>
|
||||
<link>https://p4gefau1t.github.io/trojan-go/developer/url/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://p4gefau1t.github.io/trojan-go/developer/url/</guid>
|
||||
<description>概述 感谢 @DuckSoft @StudentMain @phlinhng 对 Trojan-Go URL 方案的讨论和贡献。目前 URL 方案为草案,需要更多的实践和讨论。 Trojan-Go客户端可以接受URL,以定位服务器资源。原则</description>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
@@ -102,6 +102,10 @@
|
||||
<loc>https://p4gefau1t.github.io/trojan-go/developer/plugin/</loc>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://p4gefau1t.github.io/trojan-go/developer/url/</loc>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://p4gefau1t.github.io/trojan-go/categories/</loc>
|
||||
</url>
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
<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>
|
||||
<li class=""><a href="https://p4gefau1t.github.io/trojan-go/developer/url/">URL方案(草案)</a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user