Commit graph

59 commits

Author SHA1 Message Date
sergystepanov
431d215eee
Update server HTTPS configuration (#337)
* Merge HTTP and HTTPS routes builder in coordinator

* Extract HTTP/S routes

* Rename config in coordinator

* Generalize child services

* Extract games library helper function

* Use string address instead of port for HTTP/S

* Use a dedicated port extractor function

* Add missing GA tag templating

* Rename shared server address and port params

* Introduce TLS config parameters

* Simplify HTTP/S server constructors

* Update server auto port roll

* Extract init function in worker

* Reorder return params of address type port fn

* Refactor config handler names

* Update TLS default config params

* Extract HTTP to HTTPS redirect function

* Use httpx in monitoring

* Don't log echo requests

* Remove error return from the abstract server

* Add WSS option to the worker-coordinator connection

* Change default worker config

* Make worker send its internal connection params

* Decouple gamelib from the coordinator

* Expose HTTP/S listener address

* Keep original HTTP/S addresses

* Remove no config handler in worker

* Use HTTP-HTTPS redirection

* Wrap net.Listener into a struct

* Clean http server creation fn

* Redirect to https with a generated address

* Use URL in the redirector

* Use zone address param in worker

* Make use of actual addr and port in the monitoring servers

* Use auto-justified monitoring addresses info

* Add the non-HTTPS worker to HTTPS coordinator connection warning

* Embed TLS struct

* Move connection API struct into cws package
2021-08-09 10:42:06 +03:00
Sergey Stepanov
03fb03a71a
Rename old app references 2021-07-30 13:30:15 +03:00
sergystepanov
30d104ee98
Add version info into the apps (#330)
Both worker and coordinator display version number in the console during startup. Coordinator displays its version number in the top right corner of the index.html page.
2021-07-16 18:13:20 +03:00
sergystepanov
602b9ea47c
Make executables ready for static linking (#307)
* Disable CGO (C libs) for coordinator

Needed for static linking.

* Fix "error strings should not be capitalized (ST1005)"

* Fix SA1015

Using time.Tick leaks the underlying ticker, consider using it only in endless functions, tests and the main package, and use time.NewTicker here (SA1015)

* Fix SA9004

Only the first constant in this group has an explicit type (SA9004).

* Remove unused code in the webrtc package

* Fix S1000

Should use a simple channel send/receive instead of select with a single case (S1000).

* Force dir creation/check for core downloader

* Update Makefile release script

* Disable ASLR for worker builds

* Remove WORKER_BUILD_PARAMS flag from the CI

* Don't force recompilation in release

* Add Debian packages installer script

* Build worker app without libopusfile

* Test worker app without libopusfile

* Add opus wrapper without opusfile

* Make install.sh executable

* Add opus lib in Win builds

* Make insecure HTTPS requests when downloading libs

* Add ca-certificates for Docker build stage

go mod download works only with SSL certificates installed.

* Move libx264 wrapper into the repo

That way we can get rid of a lot of not needed external Go dependencies.

* Update the dependencies
2021-04-06 18:16:52 +03:00
sergystepanov
980a97a526
Handle no config situation for workers (#253)
(experimental feature)

Before a worker can start, it should have a configuration file. In case if such a file is not found it may request configuration from the coordinator to which it connected.

Added example logic if a worker is needed to be blocked until a successful packet exchange with a coordinator is being made.

* Add error return for config loader

* Add config loaded flag to worker

* Add zone flag

* Add a custom mutex lock with timout

* Refactor worker runtime

* Refactor internal api

* Extract monitoring server config

* Extract worker HTTP(S) server

* Add generic sub-server interface

* Add internal coordinator API

* Add internal routes and handlers to worker

* Add internal worker API

* Refactor worker run

* Migrate serverId call to new API

* Add packet handler to cws

* Extract handlers for internal worker routes in coordinator

* Pass worker to the worker internal heandlers

* Cleanup worker handlers in coordinator

* Add closeRoom packet handler to the API

* Add GetRoom packet handler to the API

* Add RegisterRoom packet handler to the API

* Add IceCandidate packet handler to the API (internal and browser)

* Add Heartbeat packet handler to the API (internal and browser)

* Rename worker routes init function

* Extract worker/coordinator internal ws handlers

* Update timed locker

* Allow sequential timed locks

* Add config request from workers

* Add nil check for the route registration functions
2021-01-03 21:23:55 +03:00
sergystepanov
1fcf34ee02
Add new Libretro core manager module (#249)
* Add initial external configuration files support.

These external configuration files allow changing app params at the runtime without recompilation.

* Find config files with specified directory in the tests

* Add aspect ratio recalculation config

* Clean code

* Add new configuration files into the Docker container image

* Add shared core and config paths into the Libretro cores config

* Split ROM <-> Emulator mapping between workers and coordinators

* Extract coordinator config

* Add shared worker/coordinator server config

* Add explicit embedded shared worker/coordinator struct for auto-config reflection fill

* Remove default stun/turn servers from the config

* Extract and add new ice servers config structures

* Update coordinator config params

* Add auto emulation lib loader based on the runtime OS/arch

* Update configuration structures

* Remove shared config embedding

* Add missing network config params

* Add game library external config

* Remove unused config parameters

* Add WebRTC encoder external options

* Add user dir for config search

* Update config loader

* Update config

* Add generic downloader with Grab lib implementation

* Add a simple file downloader backed by the grab lib

* Add initial Libretro core repos abstractions

* Expose compression info for Libretro cores repository records

* Add pipe-based abstract file downloader

* Refactor downloader

* Refactor Libretro repos

* Add worker coresync stubs

* Add multiprocess-safe HTTP-based core manager implementation

* Remove Libretro cores from the repo

* Keep custom N64 cores in te repo for now

* Add Libretro cores repo select in the config

* Fix http manager repo switch

* Cleanup code

* Add greedy Libretro lib loader

* Don't crash when arch map is not set

* Disable dynamic recompiler for pcsx core by default since it's could cause a crash

* Use global Libretro dynalib handler

* Shorten the default Libretro cores store path

* Update zip extractor implementation

* Remove explicit fig lib field markings

* Add config note to the README file

* Add GitHub repo backend for the core downloader

* Fix GitHub repo param list in the manager factory

* Add env variables reader with CLOUD_GAME prefix

* Re-optimize ice server info struct custom marshaler
2020-12-31 13:24:27 +03:00
sergystepanov
bd6e146e64
Fix errors/misuse with OpenGL-based core API (#237)
* Follow Go standard for naming constants

* Use reformatted pixFormats for Libretro cores

* Use OpenGL 2.1 Core profile bindings for render instead 4.1

* Cleanup the code

* SDL attributes should be set before the sdl.Init call

* Use simple vertical frame flip function instead imaging lib with OpenGL renderer

* Use the separate control flow for the macOS OpenGL context handling

* Add OpenGL pixel type/format switch based on cores callback

* Use unified log instead of fmt

* Clean code

* Remove unnecessary SDL init flag

* Printout errors with SDL / OpenGL functions

* Add CGO Libretro logging output

* Use main thread lock for windows and OpenGL context

* Remove Darwin OS switch

* Add extended OpenGL version info print

* Update Libretro cores info print

* Add game library module (#232)

* Add game library

* Add missing local game lib files

* Add missing return statement

* Use v2 suffix

* Bump the dependencies

* Update Libretro modules to support headless test runners

* Port old savestates tests as example for Libretro cores runner testing

* Add n64 core example game and a test

* Update room tests for various games

* Add frame dump support for CI builds

* Add frame rendering to image output for core testing

* Update ROM frame exporter in tests

* Disable Docker image publishing

* Add frame rendering output for non-gl cores for CI

* Add auto GL context override for headless, gpu-less machines (e.g. Github CI Xeon)

* Add Windows CI headless cores frame render config

* Add missing Mesa OpenGL drivers to Ubuntu CI

* Add mupen n64 core download into CI tests

* Add Linux, macOS, Windows core frame render tests into CI

* Remove unnecessary var

* Add some comments

* Revert Y flip

* Move OpenGL into a separate package

* Add SDL package

* Update modules
2020-11-04 18:59:12 +08:00
sergystepanov
a42aebec88
Migrate to v2 suffix (#231) 2020-10-04 23:21:03 +08:00
88hcsif
c23347db08
Add basic N64 support on Mac (#205)
Note: mupen64plus lib unload is not working properly on Mac, so stopping and restarting N64 emulation will cause a crash
2020-06-25 22:46:12 +08:00
giongto35
57ba14a3e6 Update coordinator 2020-03-26 21:57:03 +08:00
giongto35
59d4a3d9c2 update naming 2020-03-22 23:33:12 +08:00
giongto35
9558054449 Rename 2020-03-20 00:50:29 +08:00
giongto35
fde4a24158
Merge aspect ratio to master (#116)
* Add frame scaling support (#107)

* Update README.md with additional info about Windows builds

* Add frame scaling

* Add and enable bilinear scaling (#109)

* Add and enable bilinear scaling

* Use Go x/image lib for interpolation

* Reformat the code goimport/gofmt

* Move worker config into the pkg/worker directory

* Change separator in the save file path allowing it to work on Windows (#113)
2019-10-19 02:29:07 +08:00
Sadlil Rhythom
0e17092acb Refactor of cloud game overlord and overworker (#70)
* Introduce Makefile and go vendor directory for faster build

* WIP: Refactor cloud-game codebase with spliting overlord and worker binary

* Fix all issues and have a running build

* Complete first version of refactor
2019-09-12 03:35:21 +08:00
giongto35
0ed764ce77 Move gamelist to become a utility library, this package can be shared between overlord and worker (#72)
* Return games based on type

* Add nes extension also

* Update game list logic

* Add more files to diff
2019-08-27 07:26:33 +08:00
Sadlil Rhythom
f075846f74 Introduce Makefile and go vendor directory for faster build (#67) 2019-08-17 00:13:36 +08:00
giongto35
c7caa87624 Integrate with RetroArch to have Universal emulator. (#64)
* WIP

* Add libretro

* Update input retro

* Update cloud retro input:

* Integrate libretro remove GL

* Launch emulator by game type

* Save and load

* Update deeplink to game directly

* Done channel for naemulator

* each server handle only one session

* Only provide available clients

* Emulator based on game

* Remove all OpenGL related

* Retroarch audio

* Audio encoding mono

* Experiment with libretro audio

* Audio without datachannel

* Audio opus internal

* Remove unnecessary code

* Resampled

* Limit time frame

* Start Room and Audio by game

* Dynamic video image allocation

* Dynamic Video buffer allocation based on video resolution

* Move encoder to room

* width and height from emulator

* Padding images to fix multipler of 64

* Remove OpenGL

* Remove Open AL

* Remove OpenGL from Go mod

* Move away nanoarch logic in naemulator

* Remove unecessary savefiles.go

* Optimize Docker for caching

* Update ReadME

* Update README to introduce Retro

* Update README

* Update README.md
2019-08-02 22:06:26 +08:00
giongto35
dda0f1b446 Update to pion 2.0.23 + logic to skip private IP (#61)
* Remove unnecessary comments

* Update find best server by latencies

* Update README.md
2019-06-22 17:45:17 +08:00
giongto35
fafae16756 Match best worker based on latency + Experiment with Singapore Host (#60)
* Add echo endpoint

* Fix async

* Use latency map

* Only start webRTC after worker match

* Experiment with Singapore server

* Update comments
2019-06-21 03:47:35 +08:00
giongto35
1b39947541 Update latency 2019-06-19 04:31:09 +08:00
giongto35
2babe06950 Add prometheus client 2019-06-05 01:57:53 +08:00
giongto35
12ed615f53 Start worker port from 9000 (#47) 2019-06-03 02:41:35 +08:00
giongto35
aa6dfcb7f8 Fix icecandidate setup (#44)
* Use own stun server

* Add ice candidate

* Add turn server

* Up main_test

* Fix datachannel negotiated
2019-05-26 22:18:41 +08:00
trichimtrich
4721db201e Update new frontend (#38)
* WIP

* fix crlf

* fix crlf

* new gesture, menu, tooltip, share

* WIP share

* clear dusties and put magic

* oops

* Remove fade

* Update js behaviour
2019-05-25 13:16:32 +08:00
giongto35
48d6ddbf6d Use go mode + use pion v2 (#39)
* Update webrtv2

* Update gomod

* Update run local

* Update docker

* Update mario 3 rom

* Update script

* Throw error when overlord cannot launch
2019-05-25 12:10:04 +08:00
giongto35
facd0fdc01 Worker auto reconnect (#34)
* Change join to start

* WIP

* Use RouteWork to route worker call

* Add reconnect

* Update main test

* Remove fatal

* Update test

* Remove unnecessary
2019-05-23 19:23:45 +08:00
giongto35
a461415038 Worker listen to random port so we can run multiple worker 2019-05-21 23:54:31 +08:00
giongto35
0c4e851c0c Change done chan to 1 2019-05-20 15:16:56 +08:00
giongto35
b894375f99 Update run local 2019-05-19 23:55:41 +08:00
giongto35
c42ef403be Update closing websocket 2019-05-19 17:51:48 +08:00
giongto35
437cb25f87 Update comments 2019-05-19 13:24:24 +08:00
giongto35
e468db2d28 Update test 2019-05-19 13:13:09 +08:00
giongto35
4dc55b5cdb Clean code 2019-05-19 05:24:58 +08:00
giongto35
37254852b3 update architecture 2019-05-19 03:12:21 +08:00
trichimtrich
f8606baf51 Merge branch 'master' into frontend2 2019-05-15 02:10:18 +08:00
trichimtrich
6122deab8b WIP 2019-05-14 14:13:36 +08:00
giongto35
90cad6ee9d Add sleep 2019-05-12 17:55:03 +08:00
giongto35
d7cdf02cb7 Update test rejoin with overlord 2019-05-12 17:47:39 +08:00
giongto35
2b37360b2e update test comment 2019-05-12 17:37:04 +08:00
giongto35
38cc898976 Remove sleep 2019-05-12 15:13:18 +08:00
giongto35
6941b58455 Update test for reconnect with overlord 2019-05-12 15:11:59 +08:00
giongto35
97717c96d8 Update handshake signal 2019-05-12 13:30:48 +08:00
giongto35
01abdd2c1e Update test comments 2019-05-12 00:50:07 +08:00
giongto35
0eea6cfcc8 Close Leaked goroutine 2019-05-08 23:59:47 +08:00
giongto35
8a476c7d35 Remove session after rejoin few times 2019-05-04 01:52:05 +08:00
giongto35
745b391049 Separate room logic 2019-05-03 02:22:01 +08:00
giongto35
6b0a02a5db Update test path and game path 2019-05-03 01:49:23 +08:00
giongto35
46598b6ef7 Fix register room bug 2019-05-02 04:16:45 +08:00
giongto35
a104e7af96 Setup peerconnections for OverlordClient 2019-05-02 03:55:37 +08:00
giongto35
d9febbf0a9 Fix websocket 2019-05-02 03:01:58 +08:00