From e09a7d91dfc18eade3dfe211ccfec84195099ea6 Mon Sep 17 00:00:00 2001 From: Anders Pitman Date: Wed, 13 Jan 2021 10:22:19 -0700 Subject: [PATCH] Override tunnel SSH server ports at runtime This is a bit of a hack. Problem is if the server is restarted with a different SSH port, all the tunnels in the db have the incorrect port setting, so we're overriding at runtime. Really should update all the db entries but that's messy too. Probably the real solution is to decouple runtime tunnel settings from permanent tunnel settings, and only store the permanent ones in the db. --- api.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api.go b/api.go index 9ea0bf3..b05d791 100644 --- a/api.go +++ b/api.go @@ -64,6 +64,9 @@ func (a *Api) handleTunnels(w http.ResponseWriter, r *http.Request) { for k, tun := range tunnels { if tun.ClientName != clientName { delete(tunnels, k) + } else { + tun.ServerPort = a.config.SshServerPort + tunnels[k] = tun } } }