Convert Figma logo to code with AI

ginuerzh logogost

GO Simple Tunnel - a simple tunnel written in golang

15,747
2,458
15,747
269

Top Related Projects

A Rust port of shadowsocks

A platform for building proxies to bypass network restrictions.

18,819

An unidentifiable mechanism that helps you bypass GFW.

13,863

A Quantum-Safe Secure Tunnel based on QPP, KCP, FEC, and N:M multiplexing.

Go实现的Trojan代理,支持多路复用/路由功能/CDN中转/Shadowsocks混淆插件,多平台,无依赖。A Trojan proxy written in Go. An unidentifiable mechanism that helps you bypass GFW. https://p4gefau1t.github.io/trojan-go/

24,231

Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.

Quick Overview

GOST is a versatile and powerful proxy solution written in Go. It supports multiple protocols and encryption methods, making it suitable for various network environments and security requirements. GOST can be used as a standalone proxy server or integrated into other applications.

Pros

  • Supports multiple protocols (HTTP, SOCKS4, SOCKS5, Shadowsocks, etc.)
  • Offers strong encryption and security features
  • Highly configurable and customizable
  • Cross-platform compatibility (Windows, Linux, macOS)

Cons

  • Documentation is primarily in Chinese, which may be challenging for non-Chinese speakers
  • Steep learning curve due to its extensive feature set
  • May require additional setup for advanced configurations
  • Limited community support compared to more mainstream proxy solutions

Getting Started

To get started with GOST, follow these steps:

  1. Download the latest release from the GitHub releases page.
  2. Extract the archive and navigate to the extracted directory.
  3. Run GOST with a basic configuration:
./gost -L=:8080

This command starts a GOST server listening on port 8080 with default settings.

For more advanced configurations, you can use command-line flags or a configuration file. Here's an example of running GOST with multiple listeners and a chain:

./gost -L=http://:8080 -L=socks5://:1080 -F=ss://aes-128-cfb:password@example.com:8338

This command sets up an HTTP proxy on port 8080, a SOCKS5 proxy on port 1080, and forwards traffic through a Shadowsocks server.

For detailed usage instructions and configuration options, refer to the GOST documentation.

Competitor Comparisons

A Rust port of shadowsocks

Pros of shadowsocks-rust

  • Written in Rust, offering better performance and memory safety
  • More focused on the Shadowsocks protocol, potentially providing better optimization
  • Active development with frequent updates and bug fixes

Cons of shadowsocks-rust

  • Limited to Shadowsocks protocol, less versatile compared to gost's multi-protocol support
  • May have a steeper learning curve for users not familiar with Rust
  • Fewer built-in features compared to gost's comprehensive toolset

Code Comparison

shadowsocks-rust:

let server = ShadowsocksServer::new(config)?;
server.run().await?;

gost:

ln, err := gost.TCPListener(node.Addr)
if err != nil {
    return err
}
h := gost.NewServer(handler, ln)

Both projects use concise code for server setup, but gost offers more flexibility in protocol selection and handling.

A platform for building proxies to bypass network restrictions.

Pros of v2ray-core

  • More comprehensive protocol support, including VMess, VLESS, and Trojan
  • Advanced routing capabilities with flexible rule-based traffic routing
  • Better documentation and community support

Cons of v2ray-core

  • More complex configuration and setup process
  • Higher resource consumption due to its extensive feature set
  • Steeper learning curve for new users

Code Comparison

v2ray-core configuration example:

{
  "inbounds": [{
    "port": 1080,
    "protocol": "socks",
    "settings": {
      "auth": "noauth"
    }
  }],
  "outbounds": [{
    "protocol": "freedom"
  }]
}

gost configuration example:

gost -L=:8080 -F=ss://method:password@host:port

Key Differences

  • gost is more lightweight and easier to set up for simple proxy scenarios
  • v2ray-core offers more advanced features and customization options
  • gost focuses on simplicity and ease of use, while v2ray-core prioritizes flexibility and security

Use Cases

  • gost: Quick and simple proxy setup for basic needs
  • v2ray-core: Complex network environments requiring advanced routing and protocol support

Community and Development

  • v2ray-core has a larger and more active community
  • gost has fewer contributors but maintains a focused development approach
18,819

An unidentifiable mechanism that helps you bypass GFW.

Pros of Trojan

  • Designed specifically for censorship circumvention, offering better obfuscation
  • Simpler configuration and setup process
  • Lighter resource usage, especially on low-end devices

Cons of Trojan

  • Less versatile, primarily focused on proxy functionality
  • Smaller community and fewer third-party implementations
  • Limited protocol support compared to GOST's multi-protocol approach

Code Comparison

Trojan (server configuration):

{
    "run_type": "server",
    "local_addr": "0.0.0.0",
    "local_port": 443,
    "remote_addr": "127.0.0.1",
    "remote_port": 80,
    "password": ["password1"],
    "ssl": {
        "cert": "/path/to/certificate.crt",
        "key": "/path/to/private.key"
    }
}

GOST (server configuration):

gost -L=ss://chacha20:password@:8338

Trojan focuses on a specific proxy implementation with a more detailed configuration, while GOST offers a concise command-line interface for various protocols. Trojan's configuration is JSON-based, providing clear structure, whereas GOST uses a more compact string-based format for quick setup.

Both projects serve as proxy tools, but Trojan is tailored for censorship bypass, while GOST offers a broader range of networking capabilities. The choice between them depends on specific use cases and required features.

13,863

A Quantum-Safe Secure Tunnel based on QPP, KCP, FEC, and N:M multiplexing.

Pros of kcptun

  • Focuses specifically on KCP protocol optimization, potentially offering better performance for certain use cases
  • Simpler setup and configuration for basic KCP tunneling needs
  • Lighter weight and more specialized than the broader feature set of gost

Cons of kcptun

  • Limited to KCP protocol, while gost supports multiple protocols and transport methods
  • Lacks the extensive proxy chaining and routing capabilities provided by gost
  • May require additional tools or configurations for more complex networking scenarios

Code Comparison

kcptun (client configuration):

kcptun_client := &KCPClient{
    RemoteAddr: "server_ip:port",
    Key:        "your_encryption_key",
    Mode:       "fast2",
    Conn:       4,
}

gost (similar functionality):

gost.Run(
    "kcp://server_ip:port?crypt=aes&key=your_encryption_key&mode=fast2",
    "socks5://:1080",
)

Both projects aim to improve network performance and security, but gost offers a more comprehensive solution with support for various protocols and advanced features, while kcptun specializes in optimizing KCP connections.

Go实现的Trojan代理,支持多路复用/路由功能/CDN中转/Shadowsocks混淆插件,多平台,无依赖。A Trojan proxy written in Go. An unidentifiable mechanism that helps you bypass GFW. https://p4gefau1t.github.io/trojan-go/

Pros of trojan-go

  • Focuses specifically on the Trojan protocol, offering optimized performance for this use case
  • Includes built-in support for WebSocket and other transport layers
  • Provides a user-friendly web-based management interface

Cons of trojan-go

  • More limited in protocol support compared to gost's multi-protocol capabilities
  • May have a steeper learning curve for users not familiar with Trojan protocol
  • Less frequent updates and potentially smaller community compared to gost

Code Comparison

trojan-go configuration example:

{
  "run_type": "server",
  "local_addr": "0.0.0.0",
  "local_port": 443,
  "remote_addr": "127.0.0.1",
  "remote_port": 80,
  "password": ["your_password"]
}

gost configuration example:

gost -L=ss://chacha20:your_password@:8338 \
     -L=socks5://:1080 \
     -F=ss+wss://chacha20:your_password@example.com:443

Both projects aim to provide secure proxy solutions, but they differ in their approach and focus. trojan-go specializes in the Trojan protocol, while gost offers a wider range of protocols and more flexibility in configuration. The choice between them depends on specific use cases and user preferences.

24,231

Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.

Pros of Xray-core

  • More advanced protocol support, including VLESS and XTLS
  • Better performance and lower latency due to optimized core
  • Active development with frequent updates and improvements

Cons of Xray-core

  • Steeper learning curve due to more complex configuration options
  • Less versatile in terms of supported proxy types compared to gost

Code Comparison

Xray-core configuration example:

{
  "inbounds": [{
    "port": 10086,
    "protocol": "vmess",
    "settings": {
      "clients": [{ "id": "b831381d-6324-4d53-ad4f-8cda48b30811" }]
    }
  }],
  "outbounds": [{ "protocol": "freedom" }]
}

gost configuration example:

gost -L=:8080 -F=ss://method:password@1.2.3.4:8338

Summary

Xray-core offers more advanced features and better performance, making it suitable for users who require cutting-edge proxy technologies. However, it may be more challenging to set up and use compared to gost. gost, on the other hand, provides a simpler configuration and a wider range of proxy types, making it more versatile for general use cases. The choice between the two depends on specific requirements and user expertise.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

GO Simple Tunnel

GO语言实现的安全隧道

GoDoc Go Report Card codecov GitHub release Docker gost

English README

!!!V3版本已经可用,欢迎抢先体验!!!

特性

Wiki站点: v2.gost.run

Telegram讨论群: https://t.me/gogost

Google讨论组: https://groups.google.com/d/forum/go-gost

安装

二进制文件

https://github.com/ginuerzh/gost/releases

源码编译

git clone https://github.com/ginuerzh/gost.git
cd gost/cmd/gost
go build

Docker

docker run --rm ginuerzh/gost -V

Homebrew

brew install gost

Ubuntu商店

sudo snap install core
sudo snap install gost

快速上手

不设置转发代理

  • 作为标准HTTP/SOCKS5代理
gost -L=:8080
  • 设置代理认证信息
gost -L=admin:123456@localhost:8080
  • 多端口监听
gost -L=http2://:443 -L=socks5://:1080 -L=ss://aes-128-cfb:123456@:8338

设置转发代理

gost -L=:8080 -F=192.168.1.1:8081
  • 转发代理认证
gost -L=:8080 -F=http://admin:123456@192.168.1.1:8081

设置多级转发代理(代理链)

gost -L=:8080 -F=quic://192.168.1.1:6121 -F=socks5+wss://192.168.1.2:1080 -F=http2://192.168.1.3:443 ... -F=a.b.c.d:NNNN

gost按照-F设置的顺序通过代理链将请求最终转发给a.b.c.d:NNNN处理,每一个转发代理可以是任意HTTP/HTTPS/HTTP2/SOCKS4/SOCKS5/Shadowsocks类型代理。

本地端口转发(TCP)

gost -L=tcp://:2222/192.168.1.1:22 [-F=...]

将本地TCP端口2222上的数据(通过代理链)转发到192.168.1.1:22上。当代理链末端(最后一个-F参数)为SSH转发通道类型时,gost会直接使用SSH的本地端口转发功能:

gost -L=tcp://:2222/192.168.1.1:22 -F forward+ssh://:2222

本地端口转发(UDP)

gost -L=udp://:5353/192.168.1.1:53?ttl=60 [-F=...]

将本地UDP端口5353上的数据(通过代理链)转发到192.168.1.1:53上。 每条转发通道都有超时时间,当超过此时间,且在此时间段内无任何数据交互,则此通道将关闭。可以通过ttl参数来设置超时时间,默认值为60秒。

注: 转发UDP数据时,如果有代理链,则代理链的末端(最后一个-F参数)必须是gost SOCKS5类型代理,gost会使用UDP over TCP方式进行转发。

远程端口转发(TCP)

gost -L=rtcp://:2222/192.168.1.1:22 [-F=... -F=socks5://172.24.10.1:1080]

将172.24.10.1:2222上的数据(通过代理链)转发到192.168.1.1:22上。当代理链末端(最后一个-F参数)为SSH转发通道类型时,gost会直接使用SSH的远程端口转发功能:

gost -L=rtcp://:2222/192.168.1.1:22 -F forward+ssh://:2222

远程端口转发(UDP)

gost -L=rudp://:5353/192.168.1.1:53?ttl=60 [-F=... -F=socks5://172.24.10.1:1080]

将172.24.10.1:5353上的数据(通过代理链)转发到192.168.1.1:53上。 每条转发通道都有超时时间,当超过此时间,且在此时间段内无任何数据交互,则此通道将关闭。可以通过ttl参数来设置超时时间,默认值为60秒。

注: 转发UDP数据时,如果有代理链,则代理链的末端(最后一个-F参数)必须是GOST SOCKS5类型代理,gost会使用UDP-over-TCP方式进行转发。

HTTP2

gost的HTTP2支持两种模式:

  • 作为标准的HTTP2代理,并向下兼容HTTPS代理。
  • 作为通道传输其他协议。
代理模式

服务端:

gost -L=http2://:443

客户端:

gost -L=:8080 -F=http2://server_ip:443
通道模式

服务端:

gost -L=h2://:443

客户端:

gost -L=:8080 -F=h2://server_ip:443

QUIC

gost对QUIC的支持是基于quic-go库。

服务端:

gost -L=quic://:6121

客户端:

gost -L=:8080 -F=quic://server_ip:6121

注: QUIC模式只能作为代理链的第一个节点。

KCP

gost对KCP的支持是基于kcp-go和kcptun库。

服务端:

gost -L=kcp://:8388

客户端:

gost -L=:8080 -F=kcp://server_ip:8388

gost会自动加载当前工作目录中的kcp.json(如果存在)配置文件,或者可以手动通过参数指定配置文件路径:

gost -L=kcp://:8388?c=/path/to/conf/file

注: KCP模式只能作为代理链的第一个节点。

SSH

gost的SSH支持两种模式:

  • 作为转发通道,配合本地/远程TCP端口转发使用。
  • 作为通道传输其他协议。
转发模式

服务端:

gost -L=forward+ssh://:2222

客户端:

gost -L=rtcp://:1222/:22 -F=forward+ssh://server_ip:2222
通道模式

服务端:

gost -L=ssh://:2222

客户端:

gost -L=:8080 -F=ssh://server_ip:2222?ping=60

可以通过ping参数设置心跳包发送周期,单位为秒。默认不发送心跳包。

透明代理

基于iptables的透明代理。

gost -L=redirect://:12345 -F=http2://server_ip:443

obfs4

此功能由@isofew贡献。

服务端:

gost -L=obfs4://:443

当服务端运行后会在控制台打印出连接地址供客户端使用:

obfs4://:443/?cert=4UbQjIfjJEQHPOs8vs5sagrSXx1gfrDCGdVh2hpIPSKH0nklv1e4f29r7jb91VIrq4q5Jw&iat-mode=0

客户端:

gost -L=:8888 -F='obfs4://server_ip:443?cert=4UbQjIfjJEQHPOs8vs5sagrSXx1gfrDCGdVh2hpIPSKH0nklv1e4f29r7jb91VIrq4q5Jw&iat-mode=0'

加密机制

HTTP

对于HTTP可以使用TLS加密整个通讯过程,即HTTPS代理:

服务端:

gost -L=https://:443

客户端:

gost -L=:8080 -F=http+tls://server_ip:443

HTTP2

gost的HTTP2代理模式仅支持使用TLS加密的HTTP2协议,不支持明文HTTP2传输。

gost的HTTP2通道模式支持加密(h2)和明文(h2c)两种模式。

SOCKS5

gost支持标准SOCKS5协议的no-auth(0x00)和user/pass(0x02)方法,并在此基础上扩展了两个:tls(0x80)和tls-auth(0x82),用于数据加密。

服务端:

gost -L=socks5://:1080

客户端:

gost -L=:8080 -F=socks5://server_ip:1080

如果两端都是gost(如上)则数据传输会被加密(协商使用tls或tls-auth方法),否则使用标准SOCKS5进行通讯(no-auth或user/pass方法)。

Shadowsocks

gost对shadowsocks的支持是基于shadowsocks-go库。

服务端:

gost -L=ss://chacha20:123456@:8338

客户端:

gost -L=:8080 -F=ss://chacha20:123456@server_ip:8338
Shadowsocks UDP relay

目前仅服务端支持UDP Relay。

服务端:

gost -L=ssu://chacha20:123456@:8338

TLS

gost内置了TLS证书,如果需要使用其他TLS证书,有两种方法:

  • 在gost运行目录放置cert.pem(公钥)和key.pem(私钥)两个文件即可,gost会自动加载运行目录下的cert.pem和key.pem文件。
  • 使用参数指定证书文件路径:
gost -L="http2://:443?cert=/path/to/my/cert/file&key=/path/to/my/key/file"

对于客户端可以通过secure参数开启服务器证书和域名校验:

gost -L=:8080 -F="http2://server_domain_name:443?secure=true"

对于客户端可以指定CA证书进行证书锁定(Certificate Pinning):

gost -L=:8080 -F="http2://:443?ca=ca.pem"

证书锁定功能由@sheerun贡献