CINXE.COM

节点配置 | GOST v2

<!DOCTYPE html> <html lang="cn"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="节点配置"><meta property="og:title" content="节点配置" /> <meta property="og:description" content="逻辑分层 在GOST中一个代理服务逻辑上被分成两层:协议层(Protocol)和传输层(Transport),每层有若干可选的类型,两层之间相互独立,并可以任意组合使用。 当GOST去连接一个代理节点时,会先按照传输层设置的传输类型进行交互,当传输层建立以后,再按照协议层设置的协议类型进行交互。 协议类型(Protocols) 支持的协议类型有: http - HTTP http2 - HTTP2 socks4 - SOCKS4 (2.4&#43;) socks4a - SOCKS4A (2.4&#43;) socks5 - SOCKS5 ss - Shadowsocks ss2 - Shadowsocks with AEAD support (2.8&#43;) sni - SNI (2.5&#43;) forward - Forward relay - TCP/UDP relay (2.11&#43;) 传输类型(Transports) 支持的传输类型有: tcp - 原始TCP" /> <meta property="og:type" content="article" /> <meta property="og:url" content="/configuration/" /> <meta property="article:published_time" content="2017-11-16T16:50:24+08:00" /> <meta property="article:modified_time" content="2017-11-16T16:50:24+08:00" /> <title>节点配置 | GOST v2</title> <link rel="icon" href="/favicon.png" type="image/x-icon"> <link rel="stylesheet" href="/book.min.68d45956421753cdf6bcfc865ede445c56afc5bcaaebfe02961f44fe77d8f45a.css" integrity="sha256-aNRZVkIXU832vPyGXt5EXFavxbyq6/4Clh9E/nfY9Fo="> <script type="application/javascript"> var doNotTrack = false; if (!doNotTrack) { window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; ga('create', 'UA-98791308-2', 'auto'); ga('send', 'pageview'); } </script> <script async src='https://www.google-analytics.com/analytics.js'></script> <!-- Made with Book Theme https://github.com/alex-shpak/hugo-book --> </head> <body> <input type="checkbox" class="hidden" id="menu-control" /> <main class="flex container"> <aside class="book-menu fixed"> <nav> <h2 class="book-brand"> <a href="/"><span>GOST v2</span> </a> </h2> <ul> <li> <a href="/getting-started/" > 快速开始 </a> </li> <li> <a href="/configuration/" class="active"> 节点配置 </a> </li> <li> <a href="/http/" > HTTP(S) </a> </li> <li> <a href="/http2/" > HTTP2 </a> </li> <li> <a href="/probe_resist/" > 探测防御 </a> </li> <li> <a href="/socks/" > SOCKS </a> </li> <li> <a href="/ss/" > Shadowsocks </a> </li> <li> <a href="/sni/" > SNI </a> </li> <li> <a href="/tls/" > TLS </a> </li> <li> <a href="/ws/" > Websocket </a> </li> <li> <a href="/kcp/" > KCP </a> </li> <li> <a href="/quic/" > QUIC </a> </li> <li> <a href="/ssh/" > SSH </a> </li> <li> <a href="/simple-obfs/" > Simple-obfs </a> </li> <li> <a href="/obfs4/" > Obfs4 </a> </li> <li> <a href="/redirect/" > 透明代理 </a> </li> <li> <a href="/port-forwarding/" > 端口转发 </a> </li> <li> <a href="/relay/" > Relay </a> </li> <li> <a href="/permission/" > 权限控制 </a> </li> <li> <a href="/load-balancing/" > 负载均衡 </a> </li> <li> <a href="/bypass/" > 路由控制 </a> </li> <li> <a href="/resolver/" > DNS解析 </a> </li> <li> <a href="/dns/" > DNS代理 </a> </li> <li> <a href="/tuntap/" > TUN/TAP设备 </a> </li> </ul> </nav> <script> (function() { var menu = document.querySelector("aside.book-menu nav"); addEventListener("beforeunload", function(event) { localStorage.setItem("menu.scrollTop", menu.scrollTop); }); menu.scrollTop = localStorage.getItem("menu.scrollTop"); })(); </script> </aside> <div class="book-page"> <header class="flex align-center justify-between book-header"> <label for="menu-control"> <img src="/svg/menu.svg" class="book-icon" alt="Menu" /> </label> <strong>节点配置</strong> </header> <article class="markdown"><blockquote class="book-hint info"> <p><strong>逻辑分层</strong></p> <p>在GOST中一个代理服务逻辑上被分成两层:协议层(Protocol)和传输层(Transport),每层有若干可选的类型,两层之间相互独立,并可以任意组合使用。</p> </blockquote> <p>当GOST去连接一个代理节点时,会先按照传输层设置的传输类型进行交互,当传输层建立以后,再按照协议层设置的协议类型进行交互。</p> <h2 id="protocols">协议类型(Protocols)</h2> <p>支持的协议类型有:</p> <ul> <li> <p><code>http</code> - HTTP</p> </li> <li> <p><code>http2</code> - HTTP2</p> </li> <li> <p><code>socks4</code> - SOCKS4 (2.4+)</p> </li> <li> <p><code>socks4a</code> - SOCKS4A (2.4+)</p> </li> <li> <p><code>socks5</code> - SOCKS5</p> </li> <li> <p><code>ss</code> - Shadowsocks</p> </li> <li> <p><code>ss2</code> - Shadowsocks with AEAD support (2.8+)</p> </li> <li> <p><code>sni</code> - SNI (2.5+)</p> </li> <li> <p><code>forward</code> - Forward</p> </li> <li> <p><code>relay</code> - TCP/UDP relay (2.11+)</p> </li> </ul> <h2 id="transports">传输类型(Transports)</h2> <p>支持的传输类型有:</p> <ul> <li> <p><code>tcp</code> - 原始TCP</p> </li> <li> <p><code>tls</code> - TLS</p> </li> <li> <p><code>mtls</code> - Multiplex TLS,在TLS上增加多路复用功能 (2.5+)</p> </li> <li> <p><code>ws</code> - Websocket</p> </li> <li> <p><code>mws</code> - Multiplex Websocket,在Websocket上增加多路复用功能 (2.5+)</p> </li> <li> <p><code>wss</code> - Websocket Secure,基于TLS加密的Websocket</p> </li> <li> <p><code>mwss</code> - Multiplex Websocket Secure,在基于TLS加密的Websocket上增加多路复用功能 (2.5+)</p> </li> <li> <p><code>kcp</code> - KCP (2.3+)</p> </li> <li> <p><code>quic</code> - QUIC (2.4+)</p> </li> <li> <p><code>ssh</code> - SSH (2.4+)</p> </li> <li> <p><code>h2</code> - HTTP2 (2.4+)</p> </li> <li> <p><code>h2c</code> - HTTP2 Cleartext (2.4+)</p> </li> <li> <p><code>obfs4</code> - OBFS4 (2.4+)</p> </li> <li> <p><code>ohttp</code> - HTTP Obfuscation (2.7+)</p> </li> <li> <p><code>otls</code> - TLS Obfuscation (2.11+)</p> </li> </ul> <h2 id="heading">配置格式</h2> <p>端口转发相关的节点配置格式请参考<a href="/port-forwarding/">端口转发</a>。</p> <p>在GOST中节点的配置为类URL格式(适用于<code>-L</code>和<code>-F</code>参数):</p> <pre><code>[scheme://][user:pass@host]:port[?param1=value1&amp;param2=value2] </code></pre><h3 id="scheme"><strong>scheme</strong></h3> <p><code>scheme</code>可以是单独的协议类型或传输类型,或是二者的组合,也可以是空。</p> <h4 id="heading-1">不指定任何类型</h4> <p>传输层默认为是原始TCP类型。</p> <p>对于<code>-L</code>参数,协议层默认为是HTTP &amp; SOCKS5,对于<code>-F</code>参数,协议层默认为是HTTP类型。</p> <pre><code>gost -L :8080 -F :8888 </code></pre><h4 id="heading-2">仅指定协议类型</h4> <p>当仅指定协议类型时,传输层默认为原始TCP类型。</p> <pre><code>gost -L http://:8080 -F socks5://:1080 </code></pre><h4 id="heading-3">仅指定传输类型</h4> <p>当仅指定传输类型时,对于<code>-L</code>参数,协议类型默认为HTTP+SOCKS5。对于<code>-F</code>参数,协议层默认为是HTTP类型。</p> <pre><code>gost -L tls://:443 -F ws://:1443 </code></pre><h4 id="heading-4">组合使用</h4> <pre><code>gost -L http+tls://:443 -F socks5+wss://:1443 </code></pre><h4 id="schemes">特殊的schemes</h4> <p>除了上述的类型外,有几个比较特殊的shemes:</p> <ul> <li> <p><code>https</code> - 简写形式,等同于<code>http+tls</code></p> </li> <li> <p><code>redirect</code> - TCP透明代理 (2.3+)</p> </li> </ul> <pre><code>gost -L redirect://:12345 </code></pre><ul> <li><code>ssu</code> - Shadowsocks UDP relay</li> </ul> <pre><code>gost -L ssu://chacha20:123456@:8338 </code></pre><h3 id="heading-5"><strong>节点认证</strong></h3> <h4 id="userpass">user:pass</h4> <p>通过<code>user:pass</code>指定服务的认证信息。对于shadowsocks,<code>user</code>为加密类型。</p> <pre><code>gost -L admin:123456@:8080 -F ss://chacha20:123456@:8338 </code></pre><h4 id="auth-292">auth参数 (2.9.2+)</h4> <p>如果认证信息中包含特殊字符,则可以通过<code>auth</code>参数来设置:</p> <pre><code>gost -L :8080?auth=YWRtaW46MTIzNDU2 -F ss://:8338?auth=Y2hhY2hhMjA6QWEjJiEkMTIzNEA1Njc4 </code></pre><p><code>auth</code>的值为<code>user:pass</code>base64编码值</p> <h4 id="secrets">secrets参数</h4> <p>也可以通过<code>secrets</code>参数来设定多组认证信息:</p> <pre><code>gost -L=:8080?secrets=secrets.txt </code></pre><p>secrets.txt文件格式为按行分割的认证信息,每一行认证信息为用空格分割的user-pass对,以 <code>#</code> 开始的行为注释行。</p> <pre><code># period for live reloading reload 10s # username password admin #123456 test\user001 123456 test.user@002 12345678 </code></pre><p><code>reload</code> - 此配置文件支持热更新。此选项用来指定文件检查周期,默认关闭热更新。</p> <p><strong>注意:</strong> 当<code>secrets</code>参数用于shadowsocks协议时,仅会使用第一项作为认证信息。</p> <blockquote class="book-hint warning"> 所有的认证信息都是用于协议层(Protocol)。 </blockquote> </article> <div class="book-footer justify-between"> <div class="book-languages"> <ul> <li class="flex"> <img src="/svg/translate.svg" class="book-icon" alt="Languages" /> Chinese </li> </ul> <ul class="book-languages-list"> <li class="active"> <a href="/" class="flex"> <img src="/svg/translate.svg" class="book-icon" alt="Languages" /> Chinese </a> </li> <li class=""> <a href="/en/configuration/" class="flex"> <img src="/svg/translate.svg" class="book-icon" alt="Languages" /> English </a> </li> </ul> </div> </div> </div> </main> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10