From 970fb39b05a66f6e4e4959b41f1ea75aa0633c00 Mon Sep 17 00:00:00 2001 From: lucasew Date: Sun, 13 Oct 2024 16:17:14 -0300 Subject: [PATCH] expose the http port in port 80 instead of 443 if not using funnel Signed-off-by: lucasew --- cmd/ts-proxyd/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/ts-proxyd/main.go b/cmd/ts-proxyd/main.go index 33080af..d509c45 100644 --- a/cmd/ts-proxyd/main.go +++ b/cmd/ts-proxyd/main.go @@ -5,6 +5,7 @@ import ( "github.com/lucasew/ts-proxy" "log" "net/url" + "github.com/davecgh/go-spew/spew" ) var options tsproxy.TailscaleProxyServerOptions @@ -16,9 +17,15 @@ func init() { flag.BoolVar(&options.EnableFunnel, "f", false, "Enable tailscale funnel") flag.StringVar(&options.Hostname, "n", "", "Hostname in tailscale devices list") flag.StringVar(&options.StateDir, "s", "", "State directory") - flag.StringVar(&options.Addr, "addr", ":443", "Port to listen") + flag.Parse() + defaultPort := ":80" + if options.EnableFunnel { + defaultPort = ":443" + } + flag.StringVar(&options.Addr, "addr", defaultPort, "Port to listen") flag.Parse() options.Upstream, err = url.Parse(remoteHost) + spew.Dump(options) if err != nil { log.Fatal(err) }