mirror of
https://github.com/amitbet/vncproxy.git
synced 2025-09-20 17:09:35 +00:00
added cmdline binaries for proxy and player
This commit is contained in:
57
proxy/cmd/main.go
Normal file
57
proxy/cmd/main.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package main
|
||||
|
||||
import "vncproxy/proxy"
|
||||
import "flag"
|
||||
import "fmt"
|
||||
import "vncproxy/logger"
|
||||
import "os"
|
||||
|
||||
func main() {
|
||||
fmt.Println("running!")
|
||||
//create default session if required
|
||||
var tcpPort = flag.String("tcpPort", "", "tcp port")
|
||||
var wsPort = flag.String("wsPort", "", "websocket port")
|
||||
var vncPass = flag.String("vncPass", "", "password on incoming vnc connections to the proxy, defaults to no password")
|
||||
var recordDir = flag.String("recDir", "", "path to save FBS recordings WILL NOT RECORD if not defined.")
|
||||
var targetVncPort = flag.String("targPort", "", "target vnc server port")
|
||||
var targetVncPass = flag.String("targPass", "", "target vnc password")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
if *tcpPort == "" && *wsPort == "" {
|
||||
logger.Error("no listening port defined")
|
||||
flag.Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if *targetVncPort == "" {
|
||||
logger.Error("no target vnc server port defined")
|
||||
flag.Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if *vncPass == "" {
|
||||
logger.Warn("proxy will have no password")
|
||||
}
|
||||
if *recordDir == "" {
|
||||
logger.Warn("FBS recording is turned off")
|
||||
}
|
||||
|
||||
proxy := &proxy.VncProxy{
|
||||
WsListeningUrl: "http://localhost:" + string(*wsPort) + "/", // empty = not listening on ws
|
||||
RecordingDir: *recordDir, //"/Users/amitbet/vncRec", // empty = no recording
|
||||
TcpListeningUrl: ":" + string(*tcpPort),
|
||||
ProxyVncPassword: *vncPass, //empty = no auth
|
||||
SingleSession: &proxy.VncSession{
|
||||
TargetHostname: "localhost",
|
||||
TargetPort: *targetVncPort,
|
||||
TargetPassword: *targetVncPass, //"vncPass",
|
||||
ID: "dummySession",
|
||||
//Status: SessionStatusActive,
|
||||
//Type: SessionTypeRecordingProxy,
|
||||
}, // to be used when not using sessions
|
||||
UsingSessions: false, //false = single session - defined in the var above
|
||||
}
|
||||
|
||||
proxy.StartListening()
|
||||
}
|
Reference in New Issue
Block a user