fix(api): monitor, replay

This commit is contained in:
ttk
2024-09-06 19:45:01 +08:00
parent 5a63cc375a
commit a30bd94541
6 changed files with 75 additions and 96 deletions

View File

@@ -7,7 +7,6 @@ import (
"strings"
"time"
"github.com/google/uuid"
"github.com/samber/lo"
"github.com/spf13/cast"
"github.com/veops/oneterm/conf"
@@ -44,7 +43,7 @@ type Tunnel struct {
gw *ggateway.GatewayTunnel
}
func NewTunnel(connectionId string, w, h, dpi int, protocol string, asset *model.Asset, account *model.Account, gateway *model.Gateway) (t *Tunnel, err error) {
func NewTunnel(connectionId, sessionId string, w, h, dpi int, protocol string, asset *model.Asset, account *model.Account, gateway *model.Gateway) (t *Tunnel, err error) {
conn, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", conf.Cfg.Guacd.Host, conf.Cfg.Guacd.Port), time.Second*3)
if err != nil {
return
@@ -88,7 +87,7 @@ func NewTunnel(connectionId string, w, h, dpi int, protocol string, asset *model
},
}
if t.ConnectionId == "" {
t.SessionId = uuid.New().String()
t.SessionId = sessionId
t.Config.Parameters["recording-name"] = t.SessionId
}
if gateway != nil && gateway.Id != 0 && t.ConnectionId == "" {