CLI Reference
CLI Reference
Section titled “CLI Reference”Complete command-line reference for Bifrost server and client.
Server Commands
Section titled “Server Commands”bifrost-server
Section titled “bifrost-server”Main server executable.
bifrost-server [flags]bifrost-server [command]Global Flags
Section titled “Global Flags”| Flag | Short | Default | Description |
|---|---|---|---|
--config | -c | server-config.yaml | Configuration file path |
--help | -h | Show help |
Commands
Section titled “Commands”| Command | Description |
|---|---|
completion | Generate shell autocompletion scripts |
ctl | Control a running server |
help | Help about any command |
update | Check for and install updates |
validate | Validate configuration file |
version | Print version information |
bifrost-server validate
Section titled “bifrost-server validate”Validate a configuration file without starting the server.
bifrost-server validate -c config.yamlExit codes:
0- Configuration is valid1- Configuration has errors
bifrost-server version
Section titled “bifrost-server version”Print version information.
bifrost-server versionOutput:
Bifrost Server v1.0.0 Commit: abc1234 Built: 2024-01-15T10:00:00Z Go: go1.22.0 OS/Arch: linux/amd64bifrost-server update
Section titled “bifrost-server update”Check for and install updates.
bifrost-server update [command] [flags]| Flag | Short | Default | Description |
|---|---|---|---|
--channel | stable | Release channel (stable, prerelease) | |
--force | -f | false | Force update even if same version |
Subcommands
Section titled “Subcommands”update check
Section titled “update check”Check if updates are available without installing.
bifrost-server update checkOutput:
Update available! Current version: v1.0.0 New version: v1.1.0 Published: Mon, 15 Jan 2024 10:00:00 UTC Release URL: https://github.com/rennerdo30/bifrost-proxy/releases/tag/v1.1.0
Run 'bifrost-server update install' to install.update install
Section titled “update install”Download and install the latest update.
bifrost-server update installFeatures:
- Downloads from GitHub Releases
- Verifies SHA256 checksum
- Creates backup before replacing
- Shows download progress
Note: The server must be restarted after updating.
bifrost-server ctl
Section titled “bifrost-server ctl”Control a running Bifrost server via the API.
bifrost-server ctl [command] [flags]| Flag | Default | Description |
|---|---|---|
--api | http://localhost:7082 | API server URL |
--token | API authentication token |
Subcommands
Section titled “Subcommands”ctl health
Section titled “ctl health”Check server health.
bifrost-server ctl healthctl status
Section titled “ctl status”Show server status.
bifrost-server ctl statusctl stats
Section titled “ctl stats”Show server statistics.
bifrost-server ctl statsctl backend
Section titled “ctl backend”Manage backends.
# List all backendsbifrost-server ctl backend list
# Show specific backendbifrost-server ctl backend show <name>
# Show backend statsbifrost-server ctl backend stats <name>ctl config
Section titled “ctl config”Manage configuration.
# Show current configbifrost-server ctl config show
# Reload configurationbifrost-server ctl config reload
# Validate configurationbifrost-server ctl config validateClient Commands
Section titled “Client Commands”bifrost-client
Section titled “bifrost-client”Main client executable.
bifrost-client [flags]bifrost-client [command]Global Flags
Section titled “Global Flags”| Flag | Short | Default | Description |
|---|---|---|---|
--config | -c | client-config.yaml | Configuration file path |
--help | -h | Show help |
Commands
Section titled “Commands”| Command | Description |
|---|---|
completion | Generate shell autocompletion scripts |
config | Configuration management |
ctl | Control a running client |
help | Help about any command |
update | Check for and install updates |
validate | Validate configuration file |
version | Print version information |
bifrost-client config
Section titled “bifrost-client config”Configuration management commands.
bifrost-client config [command]config init
Section titled “config init”Generate a sample client configuration file.
bifrost-client config init [flags]| Flag | Short | Default | Description |
|---|---|---|---|
--server | -s | Server address (host:port) | |
--output | -o | client-config.yaml | Output file path |
--protocol | -p | http | Protocol (http, socks5) |
Examples:
# Generate basic configbifrost-client config init -s proxy.example.com:7080
# Specify output filebifrost-client config init -s proxy.example.com:7080 -o my-config.yaml
# Use SOCKS5 protocolbifrost-client config init -s proxy.example.com:7180 -p socks5bifrost-client validate
Section titled “bifrost-client validate”Validate a configuration file.
bifrost-client validate -c config.yamlbifrost-client version
Section titled “bifrost-client version”Print version information.
bifrost-client versionbifrost-client update
Section titled “bifrost-client update”Check for and install updates.
bifrost-client update [command] [flags]| Flag | Short | Default | Description |
|---|---|---|---|
--channel | stable | Release channel (stable, prerelease) | |
--force | -f | false | Force update even if same version |
Subcommands
Section titled “Subcommands”update check
Section titled “update check”Check if updates are available without installing.
bifrost-client update checkupdate install
Section titled “update install”Download and install the latest update.
bifrost-client update installNote: The client must be restarted after updating.
bifrost-client ctl
Section titled “bifrost-client ctl”Control a running Bifrost client via the API.
bifrost-client ctl [command] [flags]| Flag | Default | Description |
|---|---|---|
--api | http://localhost:7383 | API server URL |
Subcommands
Section titled “Subcommands”ctl health
Section titled “ctl health”Check client health.
bifrost-client ctl healthctl status
Section titled “ctl status”Show client status including server connection.
bifrost-client ctl statusctl routes
Section titled “ctl routes”List routing rules.
bifrost-client ctl routesctl test
Section titled “ctl test”Test routing for a domain.
bifrost-client ctl test example.comShell Completion
Section titled “Shell Completion”Generate autocompletion scripts for your shell.
# Generate completion scriptbifrost-server completion bash > /etc/bash_completion.d/bifrost-server
# Or add to .bashrcecho 'source <(bifrost-server completion bash)' >> ~/.bashrc# Generate completion scriptbifrost-server completion zsh > "${fpath[1]}/_bifrost-server"
# Or add to .zshrcecho 'source <(bifrost-server completion zsh)' >> ~/.zshrcbifrost-server completion fish > ~/.config/fish/completions/bifrost-server.fishPowerShell
Section titled “PowerShell”bifrost-server completion powershell > bifrost-server.ps1Environment Variables
Section titled “Environment Variables”Configuration can be set via environment variables using the ${VAR_NAME} syntax in config files.
Common Variables
Section titled “Common Variables”| Variable | Description | Example |
|---|---|---|
BIFROST_CONFIG | Config file path | /etc/bifrost/config.yaml |
BIFROST_LOG_LEVEL | Log level | debug, info, warn, error |
BIFROST_API_TOKEN | API authentication token | your-secret-token |
Authentication Variables
Section titled “Authentication Variables”| Variable | Description |
|---|---|
LDAP_BIND_PASSWORD | LDAP bind password |
OAUTH_CLIENT_SECRET | OAuth client secret |
Example Usage
Section titled “Example Usage”# config.yamlapi: token: "${BIFROST_API_TOKEN}"
auth: ldap: bind_password: "${LDAP_BIND_PASSWORD}"export BIFROST_API_TOKEN="my-secret-token"export LDAP_BIND_PASSWORD="ldap-password"bifrost-server -c config.yamlExit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Configuration error |
| 3 | Connection error |
Examples
Section titled “Examples”Start Server with Custom Config
Section titled “Start Server with Custom Config”bifrost-server -c /etc/bifrost/production.yamlValidate Configuration
Section titled “Validate Configuration”bifrost-server validate -c config.yaml && echo "Config OK"Check Server Health
Section titled “Check Server Health”bifrost-server ctl health --api http://localhost:7082 --token mytokenGenerate Client Config and Start
Section titled “Generate Client Config and Start”bifrost-client config init -s proxy.example.com:7080 -o config.yamlbifrost-client -c config.yamlTest Route Resolution
Section titled “Test Route Resolution”bifrost-client ctl test google.com# Output: google.com -> server (matched rule: default)