mirror of
https://github.com/boringproxy/boringproxy.git
synced 2025-02-25 18:55:29 -06:00
fix for proxycmd
This commit is contained in:
parent
44d28d9990
commit
51a93c1626
@ -12,6 +12,7 @@ import (
|
||||
"os/exec"
|
||||
"net/http"
|
||||
"sync"
|
||||
"strings"
|
||||
"time"
|
||||
"io"
|
||||
|
||||
@ -308,7 +309,10 @@ func (c *Client) BoreTunnel(ctx context.Context, tunnel Tunnel) error {
|
||||
}
|
||||
} else {
|
||||
// Use SSH over proxy command
|
||||
cmd := exec.CommandContext(ctx, "sh", "-c", c.proxyCommand)
|
||||
tmpProxyCommand := strings.Replace(c.proxyCommand, "%h", tunnel.ServerAddress, -1)
|
||||
proxyCommand := strings.Replace(tmpProxyCommand, "%p", fmt.Sprintf("%d", tunnel.ServerPort), -1)
|
||||
|
||||
cmd := exec.CommandContext(ctx, "sh", "-c", proxyCommand)
|
||||
stdin, err := cmd.StdinPipe()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to setup proxy command stdin: %v", err)
|
||||
|
@ -97,6 +97,7 @@ func main() {
|
||||
dnsServer := flagSet.String("dns-server", "", "Custom DNS server")
|
||||
behindProxy := flagSet.Bool("behind-proxy", false, "Whether we're running behind another reverse proxy")
|
||||
pollInterval := flagSet.Int("poll-interval-ms", 2000, "Interval in milliseconds to poll for tunnel changes")
|
||||
proxyCommand := flagSet.String("proxy-command", "", "ProxyCommand to use for outgoing connectin")
|
||||
|
||||
err := flagSet.Parse(os.Args[2:])
|
||||
if err != nil {
|
||||
@ -128,6 +129,7 @@ func main() {
|
||||
DnsServer: *dnsServer,
|
||||
BehindProxy: *behindProxy,
|
||||
PollInterval: *pollInterval,
|
||||
ProxyCommand: *proxyCommand,
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
Loading…
Reference in New Issue
Block a user