mirror of
https://github.com/fosrl/gerbil.git
synced 2026-02-08 05:56:40 +00:00
@@ -42,13 +42,12 @@ In single node (self hosted) Pangolin deployments this can be bypassed by using
|
|||||||
|
|
||||||
## CLI Args
|
## CLI Args
|
||||||
|
|
||||||
|
Important:
|
||||||
- `reachableAt`: How should the remote server reach Gerbil's API?
|
- `reachableAt`: How should the remote server reach Gerbil's API?
|
||||||
- `generateAndSaveKeyTo`: Where to save the generated WireGuard private key to persist across restarts.
|
- `generateAndSaveKeyTo`: Where to save the generated WireGuard private key to persist across restarts.
|
||||||
- `remoteConfig` (optional): Remote config location to HTTP get the JSON based config from. See `example_config.json`
|
- `remoteConfig`: Remote config location to HTTP get the JSON based config from.
|
||||||
- `config` (optional): Local JSON file path to load config. Used if remote config is not supplied. See `example_config.json`
|
|
||||||
|
|
||||||
Note: You must use either `config` or `remoteConfig` to configure WireGuard.
|
|
||||||
|
|
||||||
|
Others:
|
||||||
- `reportBandwidthTo` (optional): **DEPRECATED** - Use `remoteConfig` instead. Remote HTTP endpoint to send peer bandwidth data
|
- `reportBandwidthTo` (optional): **DEPRECATED** - Use `remoteConfig` instead. Remote HTTP endpoint to send peer bandwidth data
|
||||||
- `interface` (optional): Name of the WireGuard interface created by Gerbil. Default: `wg0`
|
- `interface` (optional): Name of the WireGuard interface created by Gerbil. Default: `wg0`
|
||||||
- `listen` (optional): Port to listen on for HTTP server. Default: `:3004`
|
- `listen` (optional): Port to listen on for HTTP server. Default: `:3004`
|
||||||
@@ -66,7 +65,6 @@ Note: You must use either `config` or `remoteConfig` to configure WireGuard.
|
|||||||
All CLI arguments can also be provided via environment variables:
|
All CLI arguments can also be provided via environment variables:
|
||||||
|
|
||||||
- `INTERFACE`: Name of the WireGuard interface
|
- `INTERFACE`: Name of the WireGuard interface
|
||||||
- `CONFIG`: Path to local configuration file
|
|
||||||
- `REMOTE_CONFIG`: URL of the remote config server
|
- `REMOTE_CONFIG`: URL of the remote config server
|
||||||
- `LISTEN`: Address to listen on for HTTP server
|
- `LISTEN`: Address to listen on for HTTP server
|
||||||
- `GENERATE_AND_SAVE_KEY_TO`: Path to save generated private key
|
- `GENERATE_AND_SAVE_KEY_TO`: Path to save generated private key
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"privateKey": "kBGTgk7c+zncEEoSnMl+jsLjVh5ZVoL/HwBSQem+d1M=",
|
|
||||||
"listenPort": 51820,
|
|
||||||
"ipAddress": "10.0.0.1/24",
|
|
||||||
"peers": [
|
|
||||||
{
|
|
||||||
"publicKey": "5UzzoeveFVSzuqK3nTMS5bA1jIMs1fQffVQzJ8MXUQM=",
|
|
||||||
"allowedIps": ["10.0.0.0/28"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"publicKey": "kYrZpuO2NsrFoBh1GMNgkhd1i9Rgtu1rAjbJ7qsfngU=",
|
|
||||||
"allowedIps": ["10.0.0.16/28"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"publicKey": "1YfPUVr9ZF4zehkbI2BQhCxaRLz+Vtwa4vJwH+mpK0A=",
|
|
||||||
"allowedIps": ["10.0.0.32/28"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"publicKey": "2/U4oyZ+sai336Dal/yExCphL8AxyqvIxMk4qsUy4iI=",
|
|
||||||
"allowedIps": ["10.0.0.48/28"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
7
main.go
7
main.go
@@ -47,6 +47,7 @@ var (
|
|||||||
type WgConfig struct {
|
type WgConfig struct {
|
||||||
PrivateKey string `json:"privateKey"`
|
PrivateKey string `json:"privateKey"`
|
||||||
ListenPort int `json:"listenPort"`
|
ListenPort int `json:"listenPort"`
|
||||||
|
RelayPort int `json:"relayPort"`
|
||||||
IpAddress string `json:"ipAddress"`
|
IpAddress string `json:"ipAddress"`
|
||||||
Peers []Peer `json:"peers"`
|
Peers []Peer `json:"peers"`
|
||||||
}
|
}
|
||||||
@@ -346,7 +347,11 @@ func main() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Start the UDP proxy server
|
// Start the UDP proxy server
|
||||||
proxyRelay = relay.NewUDPProxyServer(groupCtx, ":21820", remoteConfigURL, key, reachableAt)
|
relayPort := wgconfig.RelayPort
|
||||||
|
if relayPort == 0 {
|
||||||
|
relayPort = 21820 // in case there is no relay port set, use 21820
|
||||||
|
}
|
||||||
|
proxyRelay = relay.NewUDPProxyServer(groupCtx, fmt.Sprintf(":%d", relayPort), remoteConfigURL, key, reachableAt)
|
||||||
err = proxyRelay.Start()
|
err = proxyRelay.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal("Failed to start UDP proxy server: %v", err)
|
logger.Fatal("Failed to start UDP proxy server: %v", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user