Compare commits

...

16 Commits
1.11 ... master

Author SHA1 Message Date
Amit Bezalel
ea8f9b5109
Merge pull request #16 from t-yuki/patch-1
Fix nil reference error for color map message
2020-01-18 10:43:10 +02:00
Yukinari Toyota
faa9021021
Update server-messages.go
Fix nil reference error
2020-01-17 13:21:09 +09:00
Bezalel
1c052273de Fix noVnc 1.1.0 problem (bad message type 248) 2019-12-19 07:56:00 +02:00
amit b
f07be04814 use circle 2019-06-16 20:38:05 +03:00
amit b
55cf83519a remove temp build dirs 2019-06-16 20:30:12 +03:00
amit b
92ee157817 fixing artifact collection 2019-06-16 20:20:10 +03:00
amit b
f635a73757 Merge branch 'master' of https://github.com/amitbet/VncProxy 2019-06-16 20:17:21 +03:00
amit b
149e26b6f7 added packaging to build 2019-06-16 20:16:22 +03:00
Amit Bezalel
3d42d4fa5f
changed badge style 2019-06-16 03:11:33 +03:00
Amit Bezalel
f66f550c77
added circleCI badge 2019-06-16 03:09:29 +03:00
amit b
c7ac36d15f remove steps in circleCI config 2019-06-16 03:04:55 +03:00
amit b
0ba10fab76 fixed cicrleCI testing 2019-06-16 02:59:17 +03:00
amit b
76299f1bc3 fixed error found in circleCI testing 2019-06-16 02:51:50 +03:00
amit b
a9dce0e6c6 Merge branch 'master' of https://github.com/amitbet/VncProxy 2019-06-16 02:37:07 +03:00
amit b
fa416220ea add circleCI config 2019-06-16 02:36:39 +03:00
Amit Bezalel
efc5741057
Update README.md
Added qemu to tested servers list
2018-12-04 19:03:16 +02:00
7 changed files with 144 additions and 8 deletions

129
.circleci/config.yml Normal file
View File

@ -0,0 +1,129 @@
version: 2 # use CircleCI 2.0
jobs: # basic units of work in a run
build: # runs not using Workflows must have a `build` job as entry point
docker: # run the steps with Docker
# CircleCI Go images available at: https://hub.docker.com/r/circleci/golang/
- image: circleci/golang:1.12
# CircleCI PostgreSQL images available at: https://hub.docker.com/r/circleci/postgres/
- image: circleci/postgres:9.6-alpine
environment: # environment variables for primary container
POSTGRES_USER: circleci-demo-go
POSTGRES_DB: circle_test
parallelism: 2
environment: # environment variables for the build itself
TEST_RESULTS: /tmp/test-results # path to where test results will be saved
steps: # steps that comprise the `build` job
- checkout # check out source code to working directory
- run: mkdir -p $TEST_RESULTS # create the test results directory
- restore_cache: # restores saved cache if no changes are detected since last run
keys:
- go-mod-v4-{{ checksum "go.sum" }}
# Wait for Postgres to be ready before proceeding
- run:
name: Waiting for Postgres to be ready
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Run unit tests
environment: # environment variables for the database url and path to migration files
CONTACTS_DB_URL: "postgres://circleci-demo-go@localhost:5432/circle_test?sslmode=disable"
CONTACTS_DB_MIGRATIONS: /home/circleci/project/db/migrations
# store the results of our tests in the $TEST_RESULTS directory
command: |
PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report.xml -- $PACKAGE_NAMES
# Build
- run:
name: Build and package all OS flavors
command: |
#!/bin/bash
sum="sha1sum"
# VERSION=`date -u +%Y%m%d`
VERSION="v1.11"
LDFLAGS="-X main.VERSION=$VERSION -s -w"
GCFLAGS=""
if ! hash sha1sum 2>/dev/null; then
if ! hash shasum 2>/dev/null; then
echo "I can't see 'sha1sum' or 'shasum'"
echo "Please install one of them!"
exit
fi
sum="shasum"
fi
UPX=false
if hash upx 2>/dev/null; then
UPX=true
fi
OSES=( linux darwin windows )
ARCHS=(amd64 386 )
for os in ${OSES[@]}; do
for arch in ${ARCHS[@]}; do
suffix=""
if [ "$os" == "windows" ]
then
suffix=".exe"
fi
env CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o ./dist/${os}_${arch}/recorder${suffix} ./recorder/cmd
env CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o ./dist/${os}_${arch}/player${suffix} ./player/cmd
env CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o ./dist/${os}_${arch}/proxy${suffix} ./proxy/cmd
if $UPX; then upx -9 client_${os}_${arch}${suffix} server_${os}_${arch}${suffix};fi
# tar -zcf ./dist/${CIRCLE_PROJECT_REPONAME}-${os}-${arch}-$VERSION.tar.gz ./dist/${os}_${arch}/proxy${suffix} ./dist/${os}_${arch}/player${suffix} ./dist/${os}_${arch}/recorder${suffix}
cd dist/${os}_${arch}/
zip -D -q -r ../${CIRCLE_PROJECT_REPONAME}-${os}-${arch}-$VERSION.zip proxy${suffix} player${suffix} recorder${suffix}
cd ../..
export
$sum ./dist/${CIRCLE_PROJECT_REPONAME}-${os}-${arch}-$VERSION.zip
rm -rf ./dist/${os}_${arch}/
done
done
- store_artifacts: # upload test summary for display in Artifacts
path: ./dist
destination: release-artifacts
# - run: make # pull and build dependencies for the project
# - save_cache:
# key: go-mod-v4-{{ checksum "go.sum" }}
# paths:
# - "/go/pkg/mod"
# - run:
# name: Start service
# environment:
# CONTACTS_DB_URL: "postgres://circleci-demo-go@localhost:5432/circle_test?sslmode=disable"
# CONTACTS_DB_MIGRATIONS: /home/circleci/project/db/migrations
# command: ./workdir/contacts
# background: true # keep service running and proceed to next step
# - run:
# name: Validate service is working
# command: |
# sleep 5
# curl --retry 10 --retry-delay 1 -X POST --header "Content-Type: application/json" -d '{"email":"test@example.com","name":"Test User"}' http://localhost:8080/contacts
# - store_artifacts: # upload test summary for display in Artifacts
# path: /tmp/test-results
# destination: raw-test-output
# - store_test_results: # upload test results for display in Test Summary
# path: /tmp/test-results
workflows:
version: 2
build-workflow:
jobs:
- build

View File

@ -1,4 +1,5 @@
# VncProxy
# VncProxy [![CircleCI](https://circleci.com/gh/amitbet/vncproxy/tree/master.svg?style=shield)](https://circleci.com/gh/amitbet/vncproxy/tree/master) [![MIT Licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/CircleCI-Public/circleci-demo-go/master/LICENSE.md)
An RFB proxy, written in go that can save and replay FBS files
* Supports all modern encodings & most useful pseudo-encodings
* Supports multiple VNC client connections & multi servers (chosen by sessionId)
@ -15,6 +16,7 @@ An RFB proxy, written in go that can save and replay FBS files
- ChickenOfTheVnc(client)
- VineVnc(server)
- TigerVnc(client)
- Qemu vnc(server)
### Executables (see releases)

View File

@ -4,11 +4,11 @@ import (
"bytes"
"encoding/binary"
"fmt"
"github.com/amitbet/vncproxy/common"
"github.com/amitbet/vncproxy/logger"
"io"
"net"
"unicode"
"github.com/amitbet/vncproxy/common"
"github.com/amitbet/vncproxy/logger"
)
// A ServerMessage implements a message sent from the server to the client.
@ -146,7 +146,7 @@ func (c *ClientConn) CutText(text string) error {
for _, char := range text {
if char > unicode.MaxLatin1 {
return fmt.Errorf("Character '%s' is not valid Latin-1", char)
return fmt.Errorf("Character '%v' is not valid Latin-1", char)
}
if err := binary.Write(&buf, binary.BigEndian, uint8(char)); err != nil {
@ -474,6 +474,7 @@ func (c *ClientConn) mainLoop() {
new(MsgSetColorMapEntries),
new(MsgBell),
new(MsgServerCutText),
new(MsgServerFence),
}
for _, msg := range defaultMessages {

View File

@ -129,7 +129,7 @@ type MsgSetColorMapEntries struct {
}
func (fbm *MsgSetColorMapEntries) CopyTo(r io.Reader, w io.Writer, c common.IClientConn) error {
reader := &common.RfbReadHelper{Reader: r}
reader := common.NewRfbReadHelper(r)
writeTo := &WriteTo{w, "MsgSetColorMapEntries.CopyTo"}
reader.Listeners.AddListener(writeTo)
_, err := fbm.Read(c, reader)

View File

@ -3,6 +3,7 @@ package player
import (
"testing"
"time"
"github.com/amitbet/vncproxy/common"
"github.com/amitbet/vncproxy/encodings"
"github.com/amitbet/vncproxy/logger"
@ -10,7 +11,7 @@ import (
)
func TestServer(t *testing.T) {
t.Skip("this isn't an automated test, just an entrypoint for debugging")
//chServer := make(chan common.ClientMessage)
//chClient := make(chan common.ServerMessage)

View File

@ -4,11 +4,12 @@ import "testing"
func TestProxy(t *testing.T) {
//create default session if required
t.Skip("this isn't an automated test, just an entrypoint for debugging")
proxy := &VncProxy{
WsListeningUrl: "http://0.0.0.0:7778/", // empty = not listening on ws
WsListeningURL: "http://0.0.0.0:7778/", // empty = not listening on ws
RecordingDir: "d:\\", // empty = no recording
TcpListeningUrl: ":5904",
TCPListeningURL: ":5904",
//RecordingDir: "C:\\vncRec", // empty = no recording
ProxyVncPassword: "1234", //empty = no auth
SingleSession: &VncSession{

View File

@ -3,6 +3,7 @@ package server
import (
"log"
"testing"
"github.com/amitbet/vncproxy/common"
"github.com/amitbet/vncproxy/encodings"
)
@ -13,6 +14,7 @@ func newServerConnHandler(cfg *ServerConfig, conn *ServerConn) error {
}
func TestServer(t *testing.T) {
t.Skip("this isn't an automated test, just an entrypoint for debugging")
//chServer := make(chan common.ClientMessage)
chClient := make(chan common.ServerMessage)