Basic browser gateway target support

This commit is contained in:
Owen
2026-05-13 16:24:26 -07:00
parent bd53edf8e4
commit 559b7021fe
5 changed files with 170 additions and 18 deletions
+6
View File
@@ -8,6 +8,7 @@ import (
"log"
"net"
"net/http"
"strconv"
"time"
"github.com/coder/websocket"
@@ -56,6 +57,11 @@ func (g *Gateway) HandleSSH(w http.ResponseWriter, r *http.Request) {
if port == "" {
port = "22"
}
sshPort, _ := strconv.Atoi(port)
if !g.isAllowed("ssh", host, sshPort) {
http.Error(w, "destination not allowed", http.StatusForbidden)
return
}
target = net.JoinHostPort(host, port)
}