All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 6s
|
||
---|---|---|
.forgejo/workflows | ||
cmd/simpleproxy | ||
.gitignore | ||
Dockerfile | ||
go.mod | ||
go.sum | ||
README.md |
SimpleProxy Usage Guide
Overview
SimpleProxy
is a lightweight proxy tool that uses a configuration file to define proxy settings. The configuration file, config.json
, is required for the proxy to function.
Usage
To run SimpleProxy, execute the following command in your terminal:
simpleproxy config.json
Configuration File
The config.json
file is essential for SimpleProxy to know which ports to bind to and which remote addresses to proxy from. Below is an example of the configuration file:
{
"proxy": [
/*
{
"local" : ":port", // Port to bind to, defaults to remote port
"remote": "addr:port", // Remote address to proxy from
"type" : "both" // Protocol type: tcp, udp, or both; defaults to both
}
*/
{
"remote": "example.com:25565"
},
{
"remote": "example.com:42420"
}
]
}
Configuration Options
Each entry in the proxy
array represents a proxy rule with the following options:
- local: Optional. The port to bind to locally. If omitted, the proxy will use the port specified in the
remote
field. - remote: Required. The remote address and port to proxy from.
- type: Optional. Specifies the protocol type (
tcp
,udp
, orboth
). Defaults toboth
if not specified.
Example Configuration
Here are a couple of examples based on the configuration options:
-
Basic Configuration:
{ "proxy": [ { "remote": "example.com:25565" }, { "remote": "example.com:42420" } ] }
In this configuration, SimpleProxy will bind to ports
25565
and42420
locally, and proxy traffic toexample.com
on the same ports. -
Custom Local Port and Protocol Type:
{ "proxy": [ { "local": ":8080", "remote": "example.com:25565", "type": "tcp" }, { "remote": "example.com:42420", "type": "udp" } ] }
In this configuration:
- The first proxy rule binds to port
8080
locally and proxies TCP traffic toexample.com:25565
. - The second proxy rule binds to port
42420
locally (same as the remote port) and proxies UDP traffic toexample.com:42420
.
- The first proxy rule binds to port
Running the Proxy
After setting up the config.json
file with your desired proxy rules, run SimpleProxy using the command mentioned earlier:
simpleproxy config.json
This will start the proxy based on the defined configuration. Make sure the config.json
file is in the same directory as the simpleproxy
executable or provide the correct path to the configuration file.