MCPcopy Index your code
hub / github.com/Snawoot/steady-tun

github.com/Snawoot/steady-tun @v1.5.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.5.0 ↗ · + Follow
60 symbols 151 edges 13 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

steady-tun

steady-tun

Secure TLS tunnel with pool of prepared upstream connections

Accepts TCP connections on listen port and forwards them, wrapped in TLS, to destination port. steady-tun maintains pool of fresh established TLS connections effectively cancelling delay caused by TLS handshake. Optionally it can be used as just TCP connection pool (option -tls-enabled=false).

steady-tun may serve as drop-in replacement for stunnel or haproxy for purpose of secure tunneling of TCP connections. Thus, it is intended for use with stunnel or haproxy on server side, accepting TLS connections and forwarding them, for example, to SOCKS proxy. In such configuration make sure your server timeouts long enough to allow fit lifetime of idle client TLS sessions (-T option).

steady-tun can be used with custom CAs and/or mutual TLS auth with certificates.

Features

  • Based on proven TLS security and works with well-known server side daemons for TLS termination like haproxy and stunnel.
  • Firewall- and DPI-proof: connections are indistinguishable from HTTPS traffic.
  • Greater practical performance comparing to other TCP traffic forwading solutions thanks to separate TLS session for each TCP connection.
  • Hides TLS connection delay with connection pooling.
  • Supports TLS SNI (server name indication) spoof - it may be useful to bypass SNI based filters in firewalls.
  • Cross-plaform: runs on Linux, macOS, Windows and other Unix-like systems.

Installation

Pre-built binaries

Pre-built binaries available on releases page.

From source

Alternatively, you may install steady-tun from source:

go install github.com/Snawoot/steady-tun@latest

From Snap Store

Get it from the Snap Store

sudo snap install steady-tun

Docker

docker run -it --rm -v certs:/certs -p 57800:57800 \
    yarmak/steady-tun \
    -dsthost proxy.example.com \
    -dstport 443 \
    -cert /certs/user.pem \
    -key /certs/user.key \
    -cafile /certs/ca.pem \
    -ttl 300s

Usage example

~/go/bin/steady-tun \
    -dsthost proxy.example.com \
    -dstport 443 \
    -cert user.pem \
    -key user.key \
    -cafile ca.pem \
    -ttl 300s

Command in this example will start forwarding TCP connections from default local port 57800 to proxy.example.com:443. Authentication is performed with client certificate and key. Server verification is performed with custom certificate in file ca.pem.

Synopsis

$ ~/go/bin/steady-tun -h
Usage of steady-tun:
  -backoff duration
        delay between connection attempts (default 5s)
  -bind-address string
        bind address (default "127.0.0.1")
  -bind-port uint
        bind port (default 57800)
  -cafile string
        override default CA certs by specified in file
  -cert string
        use certificate for client TLS auth
  -dialers uint
        concurrency limit for TLS connection attempts (default 16)
  -dns-cache-ttl duration
        DNS cache TTL (default 30s)
  -dns-neg-cache-ttl duration
        negative DNS cache TTL (default 1s)
  -dsthost string
        destination server hostname
  -dstport uint
        destination server port
  -hostname-check
        check hostname in server cert subject (default true)
  -key string
        key for TLS certificate
  -pool-size uint
        connection pool size (default 50)
  -timeout duration
        server connect timeout (default 4s)
  -tls-enabled
        enable TLS client for pool connections (default true)
  -tls-servername string
        specifies hostname to expect in server cert
  -tls-session-cache
        enable TLS session cache (default true)
  -ttl duration
        lifetime of idle pool connection in seconds (default 30s)
  -verbosity int
        logging verbosity (10 - debug, 20 - info, 30 - warning, 40 - error, 50 - critical) (default 20)
  -version
        show program version and exit

Extension points exported contracts — how you extend this code

Factory (Interface)
(no doc) [2 implementers]
conn/dialer.go
Resolver (Interface)
(no doc)
dnscache/wrapper.go
HandlerFunc (FuncType)
(no doc)
server/listener.go

Core symbols most depended-on inside this repo

Close
called by 9
log/logwriter.go
Debug
called by 6
log/condlog.go
arg_fail
called by 5
main.go
log
called by 5
log/condlog.go
Info
called by 5
log/condlog.go
Pop
called by 5
queue/queue.go
Error
called by 4
log/condlog.go
NewRAQueue
called by 3
queue/queue.go

Shape

Method 28
Function 17
Struct 12
Interface 2
FuncType 1

Languages

Go100%

Modules by API surface

pool/connpool.go10 symbols
log/condlog.go9 symbols
server/listener.go6 symbols
queue/queue.go5 symbols
main.go5 symbols
log/logwriter.go5 symbols
dnscache/wrapper.go5 symbols
server/handler.go4 symbols
conn/tlsfactory.go3 symbols
conn/plainfactory.go3 symbols
queue/queue_test.go2 symbols
conn/dialer.go2 symbols

For agents

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

⬇ download graph artifact

Ask about this repo answers extend the page