Skip to content

A high-performance and easy-to-use TCP-Relay write in C++20 based on ASIO and Coroutines.

License

Notifications You must be signed in to change notification settings

lxrite/tcp-relay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCP-Relay

License: MIT

A high-performance and easy-to-use TCP-Relay write in C++20 based on ASIO and Coroutines. In addition to basic TCP relay, it also supports relaying through intermediate proxies (such as HTTP-Proxy).

Getting Started

Build from source

This project relies on some C++20 features. The following compilers and their respective versions are supported:

  • GCC >= 12.0
  • Clang >= 14.0
  • Microsoft Visual Studio (MSVC) >= 2019
# clone
git clone --recursive https://github.com/lxrite/tcp-relay.git
cd tcp-relay

# build
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Usage

$ ./tcp-relay --help
Usage: tcp-relay [options]

options:
  -h, --help                  Show this help message and exit
  -v, --version               Print the program version and exit
  -l, --listen_addr string    Local address to listen on (default: 0.0.0.0)
  -p, --port number           Local port to listen on (default: 8886)
  -t, --target string         Taget address (host:port) to connect
  --timeout number            Connection timeout (in seconds) (default: 240)
  --via [none | http_proxy]   Transfer via other proxy (default: none)
  --http_proxy string         HTTP-Proxy address (host:port)
  --log_level string [trace | debug | info | warn | error | disable] Log level (default: info)

Examples

# basic
./tcp-relay -t 172.16.1.1:8080

# IPv6
./tcp-relay -t [fd12:3456:789a:bcde::1]:8080

# domain
./tcp-relay -t example.com:8080

# relay through HTTP intermediate proxy
./tcp-relay -t example.com:8080 --via http_proxy --http_proxy proxy.example.com:1234

Using Docker

# pull image
docker pull ghcr.io/lxrite/tcp-relay:latest

# run
docker run -d -p 8886:8886 ghcr.io/lxrite/tcp-relay tcp-relay -t 172.16.1.1:8080

About

A high-performance and easy-to-use TCP-Relay write in C++20 based on ASIO and Coroutines.

Topics

Resources

License

Stars

Watchers

Forks

Packages