| Crates.io | portproxy |
| lib.rs | portproxy |
| version | 0.3.2 |
| created_at | 2022-09-13 20:55:46.64559+00 |
| updated_at | 2024-04-04 13:33:25.33912+00 |
| description | Simple port forwarding tool |
| homepage | |
| repository | https://github.com/spitfire05/portproxy |
| max_upload_size | |
| id | 664924 |
| size | 83,136 |
Simple port forwarding tool, built with tokio-rs 🦀
Pretty much the very same thing as Windows' netsh interface portproxy or Linux's iptables forward - it maps the incoming connections from listen local adress & port to remote connect address and port.
Only TCP port forwarding is supported at this time.
This tool does not currently offer anything more over the native OS tools, maybe besides the unification and ease of defining the mappings. Other notable use case is those rare instances were native port forwarding tool cannot be used (for example, windows' netsh portproxy requires IPv6 to be enabled on the system).
cargo install portproxy
Clone the repo and compile it:
git clone https://github.com/spitfire05/portproxy.git
cd portproxy
cargo install
Windows binaries are avialable in the releases section of this repo.
Configuration is specified in the TOML language.
portproxy will try to read the config for paths in following order:
--config CLI arg, if setPORTPROXY_CONFIG env variable, if set~/.config/portproxy.tomlConfig should contain one or more [[proxy]] elements, that define the port mappings:
[[proxy]]
listen = "localhost:8080" # local address to listen on
connect = "some-server.lan:8485" # remote (or local) address to connect to
Running is as simple as it can be - just call the portproxy binary. There are optional flags/parameters:
Usage: portproxy [OPTIONS]
Options:
-c, --config-path <CONFIG_PATH> Path to read the config from. If not set, will fall back to value of $PORTPROXY_CONFIG, and "~/.config/portproxy.toml", in that order
-l, --log-level <LOG_LEVEL> [default: info] [possible values: error, warn, info, debug, trace]
-d, --log-dir <LOG_DIR> Directory to write the log files to. Logging to file will be disabled if this is not set
-h, --help Print help
-V, --version Print version
Use Shawl to create a windows service of portproxy.
shawl add --no-restart --no-log --name portproxy -- C:\full\path\to\portproxy.exe --log-level debug --log-dir C:\full\path\to\logs\directory <optional args>