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.
This commit is contained in:
Anders Pitman 2021-01-13 10:22:19 -07:00
parent c0f884f049
commit e09a7d91df

3
api.go
View File

@ -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
}
}
}