mirror of
				https://github.com/amitbet/vncproxy.git
				synced 2025-10-31 00:58:48 +00:00 
			
		
		
		
	Compare commits
	
		
			16 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | ea8f9b5109 | ||
|  | faa9021021 | ||
|  | 1c052273de | ||
|  | f07be04814 | ||
|  | 55cf83519a | ||
|  | 92ee157817 | ||
|  | f635a73757 | ||
|  | 149e26b6f7 | ||
|  | 3d42d4fa5f | ||
|  | f66f550c77 | ||
|  | c7ac36d15f | ||
|  | 0ba10fab76 | ||
|  | 76299f1bc3 | ||
|  | a9dce0e6c6 | ||
|  | fa416220ea | ||
|  | efc5741057 | 
							
								
								
									
										129
									
								
								.circleci/config.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										129
									
								
								.circleci/config.yml
									
									
									
									
									
										Normal 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 | ||||
| @@ -1,4 +1,5 @@ | ||||
| # VncProxy | ||||
| # VncProxy [](https://circleci.com/gh/amitbet/vncproxy/tree/master) [](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) | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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) | ||||
|  | ||||
|   | ||||
| @@ -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{ | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user