Convert Figma logo to code with AI

trojan-gfw logotrojan

An unidentifiable mechanism that helps you bypass GFW.

18,819
3,017
18,819
87

Top Related Projects

A platform for building proxies to bypass network restrictions.

A Rust port of shadowsocks

24,231

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

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

Make a fortune quietly

Quick Overview

Trojan is an unobtrusive proxy software that helps bypass network restrictions. It's designed to be difficult to detect and block, using techniques that make it appear as normal HTTPS traffic. Trojan aims to provide a secure and efficient way to circumvent internet censorship.

Pros

  • High security: Uses TLS encryption to protect data and avoid detection
  • Low overhead: Minimal performance impact due to efficient design
  • Cross-platform support: Available for various operating systems
  • Easy to deploy and configure

Cons

  • Requires a server with a valid TLS certificate
  • May be blocked if the IP address is blacklisted
  • Less feature-rich compared to some other proxy solutions
  • Potential legal concerns in some jurisdictions

Code Examples

// Creating a simple 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": ["your_secure_password"],
    "ssl": {
        "cert": "/path/to/certificate.crt",
        "key": "/path/to/private.key"
    }
}
// Creating a simple Trojan client configuration
{
    "run_type": "client",
    "local_addr": "127.0.0.1",
    "local_port": 1080,
    "remote_addr": "your_server_address",
    "remote_port": 443,
    "password": ["your_secure_password"],
    "ssl": {
        "verify": true,
        "verify_hostname": true,
        "cert": "",
        "cipher": "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384",
        "sni": "",
        "alpn": [
            "h2",
            "http/1.1"
        ],
        "reuse_session": true,
        "session_ticket": false,
        "curves": ""
    }
}

Getting Started

  1. Clone the repository:

    git clone https://github.com/trojan-gfw/trojan.git
    
  2. Build Trojan:

    cd trojan
    mkdir build && cd build
    cmake ..
    make
    
  3. Create a configuration file (e.g., config.json) based on the examples above.

  4. Run Trojan:

    ./trojan -c config.json
    

For detailed instructions and advanced configuration options, refer to the project's documentation on GitHub.

Competitor Comparisons

A platform for building proxies to bypass network restrictions.

Pros of v2ray-core

  • More versatile with support for multiple protocols and transport layers
  • Advanced features like traffic splitting and dynamic routing
  • Active development with frequent updates and improvements

Cons of v2ray-core

  • More complex configuration due to its extensive feature set
  • Higher resource usage compared to Trojan's lightweight design
  • Steeper learning curve for new users

Code Comparison

v2ray-core (Go):

type ServerConfig struct {
    Address *Address  `json:"address"`
    Port    uint16    `json:"port"`
    Network *Network  `json:"network"`
    // ... more fields
}

Trojan (C++):

class Config {
public:
    string remote_addr;
    uint16_t remote_port;
    string local_addr;
    uint16_t local_port;
    // ... more fields
};

The code snippets show that v2ray-core uses a more structured approach with nested types, while Trojan opts for a simpler, flat configuration structure. This reflects v2ray-core's more complex feature set and Trojan's focus on simplicity.

v2ray-core offers greater flexibility and features at the cost of complexity, while Trojan provides a more straightforward, lightweight solution. The choice between them depends on specific use cases and user preferences.

A Rust port of shadowsocks

Pros of shadowsocks-rust

  • Written in Rust, offering better performance and memory safety
  • Supports multiple ciphers and protocols, providing flexibility
  • Active development with frequent updates and improvements

Cons of shadowsocks-rust

  • Less widespread adoption compared to Trojan
  • May require more setup and configuration for advanced features
  • Lacks some of the built-in obfuscation techniques found in Trojan

Code Comparison

shadowsocks-rust

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

Trojan

Service service(config);
service.run();

Both projects aim to provide secure and efficient proxy solutions, but they differ in their implementation and features. shadowsocks-rust leverages Rust's performance benefits and memory safety, while Trojan focuses on simplicity and ease of use. The code snippets demonstrate the basic setup for running a server in each project, with shadowsocks-rust using async/await syntax and Trojan using a more traditional approach.

Ultimately, the choice between these two projects depends on specific requirements, such as performance needs, desired features, and familiarity with the respective programming languages and ecosystems.

24,231

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

Pros of Xray-core

  • More comprehensive protocol support, including VLESS, Trojan, and VMess
  • Advanced features like XTLS for improved performance and security
  • Active development with frequent updates and community contributions

Cons of Xray-core

  • Higher complexity, potentially more challenging to set up and configure
  • Larger codebase, which may lead to increased resource usage
  • Some features may be considered overkill for basic use cases

Code Comparison

Xray-core (Go):

type ServerConfig struct {
    Inbounds  []InboundDetourConfig `json:"inbounds"`
    Outbounds []OutboundDetourConfig `json:"outbounds"`
    Transport *TransportConfig `json:"transport"`
    Policy    *PolicyConfig `json:"policy"`
}

Trojan (C++):

class Config {
public:
    class SSLConfig {
    public:
        bool verify;
        bool verify_hostname;
        std::string cert;
        std::string key;
    } ssl;
};

The code snippets demonstrate the difference in configuration structures between Xray-core (written in Go) and Trojan (written in C++). Xray-core's configuration appears more modular and extensive, reflecting its broader feature set, while Trojan's configuration is more focused on SSL settings, aligning with its simpler design philosophy.

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

  • Written in Go, offering better performance and concurrency
  • Supports multiple protocols (WebSocket, gRPC, etc.) for better obfuscation
  • Includes built-in routing and load balancing features

Cons of trojan-go

  • Larger binary size due to Go compilation
  • May have slightly higher memory usage compared to C++ implementation
  • Some users report occasional stability issues with certain configurations

Code Comparison

trojan:

void Session::start() {
    auto self = shared_from_this();
    in_socket.async_wait(tcp::socket::wait_read, [this, self](const boost::system::error_code &ec) {
        if (ec) {
            destroy();
            return;
        }
        in_read();
    });
}

trojan-go:

func (c *Client) Run() error {
    for {
        conn, err := c.underlay.AcceptConn()
        if err != nil {
            return err
        }
        go c.handleConn(conn)
    }
}

The code snippets show different approaches to handling connections, with trojan-go utilizing Go's goroutines for concurrent processing.

Make a fortune quietly

Pros of naiveproxy

  • Built on Chromium's network stack, providing better performance and stability
  • Supports HTTPS/2 and QUIC protocols, offering improved speed and security
  • More resistant to detection due to its similarity to regular Chrome traffic

Cons of naiveproxy

  • More complex setup and configuration compared to Trojan
  • Larger resource footprint due to Chromium dependencies
  • Less widespread adoption and community support than Trojan

Code comparison

Trojan configuration example:

{
    "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",
        "key_password": "",
        "cipher": "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384",
        "cipher_tls13": "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384",
        "prefer_server_cipher": true,
        "alpn": [
            "http/1.1"
        ],
        "reuse_session": true,
        "session_ticket": false,
        "session_timeout": 600,
        "plain_http_response": "",
        "curves": "",
        "dhparam": ""
    }
}

naiveproxy configuration example:

{
  "listen": "http://127.0.0.1:1080",
  "proxy": "https://example.com",
  "concurrency": 1
}

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

trojan

Build Status

An unidentifiable mechanism that helps you bypass GFW.

Trojan features multiple protocols over TLS to avoid both active/passive detections and ISP QoS limitations.

Trojan is not a fixed program or protocol. It's an idea, an idea that imitating the most common service, to an extent that it behaves identically, could help you get across the Great FireWall permanently, without being identified ever. We are the GreatER Fire; we ship Trojan Horses.

Documentations

An online documentation can be found here.
Installation guide on various platforms can be found in the wiki.

Contributing

See CONTRIBUTING.md.

Dependencies

License

GPLv3