mirror of
https://github.com/amitbet/vncproxy.git
synced 2025-07-01 08:32:10 +00:00
Fix recording bug in proxy
This change fixes a bug in the proxy session recording management, where the proxy would record sessions even if the user didn't provide a value for the `-recDir` CLI flag.
This commit is contained in:
parent
3e882d6140
commit
06e555775f
@ -1,9 +1,12 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "vncproxy/proxy"
|
import (
|
||||||
import "flag"
|
"flag"
|
||||||
import "vncproxy/logger"
|
"os"
|
||||||
import "os"
|
|
||||||
|
"vncproxy/logger"
|
||||||
|
vncproxy "vncproxy/proxy"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
//create default session if required
|
//create default session if required
|
||||||
@ -34,30 +37,32 @@ func main() {
|
|||||||
if *vncPass == "" {
|
if *vncPass == "" {
|
||||||
logger.Warn("proxy will have no password")
|
logger.Warn("proxy will have no password")
|
||||||
}
|
}
|
||||||
if *recordDir == "" {
|
|
||||||
logger.Warn("FBS recording is turned off")
|
|
||||||
}
|
|
||||||
|
|
||||||
tcpUrl := ""
|
tcpUrl := ""
|
||||||
if *tcpPort != "" {
|
if *tcpPort != "" {
|
||||||
tcpUrl = ":" + string(*tcpPort)
|
tcpUrl = ":" + string(*tcpPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy := &proxy.VncProxy{
|
proxy := &vncproxy.VncProxy{
|
||||||
WsListeningUrl: "http://0.0.0.0:" + string(*wsPort) + "/", // empty = not listening on ws
|
WsListeningUrl: "http://0.0.0.0:" + string(*wsPort) + "/", // empty = not listening on ws
|
||||||
RecordingDir: *recordDir, //"/Users/amitbet/vncRec", // empty = no recording
|
|
||||||
TcpListeningUrl: tcpUrl,
|
TcpListeningUrl: tcpUrl,
|
||||||
ProxyVncPassword: *vncPass, //empty = no auth
|
ProxyVncPassword: *vncPass, //empty = no auth
|
||||||
SingleSession: &proxy.VncSession{
|
SingleSession: &vncproxy.VncSession{
|
||||||
TargetHostname: *targetVncHost,
|
TargetHostname: *targetVncHost,
|
||||||
TargetPort: *targetVncPort,
|
TargetPort: *targetVncPort,
|
||||||
TargetPassword: *targetVncPass, //"vncPass",
|
TargetPassword: *targetVncPass, //"vncPass",
|
||||||
ID: "dummySession",
|
ID: "dummySession",
|
||||||
Status: proxy.SessionStatusInit,
|
Status: vncproxy.SessionStatusInit,
|
||||||
Type: proxy.SessionTypeRecordingProxy,
|
Type: vncproxy.SessionTypeProxyPass,
|
||||||
}, // to be used when not using sessions
|
}, // to be used when not using sessions
|
||||||
UsingSessions: false, //false = single session - defined in the var above
|
UsingSessions: false, //false = single session - defined in the var above
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *recordDir != "" {
|
||||||
|
logger.Warn("FBS recording is turned on")
|
||||||
|
proxy.RecordingDir = *recordDir
|
||||||
|
proxy.SingleSession.Type = vncproxy.SessionTypeRecordingProxy
|
||||||
|
}
|
||||||
|
|
||||||
proxy.StartListening()
|
proxy.StartListening()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user