mirror of
https://github.com/amitbet/vncproxy.git
synced 2025-05-01 20:33:31 +00:00
fixed proxy cmdline parameters and logs
This commit is contained in:
parent
33be77dedc
commit
82e1549c4f
2
build.sh
2
build.sh
@ -2,7 +2,7 @@
|
|||||||
sum="sha1sum"
|
sum="sha1sum"
|
||||||
|
|
||||||
# VERSION=`date -u +%Y%m%d`
|
# VERSION=`date -u +%Y%m%d`
|
||||||
VERSION="v1.02"
|
VERSION="v1.11"
|
||||||
LDFLAGS="-X main.VERSION=$VERSION -s -w"
|
LDFLAGS="-X main.VERSION=$VERSION -s -w"
|
||||||
GCFLAGS=""
|
GCFLAGS=""
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/amitbet/vncproxy/logger"
|
"github.com/amitbet/vncproxy/logger"
|
||||||
vncproxy "github.com/amitbet/vncproxy/proxy"
|
vncproxy "github.com/amitbet/vncproxy/proxy"
|
||||||
@ -39,14 +40,17 @@ func main() {
|
|||||||
logger.Warn("proxy will have no password")
|
logger.Warn("proxy will have no password")
|
||||||
}
|
}
|
||||||
|
|
||||||
tcpUrl := ""
|
tcpURL := ""
|
||||||
if *tcpPort != "" {
|
if *tcpPort != "" {
|
||||||
tcpUrl = ":" + string(*tcpPort)
|
tcpURL = ":" + string(*tcpPort)
|
||||||
|
}
|
||||||
|
wsURL := ""
|
||||||
|
if *wsPort != "" {
|
||||||
|
wsURL = "http://0.0.0.0:" + string(*wsPort) + "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy := &vncproxy.VncProxy{
|
proxy := &vncproxy.VncProxy{
|
||||||
WsListeningUrl: "http://0.0.0.0:" + string(*wsPort) + "/", // empty = not listening on ws
|
WsListeningURL: wsURL, // empty = not listening on ws
|
||||||
TcpListeningUrl: tcpUrl,
|
TCPListeningURL: tcpURL,
|
||||||
ProxyVncPassword: *vncPass, //empty = no auth
|
ProxyVncPassword: *vncPass, //empty = no auth
|
||||||
SingleSession: &vncproxy.VncSession{
|
SingleSession: &vncproxy.VncSession{
|
||||||
Target: *targetVnc,
|
Target: *targetVnc,
|
||||||
@ -61,9 +65,15 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if *recordDir != "" {
|
if *recordDir != "" {
|
||||||
logger.Warn("FBS recording is turned on")
|
fullPath, err := filepath.Abs(*recordDir)
|
||||||
proxy.RecordingDir = *recordDir
|
if err != nil {
|
||||||
|
logger.Error("bad recording path: ", err)
|
||||||
|
}
|
||||||
|
logger.Info("FBS recording is turned on, writing to dir: ", fullPath)
|
||||||
|
proxy.RecordingDir = fullPath
|
||||||
proxy.SingleSession.Type = vncproxy.SessionTypeRecordingProxy
|
proxy.SingleSession.Type = vncproxy.SessionTypeRecordingProxy
|
||||||
|
} else {
|
||||||
|
logger.Info("FBS recording is turned off")
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy.StartListening()
|
proxy.StartListening()
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/amitbet/vncproxy/client"
|
"github.com/amitbet/vncproxy/client"
|
||||||
"github.com/amitbet/vncproxy/common"
|
"github.com/amitbet/vncproxy/common"
|
||||||
"github.com/amitbet/vncproxy/encodings"
|
"github.com/amitbet/vncproxy/encodings"
|
||||||
@ -15,8 +16,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type VncProxy struct {
|
type VncProxy struct {
|
||||||
TcpListeningUrl string // empty = not listening on tcp
|
TCPListeningURL string // empty = not listening on tcp
|
||||||
WsListeningUrl string // empty = not listening on ws
|
WsListeningURL string // empty = not listening on ws
|
||||||
RecordingDir string // empty = no recording
|
RecordingDir string // empty = no recording
|
||||||
ProxyVncPassword string //empty = no auth
|
ProxyVncPassword string //empty = no auth
|
||||||
SingleSession *VncSession // to be used when not using sessions
|
SingleSession *VncSession // to be used when not using sessions
|
||||||
@ -185,19 +186,19 @@ func (vp *VncProxy) StartListening() {
|
|||||||
UseDummySession: !vp.UsingSessions,
|
UseDummySession: !vp.UsingSessions,
|
||||||
}
|
}
|
||||||
|
|
||||||
if vp.TcpListeningUrl != "" && vp.WsListeningUrl != "" {
|
if vp.TCPListeningURL != "" && vp.WsListeningURL != "" {
|
||||||
logger.Infof("running two listeners: tcp port: %s, ws url: %s", vp.TcpListeningUrl, vp.WsListeningUrl)
|
logger.Infof("running two listeners: tcp port: %s, ws url: %s", vp.TCPListeningURL, vp.WsListeningURL)
|
||||||
|
|
||||||
go server.WsServe(vp.WsListeningUrl, cfg)
|
go server.WsServe(vp.WsListeningURL, cfg)
|
||||||
server.TcpServe(vp.TcpListeningUrl, cfg)
|
server.TcpServe(vp.TCPListeningURL, cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if vp.WsListeningUrl != "" {
|
if vp.WsListeningURL != "" {
|
||||||
logger.Infof("running ws listener url: %s", vp.WsListeningUrl)
|
logger.Infof("running ws listener url: %s", vp.WsListeningURL)
|
||||||
server.WsServe(vp.WsListeningUrl, cfg)
|
server.WsServe(vp.WsListeningURL, cfg)
|
||||||
}
|
}
|
||||||
if vp.TcpListeningUrl != "" {
|
if vp.TCPListeningURL != "" {
|
||||||
logger.Infof("running tcp listener on port: %s", vp.TcpListeningUrl)
|
logger.Infof("running tcp listener on port: %s", vp.TCPListeningURL)
|
||||||
server.TcpServe(":"+vp.TcpListeningUrl, cfg)
|
server.TcpServe(vp.TCPListeningURL, cfg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user