Skip to content

Commit

Permalink
feat(CLI): create loadbalanced relays from cli
Browse files Browse the repository at this point in the history
  • Loading branch information
go-compile committed Jan 19, 2024
1 parent d87dfd6 commit a439472
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/localrelay/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ type options struct {
certificate string
key string

commands []string
detach bool
commands []string
detach bool
loadbalance bool

isFork bool
DisableAutoStart bool
Expand Down Expand Up @@ -124,6 +125,8 @@ func parseArgs() (*options, error) {
opt.ipcPipe = value
case "detach", "bg", "d":
opt.detach = true
case "loadbalance", "lb":
opt.loadbalance = true
case "store", "s":
opt.store = true
case "timeout":
Expand Down Expand Up @@ -269,6 +272,7 @@ func help() {
Printf(" %-28s %s\n", "-http", "Set relay to HTTP relay")
Printf(" %-28s %s\n", "-https", "Set relay to HTTPS relay")
Printf(" %-28s %s\n", "-proxy", "Set socks5 proxy via URL")
Printf(" %-28s %s\n", "-loadbalance", "Enables load balancing")
Printf(" %-28s %s\n", "-output, -o", "Set output file path")
Printf(" %-28s %s\n", "-proxy_ignore", "Destination indexes to ignore proxy settings")
Printf(" %-28s %s\n", "-version", "View version page")
Expand Down
4 changes: 4 additions & 0 deletions cmd/localrelay/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func newRelay(opt *options, i int, cmd []string) error {
Private: opt.key,
},

Loadbalance: Loadbalance{
Enabled: opt.loadbalance,
},

Proxies: make(map[string]Proxy),
AutoRestart: !opt.DisableAutoStart,
}
Expand Down

0 comments on commit a439472

Please sign in to comment.