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

@@ -9,6 +9,7 @@ import (
"net"
"strings"
"tunnel_pls/internal/config"
"tunnel_pls/types"
)
func (hs *httpServer) ListenAndServeTLS() error {
@@ -89,7 +90,10 @@ func (hs *httpServer) handlerTLS(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) +