Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kezhengjie/epoll-tcp-port-forward

a small demo shows how to use epoll.small program implements port forwarding with epoll.also support Windows using wepoll
https://github.com/kezhengjie/epoll-tcp-port-forward

c epoll epoll-demo epoll-example linux-app linux-epoll port-forward port-forwarding tcp tcp-port-forward wepoll wepoll-example wepoll-tcp-port-forward

Last synced: 6 days ago
JSON representation

a small demo shows how to use epoll.small program implements port forwarding with epoll.also support Windows using wepoll

Awesome Lists containing this project

README

        

# epoll-tcp-port-forward
This program implements TCP port forwarding using epoll.
It is designed for those who want to learn epoll through a practical project.
Note: This program is not recommended for production use.
For production, IPTABLES IS A BETTER CHOICE.

# Compile And Run
```shell
# Requires cmake to build this project
cd epoll-tcp-port-forward
cmake -B ./build .
cmake --build build --config MinSizeRel --target all
./build/tcp_port_forward 31212 127.0.0.1 22 # Forward any data from port 31212 to local port 22
```

Alternatively, you can simply run:
```shell
gcc tcp_port_forward.c
./a.out 31212 127.0.0.1 22 # Forward any data from port 31212 to local port 22
```

# Windows
There's no native epoll support on Windows.
Thanks to [wepoll](https://github.com/piscisaureus/wepoll),an open source library that implements epoll API,you could still run this project on Windows.
```shell
cd epoll-tcp-port-forward\windows
git submodule update --init
cmake -B ./build .
cmake --build build --config MinSizeRel --target all
.\build\tcp_port_forward 31212 127.0.0.1 22 # Forward any data from port 31212 to local port 22
```