feat(session): use session key for registry

This commit is contained in:
2026-01-05 00:50:42 +07:00
parent d666ae5545
commit 8cc70fa45e
9 changed files with 114 additions and 49 deletions

View File

@@ -13,6 +13,7 @@ import (
"time"
"tunnel_pls/internal/config"
"tunnel_pls/session"
"tunnel_pls/types"
"golang.org/x/crypto/ssh"
)
@@ -313,7 +314,10 @@ func (hs *httpServer) handler(conn net.Conn) {
return
}
sshSession, err := hs.sessionRegistry.Get(slug)
sshSession, err := hs.sessionRegistry.Get(types.SessionKey{
Id: slug,
Type: types.HTTP,
})
if err != nil {
_, err = conn.Write([]byte("HTTP/1.1 301 Moved Permanently\r\n" +
fmt.Sprintf("Location: https://tunnl.live/tunnel-not-found?slug=%s\r\n", slug) +