mirror of
https://github.com/amitbet/vncproxy.git
synced 2025-09-10 17:39:23 +00:00
Added server for web sockets, plus some refactoring
This commit is contained in:
@@ -3,24 +3,19 @@ package server
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"net"
|
||||
"testing"
|
||||
"vncproxy/common"
|
||||
"vncproxy/encodings"
|
||||
)
|
||||
|
||||
func TestServer(t *testing.T) {
|
||||
ln, err := net.Listen("tcp", ":5903")
|
||||
if err != nil {
|
||||
log.Fatalf("Error listen. %v", err)
|
||||
}
|
||||
|
||||
chServer := make(chan common.ClientMessage)
|
||||
chClient := make(chan common.ServerMessage)
|
||||
|
||||
cfg := &ServerConfig{
|
||||
//SecurityHandlers: []SecurityHandler{&ServerAuthNone{}, &ServerAuthVNC{}},
|
||||
SecurityHandlers: []SecurityHandler{&ServerAuthVNC{}},
|
||||
SecurityHandlers: []SecurityHandler{&ServerAuthVNC{"Ch_#!T@8"}},
|
||||
Encodings: []common.Encoding{&encodings.RawEncoding{}, &encodings.TightEncoding{}, &encodings.CopyRectEncoding{}},
|
||||
PixelFormat: common.NewPixelFormat(32),
|
||||
ClientMessageCh: chServer,
|
||||
@@ -29,10 +24,10 @@ func TestServer(t *testing.T) {
|
||||
DesktopName: []byte("workDesk"),
|
||||
Height: uint16(768),
|
||||
Width: uint16(1024),
|
||||
|
||||
}
|
||||
go Serve(context.Background(), ln, cfg)
|
||||
|
||||
url := "http://localhost:8091/"
|
||||
go WsServe(url, context.Background(), cfg)
|
||||
go TcpServe(":5903", context.Background(), cfg)
|
||||
// Process messages coming in on the ClientMessage channel.
|
||||
for {
|
||||
msg := <-chClient
|
||||
|
Reference in New Issue
Block a user