Project name is a tool that allows port forwarding to your local machine, even behind firewall.
Before you begin, ensure you have met the following requirements:
- Rust 1.67 or later
This project uses multiplexing for redirecting all traffic from an public and exposed port to a local port in your machine, using a single tcp connection between server and your machine.
The following diagram shows how the project would work when the server receives 3 connections, and redirects the traffic to the local machine, demuxing the connections from the server.
- Fork the repository
- Start the server with
cargo run --bin tcproxy-server -- --port 8080
- In another terminal, create a new app context with
cargo run --bin tcproxy-cli -- context create main 127.0.0.1:8080
- Then Start the client with
cargo run --bin tcproxy-cli -- listen 3338
You should be able to see something like this on your terminal:
So now, every traffic sent to 127.0.0.1:21017 is going to be redirected to 127.0.0.1:3338
To spawn tcproxy-server
, follow these steps:
To see all options:
$ tcproxy-server --help
Starting the server listening on port 8080
$ tcproxy --port 8080
Starting the server with a different port range available for proxy servers (default is from 15000-25000)
$ tcproxy --port 8080
To see all options:
$ tcproxy-cli --help
Starting to receive remote connections:
$ tcproxy-cli listen <local-port>
Starting to receive remote connections using an app context:
$ tcproxy-cli listen <local-port> --app-context <name>
Contexts are like origins on git, you can have multiple ones, and when starting to listen, you can specify to where tcproxy-cli is going to connect. By default tcproxy-cli doesnt contain any app context, and when you create the first one, it is set as the default.
Listing all your available contexts:
$ tcproxy-cli context list
Creating new context
$ tcproxy-cli context create <name> <ip>:<port>
Setting an existing context as default:
$ tcproxy-cli context set-default <name>
To contribute to this project, follow these steps:
- Fork this repository.
- Create a branch:
git checkout -b <branch_name>
. - Make your changes and commit them:
git commit -m '<commit_message>'
- Push to the original branch:
git push origin <project_name>/<location>
- Create the pull request.
Alternatively see the GitHub documentation on creating a pull request.
Thanks to the following people who have contributed to this project:
- @m4urici0gm π
If you want to contact me you can reach me at [email protected]
This project uses the following license: GPL-2.0.
Done with β€οΈ