https://github.com/lxrite/tcp-relay
A high-performance and easy-to-use TCP-Relay write in C++20 based on ASIO and Coroutines.
https://github.com/lxrite/tcp-relay
asio coroutines tcp-relay
Last synced: 3 months ago
JSON representation
A high-performance and easy-to-use TCP-Relay write in C++20 based on ASIO and Coroutines.
- Host: GitHub
- URL: https://github.com/lxrite/tcp-relay
- Owner: lxrite
- License: mit
- Created: 2023-11-26T08:08:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-10T15:15:59.000Z (about 1 year ago)
- Last Synced: 2025-01-06T08:36:41.761Z (5 months ago)
- Topics: asio, coroutines, tcp-relay
- Language: C++
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TCP-Relay
[](LICENSE)A high-performance and easy-to-use TCP-Relay write in C++20 based on [ASIO](https://think-async.com/Asio/) and [Coroutines](https://en.cppreference.com/w/cpp/language/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``` bash
# 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
``` bash
$ ./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
``` bash
# 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
``` bash
# 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
```