Added server for web sockets, plus some refactoring

This commit is contained in:
amit bezalel
2017-07-01 23:01:58 +03:00
parent 66c322c164
commit 076d8bb4cf
28 changed files with 1774 additions and 1716 deletions

View File

@@ -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