MCPcopy Index your code
hub / github.com/airtrack/stunnel

github.com/airtrack/stunnel @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
264 symbols 615 edges 21 files 0 documented · 0% updated 28d agov0.5.1 · 2023-05-02★ 170
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

STunnel

Simple SOCKS5/HTTP tunnel. SOCKS5 on client side provides NO AUTHENTICATION TCP/UDP proxy.

            .                      |                     .
            .                      f                     .
            .                      i                     .
port1 ------|                      r                     |------ port1
            |                      e                     |
            |                      |                     |
port2 ---client---------------- tunnel ----------------server--- port2
            |                      |                     |
            |                      w                     |
port3 ------|                      a                     |------ port3
            .                      l                     .
            .                      l                     .
            .                      |                     .

Build

Build by Cargo:

Cargo build --release

Usage

./stunnel_server <OPTIONS>
Options:
    -l, --listen <IP:PORT>
    -k, --key <STRING>
        --log <PATH>
        --ucp-metrics-path <PATH>

./stunnel_client <OPTIONS>
Options:
    -s, --server <IP:PORT>
    -k, --key <STRING>
        --enable-ucp
        --socks5-proxy <IP:PORT>
        --http-proxy <IP:PORT>
        --log <PATH>
        --ucp-metrics-path <PATH>
        --tcp-tunnel-count <NUMBER>

Browser connect client address(127.0.0.1:1080) through SOCKS5 or connect client address(127.0.0.1:8888) through HTTP.

--enable-ucp option on client side to enable UCP tunnel instead of TCP tunnel, UCP tunnel is much faster than TCP tunnel in some cases.

UCP

UCP is an ARQ protocol implementation, which is based on UDP and inspired by KCP.

Work with autoproxy and gatewaysocks

    ----------------                 -------------                     -----------
    | gatewaysocks | === TCP/UDP ==> | autoproxy | ===== TCP/UDP ====> | stunnel |
    ----------------                 -------------   |                 -----------
           ^                               ^         |                 -----------
           |                               |         |== TCP/UDP ====> | direct  |
           |                               |                           -----------
    -----------------             ------------------
    | other devices |             |   set system   |
    |  in the same  |             | proxy settings |
    |    router     |             |  to autoproxy  |
    -----------------             ------------------

Extension points exported contracts — how you extend this code

Proxy (Interface)
(no doc) [2 implementers]
src/proxy/mod.rs
MetricsReporter (Interface)
(no doc) [1 implementers]
src/ucp/metrics.rs
MetricsService (Interface)
(no doc) [1 implementers]
src/ucp/metrics.rs

Core symbols most depended-on inside this repo

send
called by 34
src/ucp/stream.rs
write_all
called by 23
src/util.rs
shutdown
called by 19
src/ucp/stream.rs
payload_write_u32
called by 9
src/ucp/packet.rs
payload_read_u32
called by 9
src/ucp/packet.rs
timestamp
called by 8
src/ucp/internal.rs
parse
called by 8
src/ucp/packet.rs
parse_u32
called by 8
src/ucp/packet.rs

Shape

Method 170
Function 51
Class 34
Enum 6
Interface 3

Languages

Rust100%

Modules by API surface

src/ucp/internal.rs49 symbols
src/tunnel/server.rs37 symbols
src/tunnel/client.rs37 symbols
src/tunnel/protocol.rs24 symbols
src/ucp/packet.rs20 symbols
src/proxy/socks5.rs19 symbols
src/tunnel/cryptor.rs14 symbols
src/ucp/metrics.rs13 symbols
src/ucp/stream.rs9 symbols
src/util.rs7 symbols
src/proxy/mod.rs7 symbols
src/logger.rs6 symbols

For agents

$ claude mcp add stunnel \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page