Crates.io | hptp |
lib.rs | hptp |
version | 0.0.12 |
source | src |
created_at | 2024-08-05 10:09:50.148197 |
updated_at | 2024-09-24 04:54:05.531609 |
description | the high performance TCP proxy written in rust |
homepage | |
repository | https://github.com/Vrtgs/hptp/tree/master |
max_upload_size | |
id | 1325821 |
size | 97,014 |
hptp is a high-performance TCP proxy designed to forward traffic to a specified host and ports with configurable runtime options.
--v4
(alias: --ipv4
): Enable IPv4.--v6
(alias: --ipv6
): Enable IPv6.--host <HOST>
: Specify the host to forward traffic to.--ports <PORTS>
: Specify the port\s to forward traffic to.--runtime <Runtime type>
(alias: --rt
): Specify runtime (default single-threaded
).by default if neither --v4
or --v6
are specified, --v4
is enabled
hptp run --host example.com --ports [80,443] --log info --runtime multi-threaded
this would route all IPv4 traffic on 0.0.0.0 on ports 80 and 443 to example.com:<port>
hptp set-up-daemon --host example.com --ports [80,443] --log info --runtime multi-threaded
this would do the same as above except it would run it as a daemon
hptp run <run arguments>
runs the hptp proxy
hptp set-up-daemon <daemon> <run arguments>
hptp remove-daemon <daemon>
removes
on windows and mac daemon is implicit, but on linux must be specified, currently hptp supports either systemd or open-rc
single-threaded
: Runs the proxy on a single thread.multi-threaded
: Runs the proxy on multiple threads.The ports array allows you to specify which ports the proxy should forward traffic to. You can define this array in several ways:
Individual Ports: You can list individual port numbers separated by commas.
[80, 443, 8080]
Inclusive Ranges: You can specify a range of ports using the ..
syntax, which includes both the start and end values.
[80..90]
(This includes ports 80, 81, ..., 90)Exclusive Ranges: You can specify a range of ports using the ..!=
syntax, which includes the start value but excludes the end value.
[80..!=90]
(This includes ports 80, 81, ..., 89)The ports array is parsed from a string representation, and it supports a mix of individual ports and ranges. Here’s how it works:
[
and end with ]
.note, passing in one port number also works
[80, 443, 20..24, 2040..!=2080]
[80..90, 443, 8080]
The host
parameter specifies the destination host to which the proxy will forward traffic. This can be an IP address or a hostname. Here are some examples:
127.0.0.1
::1
example.com
The host parameter ensures that all traffic received by the proxy is directed to the specified host. This is useful for scenarios where you want to centralize traffic management or redirect traffic to a specific server.