mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-20 01:56:00 +00:00
parent
10cb6d5092
commit
2cd48e0342
21 changed files with 170 additions and 266 deletions
4
Dockerfile
vendored
4
Dockerfile
vendored
|
|
@ -9,7 +9,7 @@ COPY . /cloud-game/
|
|||
WORKDIR /cloud-game
|
||||
|
||||
# Install server dependencies
|
||||
RUN go install ./cmd/overlord
|
||||
RUN go install ./cmd/overworker
|
||||
RUN go install ./cmd/coordinator
|
||||
RUN go install ./cmd/worker
|
||||
|
||||
EXPOSE 8000
|
||||
|
|
|
|||
24
Makefile
vendored
24
Makefile
vendored
|
|
@ -24,10 +24,10 @@ dep:
|
|||
|
||||
# NOTE: there is problem with go mod vendor when it delete github.com/gen2brain/x264-go/x264c causing unable to build. https://github.com/golang/go/issues/26366
|
||||
#build.cross: build
|
||||
# CGO_ENABLED=1 GOOS=darwin GOARC=amd64 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/overlord-darwin ./cmd/overlord
|
||||
# CGO_ENABLED=1 GOOS=darwin GOARC=amd64 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/overworker-darwin ./cmd/overworker
|
||||
# CC=arm-linux-musleabihf-gcc GOOS=linux GOARC=amd64 CGO_ENABLED=1 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/overlord-linu ./cmd/overlord
|
||||
# CC=arm-linux-musleabihf-gcc GOOS=linux GOARC=amd64 CGO_ENABLED=1 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/overworker-linux ./cmd/overworker
|
||||
# CGO_ENABLED=1 GOOS=darwin GOARC=amd64 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/coordinator-darwin ./cmd/coordinator
|
||||
# CGO_ENABLED=1 GOOS=darwin GOARC=amd64 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/worker-darwin ./cmd/worker
|
||||
# CC=arm-linux-musleabihf-gcc GOOS=linux GOARC=amd64 CGO_ENABLED=1 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/coordinator-linu ./cmd/coordinator
|
||||
# CC=arm-linux-musleabihf-gcc GOOS=linux GOARC=amd64 CGO_ENABLED=1 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/worker-linux ./cmd/worker
|
||||
|
||||
# A user can invoke tests in different ways:
|
||||
# - make test runs all tests;
|
||||
|
|
@ -64,20 +64,20 @@ dev.tools:
|
|||
./hack/scripts/install_tools.sh
|
||||
|
||||
dev.build: compile
|
||||
go build -a -tags netgo -ldflags '-w' -o bin/overlord ./cmd/overlord
|
||||
go build -a -tags netgo -ldflags '-w' -o bin/overworker ./cmd/overworker
|
||||
go build -a -tags netgo -ldflags '-w' -o bin/coordinator ./cmd/coordinator
|
||||
go build -a -tags netgo -ldflags '-w' -o bin/worker ./cmd/worker
|
||||
|
||||
dev.build-local:
|
||||
go build -o bin/overlord ./cmd/overlord
|
||||
go build -o bin/overworker ./cmd/overworker
|
||||
go build -o bin/coordinator ./cmd/coordinator
|
||||
go build -o bin/worker ./cmd/worker
|
||||
|
||||
dev.run: dev.build-local
|
||||
./bin/overlord --v=5 &
|
||||
./bin/overworker --overlordhost localhost:8000
|
||||
./bin/coordinator --v=5 &
|
||||
./bin/worker --coordinatorhost localhost:8000
|
||||
|
||||
dev.run-docker:
|
||||
docker build . -t cloud-game-local
|
||||
docker stop cloud-game-local || true
|
||||
docker rm cloud-game-local || true
|
||||
# Overlord and worker should be run separately.
|
||||
docker run --privileged -v $PWD/games:/cloud-game/games -d --name cloud-game-local -p 8000:8000 -p 9000:9000 cloud-game-local bash -c "overlord --v=5 & overworker --overlordhost localhost:8000"
|
||||
# Coordinator and worker should be run separately.
|
||||
docker run --privileged -v $PWD/games:/cloud-game/games -d --name cloud-game-local -p 8000:8000 -p 9000:9000 cloud-game-local bash -c "coordinator --v=5 & worker --coordinatorhost localhost:8000"
|
||||
|
|
|
|||
4
README.md
vendored
4
README.md
vendored
|
|
@ -70,8 +70,8 @@ Because the coordinator and workers need to run simultaneously. Workers connect
|
|||
* The scripts spawns 2 processes one in the background and one in foreground
|
||||
2. Manual
|
||||
* Need to run coordinator and worker separately in two session
|
||||
* `go run cmd/overlord/main.go` - spawn coordinator
|
||||
* `go run cmd/overworker/main.go --overlordhost localhost:8000` - spawn workers connecting to coordinator
|
||||
* `go run cmd/coordinator/main.go` - spawn coordinator
|
||||
* `go run cmd/worker/main.go --coordinatorhost localhost:8000` - spawn workers connecting to coordinator
|
||||
|
||||
## Wiki
|
||||
- [Wiki](https://github.com/giongto35/cloud-game/wiki)
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math/rand"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/giongto35/cloud-game/pkg/overlord"
|
||||
"github.com/giongto35/cloud-game/pkg/util/logging"
|
||||
"github.com/golang/glog"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
|
||||
cfg := overlord.NewDefaultConfig()
|
||||
cfg.AddFlags(pflag.CommandLine)
|
||||
|
||||
logging.Init()
|
||||
defer logging.Flush()
|
||||
|
||||
ctx, cancelCtx := context.WithCancel(context.Background())
|
||||
|
||||
glog.Infof("Initializing overlord server")
|
||||
glog.V(4).Infof("Overlord configs %v", cfg)
|
||||
o := overlord.New(ctx, cfg)
|
||||
if err := o.Run(); err != nil {
|
||||
glog.Errorf("Failed to run overlord server, reason %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
stop := make(chan os.Signal, 1)
|
||||
signal.Notify(stop, os.Interrupt)
|
||||
select {
|
||||
case <-stop:
|
||||
glog.Infoln("Received SIGTERM, Quiting Overlord")
|
||||
o.Shutdown()
|
||||
cancelCtx()
|
||||
}
|
||||
}
|
||||
16
docs/designdoc/README.md
vendored
16
docs/designdoc/README.md
vendored
|
|
@ -1,6 +1,6 @@
|
|||
# Web-based Cloud Gaming Service Design Document
|
||||
|
||||
Web-based Cloud Gaming Service contains multiple workers for gaming stream and a coordinator (Overlord) for distributing traffic and pairing up connection.
|
||||
Web-based Cloud Gaming Service contains multiple workers for gaming stream and a coordinator (Coordinator) for distributing traffic and pairing up connection.
|
||||
|
||||
## Worker
|
||||
|
||||
|
|
@ -12,14 +12,14 @@ Worker is responsible for streaming game to frontend
|
|||
- On the other hand, input from users is sent to workers over WebRTC DataChannel. Game logic on the emulator will be updated based on the input stream.
|
||||
- Game state is stored in cloud storage, so all workers can collaborate and keep the same understanding with each other. It allows user can continue from the saved state in the next time.
|
||||
|
||||
## Overlord
|
||||
## Coordinator
|
||||
|
||||
Overlord is loadbalancer and coordinator, which is in charge of picking the most suitable workers for a user. Every time a user connects to Overlord, it will collect all the metric from all workers, i.e free CPU resources and latency from worker to user. Overlord will decide the best candidate based on the metric and setup peer-to-peer connection between worker and user based on WebRTC protocol
|
||||
Coordinator is loadbalancer and coordinator, which is in charge of picking the most suitable workers for a user. Every time a user connects to Coordinator, it will collect all the metric from all workers, i.e free CPU resources and latency from worker to user. Coordinator will decide the best candidate based on the metric and setup peer-to-peer connection between worker and user based on WebRTC protocol
|
||||
|
||||

|
||||

|
||||
|
||||
1. A user connected to Overlord .
|
||||
2. Overlord will find the most suitable worker to serve the user.
|
||||
3. Overlord collects all latencies from workers to users as well as CPU usage on each machine.
|
||||
4. Overlord setup peer-to-peer handshake between worker and user by exchanging Session Description Protocol.
|
||||
1. A user connected to Coordinator .
|
||||
2. Coordinator will find the most suitable worker to serve the user.
|
||||
3. Coordinator collects all latencies from workers to users as well as CPU usage on each machine.
|
||||
4. Coordinator setup peer-to-peer handshake between worker and user by exchanging Session Description Protocol.
|
||||
5. A game is hosted on worker and streamed to the user.
|
||||
|
|
|
|||
16
docs/designdoc/implementation/README.md
vendored
16
docs/designdoc/implementation/README.md
vendored
|
|
@ -4,14 +4,14 @@
|
|||
```
|
||||
.
|
||||
├── cmd: service entrypoint
|
||||
│ ├── main.go: Spawn overlord or worker based on flag
|
||||
│ ├── main.go: Spawn coordinator or worker based on flag
|
||||
│ └── main_test.go
|
||||
├── static: static file for front end
|
||||
│ ├── js
|
||||
│ │ └── ws.js: client logic
|
||||
│ ├── game.html: frontend with gameboy ui
|
||||
│ └── index_ws.html: raw frontend without ui
|
||||
├── overlord: coordinator
|
||||
├── coordinator: coordinator
|
||||
│ ├── handlers.go: coordinator entrypoint
|
||||
│ ├── browser.go: router listening to browser
|
||||
│ └── worker.go: router listening to worker
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
│ │ ├── room.go: room logic
|
||||
│ │ └── media.go: video + audio encoding
|
||||
│ ├── handlers.go: worker entrypoint
|
||||
│ └── overlord.go: router listening to overlord
|
||||
│ └── coordinator.go: router listening to coordinator
|
||||
├── emulator: emulator internal
|
||||
│ ├── nes: NES device internal
|
||||
│ ├── director.go: coordinator of views
|
||||
|
|
@ -35,9 +35,9 @@
|
|||
Room is a fundamental part of the system. Each user session will spawn a room with a game running inside. There is a pipeline to encode images and audio and stream them out from emulator to user. The pipeline also listens to all input and streams to the emulator.
|
||||
|
||||
## Worker
|
||||
Worker is an instance that can be provisioned to scale up the traffic. There are multiple rooms inside a worker. Worker will listen to overlord events in `overlord.go`.
|
||||
Worker is an instance that can be provisioned to scale up the traffic. There are multiple rooms inside a worker. Worker will listen to coordinator events in `coordinator.go`.
|
||||
|
||||
## Overlord
|
||||
Overlord is the coordinator, which handles all communication with workers and frontend.
|
||||
Overlord will pair up a worker and a user for peer streaming. In WebRTC handshaking, two peers need to exchange their signature (Session Description Protocol) to initiate a peerconnection.
|
||||
Events come from frontend will be handled in `overlord/browser.go`. Events come from worker will be handled in `overlord/worker.go`. Overlord stays in the middle and relays handshake packages between workers and user.
|
||||
## Coordinator
|
||||
Coordinator is the coordinator, which handles all communication with workers and frontend.
|
||||
Coordinator will pair up a worker and a user for peer streaming. In WebRTC handshaking, two peers need to exchange their signature (Session Description Protocol) to initiate a peerconnection.
|
||||
Events come from frontend will be handled in `coordinator/browser.go`. Events come from worker will be handled in `coordinator/worker.go`. Coordinator stays in the middle and relays handshake packages between workers and user.
|
||||
|
|
|
|||
BIN
docs/img/overlord.png
vendored
BIN
docs/img/overlord.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB |
53
go.sum
vendored
53
go.sum
vendored
|
|
@ -11,13 +11,10 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
|
|||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE=
|
||||
github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/gen2brain/x264-go v0.0.0-20180306035800-58f586137654 h1:RNpogAT5Qz69YLIu6+92q5sSw61PjjhDj4upH2el5pk=
|
||||
github.com/gen2brain/x264-go v0.0.0-20180306035800-58f586137654/go.mod h1:17kvfYQKi9/QHiKPeqmJW0YuDPZEgy72tSBVmweSyiE=
|
||||
|
|
@ -32,7 +29,6 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekf
|
|||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
|
||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
|
|
@ -41,10 +37,8 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
|
|||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
|
|
@ -58,7 +52,6 @@ github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoA
|
|||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
|
|
@ -69,9 +62,7 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB
|
|||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/lucas-clemente/quic-go v0.7.1-0.20190401152353-907071221cf9 h1:tbuodUh2vuhOVZAdW3NEUvosFHUMJwUNl7jk/VSEiwc=
|
||||
github.com/lucas-clemente/quic-go v0.7.1-0.20190401152353-907071221cf9/go.mod h1:PpMmPfPKO9nKJ/psF49ESTAGQSdfXxlg1otPbEB2nOw=
|
||||
github.com/marten-seemann/qtls v0.2.3 h1:0yWJ43C62LsZt08vuQJDK1uC1czUc3FJeCLPoNAI4vA=
|
||||
github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
|
|
@ -81,20 +72,12 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
|
|||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/pion/datachannel v1.4.5 h1:paz18kYAetpTdK8tlMAtDY+Ayxrv5fndZ5XPZwiZHrU=
|
||||
github.com/pion/datachannel v1.4.5/go.mod h1:SpMJbuu8v+qbA94m6lWQwSdCf8JKQvgmdSHDNtcbe+w=
|
||||
github.com/pion/datachannel v1.4.13 h1:ezTn3AtUtXvKemRRjRdUgao/T8bH4ZJwrpOqU8Iz3Ss=
|
||||
github.com/pion/datachannel v1.4.13/go.mod h1:+rBUwEDonA63KXx994DP/ofyyGVAm6AIMvOqQZxjWRU=
|
||||
github.com/pion/dtls v1.5.0 h1:GtN3DJ0Fv5wC/Y04uOXT1zPeGA4C3HrsP1aAKsIBiU8=
|
||||
github.com/pion/dtls v1.5.0/go.mod h1:CjlPLfQdsTg3G4AEXjJp8FY5bRweBlxHrgoFrN+fQsk=
|
||||
github.com/pion/dtls/v2 v2.0.0-rc.3 h1:u9utI+EDJOjOWfrkGQsD8WNssPcTwfYIanFB6oI8K+4=
|
||||
github.com/pion/dtls/v2 v2.0.0-rc.3/go.mod h1:x0XH+cN5z+l/+/4nYL8r4sB8g6+0d1Zp2Pfkcoz8BKY=
|
||||
github.com/pion/ice v0.5.7 h1:1ZhyuFkwo0Nup7cRplz72ulghFXnZSpocD5YVJP90yg=
|
||||
github.com/pion/ice v0.5.7/go.mod h1:FSTDLP+ian3PtxRjervtyDP2AOqt2c6cvfebZ7dwLnI=
|
||||
github.com/pion/ice v0.7.2 h1:b+QxnpJ7AVyFDXBOMnEypNXS+fZM8+4+itNInwrrI6U=
|
||||
github.com/pion/ice v0.7.2/go.mod h1:xLKf+788DA/ZubtdBfiDT3vnEmIdiF5eDqjs4rzUAg8=
|
||||
github.com/pion/logging v0.2.1/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
|
||||
|
|
@ -102,48 +85,31 @@ github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
|
|||
github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
|
||||
github.com/pion/mdns v0.0.3 h1:DxdOYd0pgwLKiDlIIxfU0qdG5iWh1Xn6CsS9vc6cMAY=
|
||||
github.com/pion/mdns v0.0.3/go.mod h1:VrN3wefVgtfL8QgpEblPUC46ag1reLIfpqekCnKunLE=
|
||||
github.com/pion/quic v0.1.1 h1:D951FV+TOqI9A0rTF7tHx0Loooqz+nyzjEyj8o3PuMA=
|
||||
github.com/pion/quic v0.1.1/go.mod h1:zEU51v7ru8Mp4AUBJvj6psrSth5eEFNnVQK5K48oV3k=
|
||||
github.com/pion/rtcp v1.2.1 h1:S3yG4KpYAiSmBVqKAfgRa5JdwBNj4zK3RLUa8JYdhak=
|
||||
github.com/pion/rtcp v1.2.1/go.mod h1:a5dj2d6BKIKHl43EnAOIrCczcjESrtPuMgfmL6/K6QM=
|
||||
github.com/pion/rtp v1.1.3 h1:GTYSTsSLF5vH+UqShGYQEBdoYasWjTTC9UeYglnUO+o=
|
||||
github.com/pion/rtp v1.1.3/go.mod h1:/l4cvcKd0D3u9JLs2xSVI95YkfXW87a3br3nqmVtSlE=
|
||||
github.com/pion/rtp v1.1.4 h1:P6xh8Y8JfzR7+JAbI79X2M8kfYETaqbuM5Otm+Z+k6U=
|
||||
github.com/pion/rtp v1.1.4/go.mod h1:/l4cvcKd0D3u9JLs2xSVI95YkfXW87a3br3nqmVtSlE=
|
||||
github.com/pion/sctp v1.6.3/go.mod h1:cCqpLdYvgEUdl715+qbWtgT439CuQrAgy8BZTp0aEfA=
|
||||
github.com/pion/sctp v1.6.4 h1:edUNxTabSErLWOdeUUAxds8gwx5kGnFam4zL5DWpILk=
|
||||
github.com/pion/sctp v1.6.4/go.mod h1:cCqpLdYvgEUdl715+qbWtgT439CuQrAgy8BZTp0aEfA=
|
||||
github.com/pion/sctp v1.7.3 h1:Pok18oncuAq/WjNxbyltfBSLvbv/6QSCyVJKYyDWP5M=
|
||||
github.com/pion/sctp v1.7.3/go.mod h1:c6C9jaDGX7f5xeSRVju/140XatpO9sOVe81EwpfzAc8=
|
||||
github.com/pion/sdp/v2 v2.3.0 h1:5EhwPh1xKWYYjjvMuubHoMLy6M0B9U26Hh7q3f7vEGk=
|
||||
github.com/pion/sdp/v2 v2.3.0/go.mod h1:idSlWxhfWQDtTy9J05cgxpHBu/POwXN2VDRGYxT/EjU=
|
||||
github.com/pion/sdp/v2 v2.3.1 h1:45dub4NRdwyDmQCD3GIY7DZuqC49GBUwBdjuetvdOr0=
|
||||
github.com/pion/sdp/v2 v2.3.1/go.mod h1:jccXVYW0fuK6ds2pwKr89SVBDYlCjhgMI6nucl5R5rA=
|
||||
github.com/pion/srtp v1.2.6 h1:mHQuAMh0P67R7/j1F260u3O+fbRWLyjKLRPZYYvODFM=
|
||||
github.com/pion/srtp v1.2.6/go.mod h1:rd8imc5htjfs99XiEoOjLMEOcVjME63UHx9Ek9IGst0=
|
||||
github.com/pion/stun v0.3.1 h1:d09JJzOmOS8ZzIp8NppCMgrxGZpJ4Ix8qirfNYyI3BA=
|
||||
github.com/pion/stun v0.3.1/go.mod h1:xrCld6XM+6GWDZdvjPlLMsTU21rNxnO6UO8XsAvHr/M=
|
||||
github.com/pion/stun v0.3.3 h1:brYuPl9bN9w/VM7OdNzRSLoqsnwlyNvD9MVeJrHjDQw=
|
||||
github.com/pion/stun v0.3.3/go.mod h1:xrCld6XM+6GWDZdvjPlLMsTU21rNxnO6UO8XsAvHr/M=
|
||||
github.com/pion/transport v0.6.0/go.mod h1:iWZ07doqOosSLMhZ+FXUTq+TamDoXSllxpbGcfkCmbE=
|
||||
github.com/pion/transport v0.7.0/go.mod h1:iWZ07doqOosSLMhZ+FXUTq+TamDoXSllxpbGcfkCmbE=
|
||||
github.com/pion/transport v0.8.6 h1:xHQq2mxAjB+UrFs90aUBaXwlmIACfQAZnOiVAX3uqMw=
|
||||
github.com/pion/transport v0.8.6/go.mod h1:nAmRRnn+ArVtsoNuwktvAD+jrjSD7pA+H3iRmZwdUno=
|
||||
github.com/pion/transport v0.8.9/go.mod h1:lpeSM6KJFejVtZf8k0fgeN7zE73APQpTF83WvA1FVP8=
|
||||
github.com/pion/transport v0.8.10 h1:lTiobMEw2PG6BH/mgIVqTV2mBp/mPT+IJLaN8ZxgdHk=
|
||||
github.com/pion/transport v0.8.10/go.mod h1:tBmha/UCjpum5hqTWhfAEs3CO4/tHSg0MYRhSzR+CZ8=
|
||||
github.com/pion/turn v1.3.3 h1:jO8bYTgUZ7ls6BCVa5lIQhxu56UFc5afX1A50vfxFio=
|
||||
github.com/pion/turn v1.3.3/go.mod h1:zGPB7YYB/HTE9MWn0Sbznz8NtyfeVeanZ834cG/MXu0=
|
||||
github.com/pion/turn v1.4.0 h1:7NUMRehQz4fIo53Qv9ui1kJ0Kr1CA82I81RHKHCeM80=
|
||||
github.com/pion/turn v1.4.0/go.mod h1:aDSi6hWX/hd1+gKia9cExZOR0MU95O7zX9p3Gw/P2aU=
|
||||
github.com/pion/webrtc/v2 v2.1.2 h1:5c4g01cFyCa/yLNnWt8hc6HR+GyrH0sDPAMgKW/y0OU=
|
||||
github.com/pion/webrtc/v2 v2.1.2/go.mod h1:6+ovIHxDUZVgCVGP3JTEAyiy9Aa45q8u7/FebVhCy4c=
|
||||
github.com/pion/webrtc/v2 v2.1.16 h1:WxljXV1jj/1aOeMR1kkrQELYrvX9N6iQLLF0uUKtslk=
|
||||
github.com/pion/webrtc/v2 v2.1.16/go.mod h1:mnx1SpzMEnH34BJ3yzW3L5TPGqw0eH5q87nu9g7c5v4=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
|
|
@ -165,9 +131,7 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn
|
|||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4=
|
||||
|
|
@ -175,18 +139,14 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
|||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 h1:58fnuSXlxZmFdJyvtTFVmVhcMLU6v5fEb/ok4wyqtNU=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c h1:/nJuwDLoL/zrqY6gf57vxC+Pi+pZ8bfhpPkicO5H7W4=
|
||||
golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g=
|
||||
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067 h1:KYGJGHOQy8oSi1fDlSpcZF0+juKwk/hEMv5SiwHogR0=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 h1:hVwzHzIUGRjiF7EcUjqNxk3NCfkPxbDKRdnNE1Rpg0U=
|
||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
|
|
@ -211,9 +171,6 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR
|
|||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU=
|
||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271 h1:N66aaryRB3Ax92gH0v3hp1QYZ3zWWCCUR/j8Ifh45Ss=
|
||||
golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 h1:efeOvDhwQ29Dj3SdAV/MJf8oukgn+8D8WgaCaRMchF8=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
|
|
@ -234,16 +191,12 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h
|
|||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0=
|
||||
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191029155521-f43be2a4598c h1:S/FtSvpNLtFBgjTqcKsRpsa6aVsI6iztaz1bQd9BJwE=
|
||||
golang.org/x/sys v0.0.0-20191029155521-f43be2a4598c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191218084908-4a24b4065292 h1:Y8q0zsdcgAd+JU8VUA8p8Qv2YhuY9zevDG2ORt5qBUI=
|
||||
golang.org/x/sys v0.0.0-20191218084908-4a24b4065292/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
|
@ -272,7 +225,6 @@ google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E
|
|||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I=
|
||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
|
|
@ -286,19 +238,14 @@ google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiq
|
|||
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/hraban/opus.v2 v2.0.0-20180426093920-0f2e0b4fc6cd h1:oAcaGkUcXajq9yi+UKvzJMSKEb++XegVTSQjOlu3MVU=
|
||||
gopkg.in/hraban/opus.v2 v2.0.0-20180426093920-0f2e0b4fc6cd/go.mod h1:/L5E7a21VWl8DeuCPKxQBdVG5cy+L0MRZ08B1wnqt7g=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import (
|
|||
)
|
||||
|
||||
type Config struct {
|
||||
Port int
|
||||
OverlordAddress string
|
||||
Port int
|
||||
CoordinatorAddress string
|
||||
|
||||
// video
|
||||
Scale int
|
||||
|
|
@ -21,13 +21,13 @@ type Config struct {
|
|||
|
||||
func NewDefaultConfig() Config {
|
||||
return Config{
|
||||
Port: 8800,
|
||||
OverlordAddress: "localhost:8000",
|
||||
Scale: 1,
|
||||
EnableAspectRatio: false,
|
||||
Width: 320,
|
||||
Height: 240,
|
||||
Zone: "",
|
||||
Port: 8800,
|
||||
CoordinatorAddress: "localhost:8000",
|
||||
Scale: 1,
|
||||
EnableAspectRatio: false,
|
||||
Width: 320,
|
||||
Height: 240,
|
||||
Zone: "",
|
||||
MonitoringConfig: monitoring.ServerMonitoringConfig{
|
||||
Port: 6601,
|
||||
URLPrefix: "/worker",
|
||||
|
|
@ -37,8 +37,8 @@ func NewDefaultConfig() Config {
|
|||
}
|
||||
|
||||
func (c *Config) AddFlags(fs *pflag.FlagSet) *Config {
|
||||
fs.IntVarP(&c.Port, "port", "", 8800, "OverWorker server port")
|
||||
fs.StringVarP(&c.OverlordAddress, "overlordhost", "", c.OverlordAddress, "OverWorker URL to connect")
|
||||
fs.IntVarP(&c.Port, "port", "", 8800, "Worker server port")
|
||||
fs.StringVarP(&c.CoordinatorAddress, "coordinatorhost", "", c.CoordinatorAddress, "Worker URL to connect")
|
||||
fs.StringVarP(&c.Zone, "zone", "z", c.Zone, "Zone of the worker")
|
||||
|
||||
fs.IntVarP(&c.Scale, "scale", "s", c.Scale, "Set output viewport scale factor")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package overlord
|
||||
package coordinator
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
|
@ -20,8 +20,8 @@ func (s *Session) RouteBrowser() {
|
|||
})
|
||||
|
||||
browserClient.Receive("icecandidate", func(resp cws.WSPacket) cws.WSPacket {
|
||||
log.Println("Overlord: Received icecandidate from a browser", resp.Data)
|
||||
log.Println("Overlord: Relay icecandidate from a browser to worker")
|
||||
log.Println("Coordinator: Received icecandidate from a browser", resp.Data)
|
||||
log.Println("Coordinator: Relay icecandidate from a browser to worker")
|
||||
|
||||
wc, ok := s.handler.workerClients[s.ServerID]
|
||||
if !ok {
|
||||
|
|
@ -33,12 +33,12 @@ func (s *Session) RouteBrowser() {
|
|||
})
|
||||
|
||||
browserClient.Receive("initwebrtc", func(resp cws.WSPacket) cws.WSPacket {
|
||||
log.Println("Overlord: Received sdp request from a browser")
|
||||
log.Println("Overlord: Relay sdp request from a browser to worker")
|
||||
log.Println("Coordinator: Received sdp request from a browser")
|
||||
log.Println("Coordinator: Relay sdp request from a browser to worker")
|
||||
|
||||
// relay SDP to target worker and get back SDP of the worker
|
||||
// TODO: Async
|
||||
log.Println("Overlord: serverID: ", s.ServerID, resp.SessionID)
|
||||
log.Println("Coordinator: serverID: ", s.ServerID, resp.SessionID)
|
||||
resp.SessionID = s.ID
|
||||
wc, ok := s.handler.workerClients[s.ServerID]
|
||||
if !ok {
|
||||
|
|
@ -48,15 +48,15 @@ func (s *Session) RouteBrowser() {
|
|||
resp,
|
||||
)
|
||||
|
||||
log.Println("Overlord: Received sdp request from a worker")
|
||||
log.Println("Overlord: Sending back sdp to browser")
|
||||
log.Println("Coordinator: Received sdp request from a worker")
|
||||
log.Println("Coordinator: Sending back sdp to browser")
|
||||
|
||||
return sdp
|
||||
})
|
||||
|
||||
browserClient.Receive("quit", func(resp cws.WSPacket) (req cws.WSPacket) {
|
||||
log.Println("Overlord: Received quit request from a browser")
|
||||
log.Println("Overlord: Relay quit request from a browser to worker")
|
||||
log.Println("Coordinator: Received quit request from a browser")
|
||||
log.Println("Coordinator: Relay quit request from a browser to worker")
|
||||
|
||||
// TODO: Async
|
||||
resp.SessionID = s.ID
|
||||
|
|
@ -72,8 +72,8 @@ func (s *Session) RouteBrowser() {
|
|||
})
|
||||
|
||||
browserClient.Receive("start", func(resp cws.WSPacket) cws.WSPacket {
|
||||
log.Println("Overlord: Received start request from a browser")
|
||||
log.Println("Overlord: Relay start request from a browser to worker")
|
||||
log.Println("Coordinator: Received start request from a browser")
|
||||
log.Println("Coordinator: Relay start request from a browser to worker")
|
||||
// TODO: Async
|
||||
resp.SessionID = s.ID
|
||||
wc, ok := s.handler.workerClients[s.ServerID]
|
||||
|
|
@ -91,8 +91,8 @@ func (s *Session) RouteBrowser() {
|
|||
})
|
||||
|
||||
browserClient.Receive("save", func(resp cws.WSPacket) (req cws.WSPacket) {
|
||||
log.Println("Overlord: Received save request from a browser")
|
||||
log.Println("Overlord: Relay save request from a browser to worker")
|
||||
log.Println("Coordinator: Received save request from a browser")
|
||||
log.Println("Coordinator: Relay save request from a browser to worker")
|
||||
// TODO: Async
|
||||
resp.SessionID = s.ID
|
||||
resp.RoomID = s.RoomID
|
||||
|
|
@ -108,8 +108,8 @@ func (s *Session) RouteBrowser() {
|
|||
})
|
||||
|
||||
browserClient.Receive("load", func(resp cws.WSPacket) (req cws.WSPacket) {
|
||||
log.Println("Overlord: Received load request from a browser")
|
||||
log.Println("Overlord: Relay load request from a browser to worker")
|
||||
log.Println("Coordinator: Received load request from a browser")
|
||||
log.Println("Coordinator: Relay load request from a browser to worker")
|
||||
// TODO: Async
|
||||
resp.SessionID = s.ID
|
||||
resp.RoomID = s.RoomID
|
||||
|
|
@ -125,8 +125,8 @@ func (s *Session) RouteBrowser() {
|
|||
})
|
||||
|
||||
browserClient.Receive("playerIdx", func(resp cws.WSPacket) (req cws.WSPacket) {
|
||||
log.Println("Overlord: Received update player index request from a browser")
|
||||
log.Println("Overlord: Relay update player index request from a browser to worker")
|
||||
log.Println("Coordinator: Received update player index request from a browser")
|
||||
log.Println("Coordinator: Relay update player index request from a browser to worker")
|
||||
// TODO: Async
|
||||
resp.SessionID = s.ID
|
||||
resp.RoomID = s.RoomID
|
||||
|
|
@ -142,7 +142,7 @@ func (s *Session) RouteBrowser() {
|
|||
})
|
||||
}
|
||||
|
||||
// NewOverlordClient returns a client connecting to browser. This connection exchanges information between clients and server
|
||||
// NewCoordinatorClient returns a client connecting to browser. This connection exchanges information between clients and server
|
||||
func NewBrowserClient(c *websocket.Conn) *BrowserClient {
|
||||
return &BrowserClient{
|
||||
Client: cws.NewClient(c),
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package overlord
|
||||
package coordinator
|
||||
|
||||
import (
|
||||
"github.com/giongto35/cloud-game/pkg/monitoring"
|
||||
|
|
@ -21,7 +21,7 @@ func NewDefaultConfig() Config {
|
|||
|
||||
MonitoringConfig: monitoring.ServerMonitoringConfig{
|
||||
Port: 6601,
|
||||
URLPrefix: "/overlord",
|
||||
URLPrefix: "/coordinator",
|
||||
MetricEnabled: false,
|
||||
ProfilingEnabled: false,
|
||||
},
|
||||
|
|
@ -29,7 +29,7 @@ func NewDefaultConfig() Config {
|
|||
}
|
||||
|
||||
func (c *Config) AddFlags(fs *pflag.FlagSet) *Config {
|
||||
fs.IntVarP(&c.Port, "port", "", 8800, "Overlord server port")
|
||||
fs.IntVarP(&c.Port, "port", "", 8800, "Coordinator server port")
|
||||
|
||||
fs.BoolVarP(&c.MonitoringConfig.MetricEnabled, "monitoring.metric", "m", c.MonitoringConfig.MetricEnabled, "Enable prometheus metric for server")
|
||||
fs.BoolVarP(&c.MonitoringConfig.ProfilingEnabled, "monitoring.pprof", "p", c.MonitoringConfig.ProfilingEnabled, "Enable golang pprof for server")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package overlord
|
||||
package coordinator
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -19,15 +19,15 @@ import (
|
|||
|
||||
const stagingLEURL = "https://acme-staging-v02.api.letsencrypt.org/directory"
|
||||
|
||||
type Overlord struct {
|
||||
type Coordinator struct {
|
||||
ctx context.Context
|
||||
cfg Config
|
||||
|
||||
monitoringServer *monitoring.ServerMonitoring
|
||||
}
|
||||
|
||||
func New(ctx context.Context, cfg Config) *Overlord {
|
||||
return &Overlord{
|
||||
func New(ctx context.Context, cfg Config) *Coordinator {
|
||||
return &Coordinator{
|
||||
ctx: ctx,
|
||||
cfg: cfg,
|
||||
|
||||
|
|
@ -35,21 +35,21 @@ func New(ctx context.Context, cfg Config) *Overlord {
|
|||
}
|
||||
}
|
||||
|
||||
func (o *Overlord) Run() error {
|
||||
go o.initializeOverlord()
|
||||
func (o *Coordinator) Run() error {
|
||||
go o.initializeCoordinator()
|
||||
go o.RunMonitoringServer()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *Overlord) RunMonitoringServer() {
|
||||
glog.Infoln("Starting monitoring server for overlord")
|
||||
func (o *Coordinator) RunMonitoringServer() {
|
||||
glog.Infoln("Starting monitoring server for coordinator")
|
||||
err := o.monitoringServer.Run()
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to start monitoring server, reason %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (o *Overlord) Shutdown() {
|
||||
func (o *Coordinator) Shutdown() {
|
||||
if err := o.monitoringServer.Shutdown(o.ctx); err != nil {
|
||||
glog.Errorln("Failed to shutdown monitoring server")
|
||||
}
|
||||
|
|
@ -93,14 +93,14 @@ func makeHTTPToHTTPSRedirectServer(server *Server) *http.Server {
|
|||
return makeServerFromMux(svmux)
|
||||
}
|
||||
|
||||
// initializeOverlord setup an overlord server
|
||||
func (o *Overlord) initializeOverlord() {
|
||||
overlord := NewServer(o.cfg)
|
||||
// initializeCoordinator setup an coordinator server
|
||||
func (o *Coordinator) initializeCoordinator() {
|
||||
coordinator := NewServer(o.cfg)
|
||||
|
||||
var certManager *autocert.Manager
|
||||
var httpsSrv *http.Server
|
||||
|
||||
log.Println("Initializing Overlord Server")
|
||||
log.Println("Initializing Coordinator Server")
|
||||
if *config.Mode == config.ProdEnv || *config.Mode == config.StagingEnv {
|
||||
var leurl string
|
||||
if *config.Mode == config.StagingEnv {
|
||||
|
|
@ -116,7 +116,7 @@ func (o *Overlord) initializeOverlord() {
|
|||
Client: &acme.Client{DirectoryURL: leurl},
|
||||
}
|
||||
|
||||
httpsSrv = makeHTTPServer(overlord)
|
||||
httpsSrv = makeHTTPServer(coordinator)
|
||||
httpsSrv.Addr = ":443"
|
||||
httpsSrv.TLSConfig = &tls.Config{GetCertificate: certManager.GetCertificate}
|
||||
|
||||
|
|
@ -131,9 +131,9 @@ func (o *Overlord) initializeOverlord() {
|
|||
|
||||
var httpSrv *http.Server
|
||||
if *config.Mode == config.ProdEnv || *config.Mode == config.StagingEnv {
|
||||
httpSrv = makeHTTPToHTTPSRedirectServer(overlord)
|
||||
httpSrv = makeHTTPToHTTPSRedirectServer(coordinator)
|
||||
} else {
|
||||
httpSrv = makeHTTPServer(overlord)
|
||||
httpSrv = makeHTTPServer(coordinator)
|
||||
}
|
||||
|
||||
if certManager != nil {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package overlord
|
||||
package coordinator
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
|
@ -78,17 +78,17 @@ func (o *Server) getPingServer(zone string) string {
|
|||
return devPingServer
|
||||
}
|
||||
|
||||
// WSO handles all connections from a new worker to overlord
|
||||
// WSO handles all connections from a new worker to coordinator
|
||||
func (o *Server) WSO(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Println("Connected")
|
||||
c, err := upgrader.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
log.Print("Overlord: [!] WS upgrade:", err)
|
||||
log.Print("Coordinator: [!] WS upgrade:", err)
|
||||
return
|
||||
}
|
||||
// Register new server
|
||||
serverID := uuid.Must(uuid.NewV4()).String()
|
||||
log.Println("Overlord: A new server connected to Overlord", serverID)
|
||||
log.Println("Coordinator: A new server connected to Coordinator", serverID)
|
||||
|
||||
// Register to workersClients map the client connection
|
||||
address := util.GetRemoteAddress(c)
|
||||
|
|
@ -99,10 +99,10 @@ func (o *Server) WSO(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
fmt.Printf("Is public: %v zone: %v\n", util.IsPublicIP(address), zone)
|
||||
|
||||
// In case worker and overlord in the same host
|
||||
// In case worker and coordinator in the same host
|
||||
if !util.IsPublicIP(address) && *config.Mode == config.ProdEnv {
|
||||
// Don't accept private IP for worker's address in prod mode
|
||||
// However, if the worker in the same host with overlord, we can get public IP of worker
|
||||
// However, if the worker in the same host with coordinator, we can get public IP of worker
|
||||
log.Printf("Error: address %s is invalid", address)
|
||||
address = util.GetHostPublicIP()
|
||||
log.Println("Find public address:", address)
|
||||
|
|
@ -128,9 +128,9 @@ func (o *Server) WSO(w http.ResponseWriter, r *http.Request) {
|
|||
client.Listen()
|
||||
}
|
||||
|
||||
// WSO handles all connections from user/frontend to overlord
|
||||
// WSO handles all connections from user/frontend to coordinator
|
||||
func (o *Server) WS(w http.ResponseWriter, r *http.Request) {
|
||||
log.Println("A user connected to overlord ", r.URL)
|
||||
log.Println("A user connected to coordinator ", r.URL)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.Println("Warn: Something wrong. Recovered in ", r)
|
||||
|
|
@ -332,7 +332,7 @@ func (o *Server) getLatencyMapFromBrowser(workerClients map[string]*WorkerClient
|
|||
// cleanConnection is called when a worker is disconnected
|
||||
// connection from worker (client) to server is also closed
|
||||
func (o *Server) cleanConnection(client *WorkerClient, serverID string) {
|
||||
log.Println("Unregister server from overlord")
|
||||
log.Println("Unregister server from coordinator")
|
||||
// Remove serverID from servers
|
||||
delete(o.workerClients, serverID)
|
||||
// Clean all rooms connecting to that server
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
package overlord
|
||||
package coordinator
|
||||
|
||||
// Session represents a session connected from the browser to the current server
|
||||
// It requires one connection to browser and one connection to the overlord
|
||||
// connection to browser is 1-1. connection to overlord is n - 1
|
||||
// It requires one connection to browser and one connection to the coordinator
|
||||
// connection to browser is 1-1. connection to coordinator is n - 1
|
||||
// Peerconnection can be from other server to ensure better latency
|
||||
type Session struct {
|
||||
ID string
|
||||
BrowserClient *BrowserClient
|
||||
WorkerClient *WorkerClient
|
||||
// OverlordClient *OverlordClient
|
||||
// CoordinatorClient *CoordinatorClient
|
||||
// peerconnection *webrtc.WebRTC
|
||||
|
||||
// TODO: Decouple this
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package overlord
|
||||
package coordinator
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
|
@ -23,11 +23,11 @@ type WorkerClient struct {
|
|||
// RouteWorker are all routes server received from worker
|
||||
func (o *Server) RouteWorker(workerClient *WorkerClient) {
|
||||
// registerRoom event from a worker, when worker created a new room.
|
||||
// RoomID is global so it is managed by overlord.
|
||||
// RoomID is global so it is managed by coordinator.
|
||||
workerClient.Receive("registerRoom", func(resp cws.WSPacket) cws.WSPacket {
|
||||
log.Printf("Overlord: Received registerRoom room %s from worker %s", resp.Data, workerClient.ServerID)
|
||||
log.Printf("Coordinator: Received registerRoom room %s from worker %s", resp.Data, workerClient.ServerID)
|
||||
o.roomToWorker[resp.Data] = workerClient.ServerID
|
||||
log.Printf("Overlord: Current room list is: %+v", o.roomToWorker)
|
||||
log.Printf("Coordinator: Current room list is: %+v", o.roomToWorker)
|
||||
|
||||
return cws.WSPacket{
|
||||
ID: "registerRoom",
|
||||
|
|
@ -36,9 +36,9 @@ func (o *Server) RouteWorker(workerClient *WorkerClient) {
|
|||
|
||||
// closeRoom event from a worker, when worker close a room
|
||||
workerClient.Receive("closeRoom", func(resp cws.WSPacket) cws.WSPacket {
|
||||
log.Printf("Overlord: Received closeRoom room %s from worker %s", resp.Data, workerClient.ServerID)
|
||||
log.Printf("Coordinator: Received closeRoom room %s from worker %s", resp.Data, workerClient.ServerID)
|
||||
delete(o.roomToWorker, resp.Data)
|
||||
log.Printf("Overlord: Current room list is: %+v", o.roomToWorker)
|
||||
log.Printf("Coordinator: Current room list is: %+v", o.roomToWorker)
|
||||
|
||||
return cws.WSPacket{
|
||||
ID: "closeRoom",
|
||||
|
|
@ -47,7 +47,7 @@ func (o *Server) RouteWorker(workerClient *WorkerClient) {
|
|||
|
||||
// getRoom returns the server ID based on requested roomID.
|
||||
workerClient.Receive("getRoom", func(resp cws.WSPacket) cws.WSPacket {
|
||||
log.Println("Overlord: Received a getroom request")
|
||||
log.Println("Coordinator: Received a getroom request")
|
||||
log.Println("Result: ", o.roomToWorker[resp.Data])
|
||||
return cws.WSPacket{
|
||||
ID: "getRoom",
|
||||
|
|
@ -12,34 +12,34 @@ import (
|
|||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
// OverlordClient maintans connection to overlord
|
||||
// We expect only one OverlordClient for each server
|
||||
type OverlordClient struct {
|
||||
// CoordinatorClient maintans connection to coordinator
|
||||
// We expect only one CoordinatorClient for each server
|
||||
type CoordinatorClient struct {
|
||||
*cws.Client
|
||||
}
|
||||
|
||||
// NewOverlordClient returns a client connecting to overlord for coordiation between different server
|
||||
func NewOverlordClient(oc *websocket.Conn) *OverlordClient {
|
||||
// NewCoordinatorClient returns a client connecting to coordinator for coordiation between different server
|
||||
func NewCoordinatorClient(oc *websocket.Conn) *CoordinatorClient {
|
||||
if oc == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
oClient := &OverlordClient{
|
||||
oClient := &CoordinatorClient{
|
||||
Client: cws.NewClient(oc),
|
||||
}
|
||||
return oClient
|
||||
}
|
||||
|
||||
// RouteOverlord are all routes server received from overlord
|
||||
func (h *Handler) RouteOverlord() {
|
||||
// RouteCoordinator are all routes server received from coordinator
|
||||
func (h *Handler) RouteCoordinator() {
|
||||
iceCandidates := map[string][]string{}
|
||||
oClient := h.oClient
|
||||
|
||||
// Received from overlord the serverID
|
||||
// Received from coordinator the serverID
|
||||
oClient.Receive(
|
||||
"serverID",
|
||||
func(response cws.WSPacket) (request cws.WSPacket) {
|
||||
// Stick session with serverID got from overlord
|
||||
// Stick session with serverID got from coordinator
|
||||
log.Println("Received serverID ", response.Data)
|
||||
h.serverID = response.Data
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ func (h *Handler) RouteOverlord() {
|
|||
oClient.Receive(
|
||||
"initwebrtc",
|
||||
func(resp cws.WSPacket) (req cws.WSPacket) {
|
||||
log.Println("Received relay SDP of a browser from overlord")
|
||||
log.Println("Received relay SDP of a browser from coordinator")
|
||||
|
||||
peerconnection := webrtc.NewWebRTC()
|
||||
var initPacket struct {
|
||||
|
|
@ -87,7 +87,7 @@ func (h *Handler) RouteOverlord() {
|
|||
oClient.Receive(
|
||||
"start",
|
||||
func(resp cws.WSPacket) (req cws.WSPacket) {
|
||||
log.Println("Received a start request from overlord")
|
||||
log.Println("Received a start request from coordinator")
|
||||
session, _ := h.sessions[resp.SessionID]
|
||||
|
||||
peerconnection := session.peerconnection
|
||||
|
|
@ -117,7 +117,7 @@ func (h *Handler) RouteOverlord() {
|
|||
oClient.Receive(
|
||||
"quit",
|
||||
func(resp cws.WSPacket) (req cws.WSPacket) {
|
||||
log.Println("Received a quit request from overlord")
|
||||
log.Println("Received a quit request from coordinator")
|
||||
session, ok := h.sessions[resp.SessionID]
|
||||
log.Println("Find ", resp.SessionID, session, ok)
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ func (h *Handler) RouteOverlord() {
|
|||
oClient.Receive(
|
||||
"save",
|
||||
func(resp cws.WSPacket) (req cws.WSPacket) {
|
||||
log.Println("Received a save game from overlord")
|
||||
log.Println("Received a save game from coordinator")
|
||||
log.Println("RoomID:", resp.RoomID)
|
||||
req.ID = "save"
|
||||
req.Data = "ok"
|
||||
|
|
@ -158,7 +158,7 @@ func (h *Handler) RouteOverlord() {
|
|||
oClient.Receive(
|
||||
"load",
|
||||
func(resp cws.WSPacket) (req cws.WSPacket) {
|
||||
log.Println("Received a load game from overlord")
|
||||
log.Println("Received a load game from coordinator")
|
||||
log.Println("Loading game state")
|
||||
req.ID = "load"
|
||||
req.Data = "ok"
|
||||
|
|
@ -179,7 +179,7 @@ func (h *Handler) RouteOverlord() {
|
|||
oClient.Receive(
|
||||
"playerIdx",
|
||||
func(resp cws.WSPacket) (req cws.WSPacket) {
|
||||
log.Println("Received an update player index event from overlord")
|
||||
log.Println("Received an update player index event from coordinator")
|
||||
req.ID = "playerIdx"
|
||||
|
||||
room := h.getRoom(resp.RoomID)
|
||||
|
|
@ -200,7 +200,7 @@ func (h *Handler) RouteOverlord() {
|
|||
oClient.Receive(
|
||||
"icecandidate",
|
||||
func(resp cws.WSPacket) (req cws.WSPacket) {
|
||||
log.Println("Received a icecandidate from overlord: ", resp.Data)
|
||||
log.Println("Received a icecandidate from coordinator: ", resp.Data)
|
||||
iceCandidates[resp.SessionID] = append(iceCandidates[resp.SessionID], resp.Data)
|
||||
|
||||
return cws.EmptyPacket
|
||||
|
|
@ -224,15 +224,15 @@ func (h *Handler) RouteOverlord() {
|
|||
)
|
||||
}
|
||||
|
||||
func getServerIDOfRoom(oc *OverlordClient, roomID string) string {
|
||||
log.Println("Request overlord roomID ", roomID)
|
||||
func getServerIDOfRoom(oc *CoordinatorClient, roomID string) string {
|
||||
log.Println("Request coordinator roomID ", roomID)
|
||||
packet := oc.SyncSend(
|
||||
cws.WSPacket{
|
||||
ID: "getRoom",
|
||||
Data: roomID,
|
||||
},
|
||||
)
|
||||
log.Println("Received roomID from overlord ", packet.Data)
|
||||
log.Println("Received roomID from coordinator ", packet.Data)
|
||||
|
||||
return packet.Data
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ func getServerIDOfRoom(oc *OverlordClient, roomID string) string {
|
|||
// startGameHandler starts a game if roomID is given, if not create new room
|
||||
func (h *Handler) startGameHandler(gameName, existedRoomID string, playerIndex int, peerconnection *webrtc.WebRTC, videoEncoderType string) *room.Room {
|
||||
log.Println("Starting game", gameName)
|
||||
// If we are connecting to overlord, request corresponding serverID based on roomID
|
||||
// If we are connecting to coordinator, request corresponding serverID based on roomID
|
||||
// TODO: check if existedRoomID is in the current server
|
||||
room := h.getRoom(existedRoomID)
|
||||
// If room is not running
|
||||
|
|
@ -254,7 +254,7 @@ func (h *Handler) startGameHandler(gameName, existedRoomID string, playerIndex i
|
|||
go func() {
|
||||
<-room.Done
|
||||
h.detachRoom(room.ID)
|
||||
// send signal to overlord that the room is closed, overlord will remove that room
|
||||
// send signal to coordinator that the room is closed, coordinator will remove that room
|
||||
h.oClient.Send(cws.WSPacket{
|
||||
ID: "closeRoom",
|
||||
Data: room.ID,
|
||||
|
|
@ -269,7 +269,7 @@ func (h *Handler) startGameHandler(gameName, existedRoomID string, playerIndex i
|
|||
room.AddConnectionToRoom(peerconnection)
|
||||
}
|
||||
|
||||
// Register room to overlord if we are connecting to overlord
|
||||
// Register room to coordinator if we are connecting to coordinator
|
||||
if room != nil && h.oClient != nil {
|
||||
h.oClient.Send(cws.WSPacket{
|
||||
ID: "registerRoom",
|
||||
|
|
@ -23,15 +23,15 @@ const (
|
|||
debugIndex = "./static/game.html"
|
||||
)
|
||||
|
||||
// Flag to determine if the server is overlord or not
|
||||
// Flag to determine if the server is coordinator or not
|
||||
var upgrader = websocket.Upgrader{}
|
||||
|
||||
type Handler struct {
|
||||
// Client that connects to overlord
|
||||
oClient *OverlordClient
|
||||
// Raw address of overlord
|
||||
overlordHost string
|
||||
cfg worker.Config
|
||||
// Client that connects to coordinator
|
||||
oClient *CoordinatorClient
|
||||
// Raw address of coordinator
|
||||
coordinatorHost string
|
||||
cfg worker.Config
|
||||
// Rooms map : RoomID -> Room
|
||||
rooms map[string]*room.Room
|
||||
// ID of the current server globalwise
|
||||
|
|
@ -50,34 +50,34 @@ func NewHandler(cfg worker.Config) *Handler {
|
|||
// Init online storage
|
||||
onlineStorage := storage.NewInitClient()
|
||||
return &Handler{
|
||||
rooms: map[string]*room.Room{},
|
||||
sessions: map[string]*Session{},
|
||||
overlordHost: cfg.OverlordAddress,
|
||||
cfg: cfg,
|
||||
onlineStorage: onlineStorage,
|
||||
rooms: map[string]*room.Room{},
|
||||
sessions: map[string]*Session{},
|
||||
coordinatorHost: cfg.CoordinatorAddress,
|
||||
cfg: cfg,
|
||||
onlineStorage: onlineStorage,
|
||||
}
|
||||
}
|
||||
|
||||
// Run starts a Handler running logic
|
||||
func (h *Handler) Run() {
|
||||
for {
|
||||
oClient, err := setupOverlordConnection(h.overlordHost, h.cfg.Zone)
|
||||
oClient, err := setupCoordinatorConnection(h.coordinatorHost, h.cfg.Zone)
|
||||
if err != nil {
|
||||
log.Printf("Cannot connect to overlord. %v Retrying...", err)
|
||||
log.Printf("Cannot connect to coordinator. %v Retrying...", err)
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
|
||||
h.oClient = oClient
|
||||
log.Println("Connected to overlord successfully.", oClient, err)
|
||||
log.Println("Connected to coordinator successfully.", oClient, err)
|
||||
go h.oClient.Heartbeat()
|
||||
h.RouteOverlord()
|
||||
h.RouteCoordinator()
|
||||
h.oClient.Listen()
|
||||
// If cannot listen, reconnect to overlord
|
||||
// If cannot listen, reconnect to coordinator
|
||||
}
|
||||
}
|
||||
|
||||
func setupOverlordConnection(ohost string, zone string) (*OverlordClient, error) {
|
||||
func setupCoordinatorConnection(ohost string, zone string) (*CoordinatorClient, error) {
|
||||
var scheme string
|
||||
|
||||
if *config.Mode == config.ProdEnv || *config.Mode == config.StagingEnv {
|
||||
|
|
@ -86,22 +86,22 @@ func setupOverlordConnection(ohost string, zone string) (*OverlordClient, error)
|
|||
scheme = "ws"
|
||||
}
|
||||
|
||||
overlordURL := url.URL{
|
||||
coordinatorURL := url.URL{
|
||||
Scheme: scheme,
|
||||
Host: ohost,
|
||||
Path: "/wso",
|
||||
RawQuery: "zone=" + zone,
|
||||
}
|
||||
log.Println("Worker connecting to overlord:", overlordURL.String())
|
||||
log.Println("Worker connecting to coordinator:", coordinatorURL.String())
|
||||
|
||||
conn, err := createOverlordConnection(&overlordURL)
|
||||
conn, err := createCoordinatorConnection(&coordinatorURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewOverlordClient(conn), nil
|
||||
return NewCoordinatorClient(conn), nil
|
||||
}
|
||||
|
||||
func createOverlordConnection(ourl *url.URL) (*websocket.Conn, error) {
|
||||
func createCoordinatorConnection(ourl *url.URL) (*websocket.Conn, error) {
|
||||
var d websocket.Dialer
|
||||
if ourl.Scheme == "wss" {
|
||||
d = websocket.Dialer{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}
|
||||
|
|
@ -117,7 +117,7 @@ func createOverlordConnection(ourl *url.URL) (*websocket.Conn, error) {
|
|||
return ws, nil
|
||||
}
|
||||
|
||||
func (h *Handler) GetOverlordClient() *OverlordClient {
|
||||
func (h *Handler) GetCoordinatorClient() *CoordinatorClient {
|
||||
return h.oClient
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package worker
|
|||
import "github.com/giongto35/cloud-game/pkg/webrtc"
|
||||
|
||||
// Session represents a session connected from the browser to the current server
|
||||
// It requires one connection to browser and one connection to the overlord
|
||||
// connection to browser is 1-1. connection to overlord is n - 1
|
||||
// It requires one connection to browser and one connection to the coordinator
|
||||
// connection to browser is 1-1. connection to coordinator is n - 1
|
||||
// Peerconnection can be from other server to ensure better latency
|
||||
type Session struct {
|
||||
ID string
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import (
|
|||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
type OverWorker struct {
|
||||
type Worker struct {
|
||||
ctx context.Context
|
||||
cfg worker.Config
|
||||
|
||||
|
|
@ -28,8 +28,8 @@ type OverWorker struct {
|
|||
|
||||
const stagingLEURL = "https://acme-staging-v02.api.letsencrypt.org/directory"
|
||||
|
||||
func New(ctx context.Context, cfg worker.Config) *OverWorker {
|
||||
return &OverWorker{
|
||||
func New(ctx context.Context, cfg worker.Config) *Worker {
|
||||
return &Worker{
|
||||
ctx: ctx,
|
||||
cfg: cfg,
|
||||
|
||||
|
|
@ -37,13 +37,13 @@ func New(ctx context.Context, cfg worker.Config) *OverWorker {
|
|||
}
|
||||
}
|
||||
|
||||
func (o *OverWorker) Run() error {
|
||||
func (o *Worker) Run() error {
|
||||
go o.initializeWorker()
|
||||
go o.RunMonitoringServer()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *OverWorker) RunMonitoringServer() {
|
||||
func (o *Worker) RunMonitoringServer() {
|
||||
glog.Infoln("Starting monitoring server for overwork")
|
||||
err := o.monitoringServer.Run()
|
||||
if err != nil {
|
||||
|
|
@ -51,7 +51,7 @@ func (o *OverWorker) RunMonitoringServer() {
|
|||
}
|
||||
}
|
||||
|
||||
func (o *OverWorker) Shutdown() {
|
||||
func (o *Worker) Shutdown() {
|
||||
if err := o.monitoringServer.Shutdown(o.ctx); err != nil {
|
||||
glog.Errorln("Failed to shutdown monitoring server")
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ func makeHTTPToHTTPSRedirectServer() *http.Server {
|
|||
return makeServerFromMux(mux)
|
||||
}
|
||||
|
||||
func (o *OverWorker) spawnServer(port int) {
|
||||
func (o *Worker) spawnServer(port int) {
|
||||
var certManager *autocert.Manager
|
||||
var httpsSrv *http.Server
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ func (o *OverWorker) spawnServer(port int) {
|
|||
}
|
||||
|
||||
// initializeWorker setup a worker
|
||||
func (o *OverWorker) initializeWorker() {
|
||||
func (o *Worker) initializeWorker() {
|
||||
worker := NewHandler(o.cfg)
|
||||
|
||||
defer func() {
|
||||
|
|
@ -27,7 +27,7 @@ package e2e
|
|||
// URLs: []string{"stun:stun.l.google.com:19302"},
|
||||
// }}}
|
||||
//
|
||||
// func initOverlord() (*httptest.Server, *httptest.Server) {
|
||||
// func initCoordinator() (*httptest.Server, *httptest.Server) {
|
||||
// server := overlord.NewServer()
|
||||
// overlordWorker := httptest.NewServer(http.HandlerFunc(server.WSO))
|
||||
// overlordBrowser := httptest.NewServer(http.HandlerFunc(server.WS))
|
||||
|
|
@ -137,7 +137,7 @@ package e2e
|
|||
// // If receive roomID, the server is running correctly
|
||||
// }
|
||||
//
|
||||
// func TestSingleServerOneOverlord(t *testing.T) {
|
||||
// func TestSingleServerOneCoordinator(t *testing.T) {
|
||||
// /*
|
||||
// Case scenario:
|
||||
// - A server X are initilized
|
||||
|
|
@ -146,7 +146,7 @@ package e2e
|
|||
// - Room received not empty.
|
||||
// */
|
||||
//
|
||||
// oworker, obrowser := initOverlord()
|
||||
// oworker, obrowser := initCoordinator()
|
||||
// defer obrowser.Close()
|
||||
// defer oworker.Close()
|
||||
//
|
||||
|
|
@ -178,7 +178,7 @@ package e2e
|
|||
// fmt.Println("Done")
|
||||
// }
|
||||
//
|
||||
// func TestTwoServerOneOverlord(t *testing.T) {
|
||||
// func TestTwoServerOneCoordinator(t *testing.T) {
|
||||
// /*
|
||||
// Case scenario:
|
||||
// - Two server X, Y are initilized
|
||||
|
|
@ -190,7 +190,7 @@ package e2e
|
|||
// - Client B can join a room hosted on A
|
||||
// */
|
||||
//
|
||||
// oworker, obrowser := initOverlord()
|
||||
// oworker, obrowser := initCoordinator()
|
||||
// defer obrowser.Close()
|
||||
// defer oworker.Close()
|
||||
//
|
||||
|
|
@ -277,7 +277,7 @@ package e2e
|
|||
// TODO: Current test just make sure the game is running, not check if the game is the same
|
||||
// */
|
||||
//
|
||||
// oworker, obrowser := initOverlord()
|
||||
// oworker, obrowser := initCoordinator()
|
||||
// defer obrowser.Close()
|
||||
// defer oworker.Close()
|
||||
//
|
||||
|
|
@ -306,7 +306,7 @@ package e2e
|
|||
//
|
||||
// log.Println("Closing room and server")
|
||||
// client.Close()
|
||||
// worker.GetOverlordClient().Close()
|
||||
// worker.GetCoordinatorClient().Close()
|
||||
// worker.Close()
|
||||
//
|
||||
// // Close server and reconnect
|
||||
|
|
@ -356,7 +356,7 @@ package e2e
|
|||
// */
|
||||
// // This test only run if GCP storage is set
|
||||
//
|
||||
// oworker, obrowser := initOverlord()
|
||||
// oworker, obrowser := initCoordinator()
|
||||
// defer obrowser.Close()
|
||||
// defer oworker.Close()
|
||||
//
|
||||
|
|
@ -390,7 +390,7 @@ package e2e
|
|||
//
|
||||
// log.Println("Closing room and server")
|
||||
// client.Close()
|
||||
// worker.GetOverlordClient().Close()
|
||||
// worker.GetCoordinatorClient().Close()
|
||||
// worker.Close()
|
||||
// // Remove room on local
|
||||
// path := util.GetSavePath(saveRoomID)
|
||||
|
|
@ -429,7 +429,7 @@ package e2e
|
|||
// fmt.Println("Done")
|
||||
// }
|
||||
|
||||
//func TestRejoinNoOverlordMultiple(t *testing.T) {
|
||||
//func TestRejoinNoCoordinatorMultiple(t *testing.T) {
|
||||
//[>
|
||||
//Case scenario:
|
||||
//- A server X without connecting to overlord
|
||||
|
|
@ -470,7 +470,7 @@ package e2e
|
|||
|
||||
//}
|
||||
|
||||
//func TestRejoinWithOverlordMultiple(t *testing.T) {
|
||||
//func TestRejoinWithCoordinatorMultiple(t *testing.T) {
|
||||
//[>
|
||||
//Case scenario:
|
||||
//- A server X is initialized connecting to overlord
|
||||
|
|
@ -480,10 +480,10 @@ package e2e
|
|||
//*/
|
||||
|
||||
//// Init slave server
|
||||
//o := initOverlord()
|
||||
//o := initCoordinator()
|
||||
//defer o.Close()
|
||||
|
||||
//oconn := connectTestOverlordServer(t, o.URL)
|
||||
//oconn := connectTestCoordinatorServer(t, o.URL)
|
||||
//// Init slave server
|
||||
//s := initServer(t, oconn)
|
||||
//defer s.Close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue