fixes for buiding remote gaming server
This commit is contained in:
@@ -35,7 +35,9 @@ func BroadcastServerToBackend() error {
|
||||
|
||||
var gameSession GameSession
|
||||
|
||||
respIpv4orIPv6 := Ip4or6(config.IPAddress)
|
||||
fmt.Println(config.IPAddress)
|
||||
|
||||
respIpv4orIPv6 := config.IPAddress
|
||||
|
||||
// Adding game session information
|
||||
respIpv4orIPv6 = "https://" + respIpv4orIPv6
|
||||
|
||||
@@ -25,7 +25,7 @@ func EscapeNAT(ScreenSharePort, GameplayServerPort string) (ServerPort string, S
|
||||
}
|
||||
|
||||
// Get free port from P2PRC server node
|
||||
ScreensharePort, err = frp.GetFRPServerPort("http://64.227.168.102:8088")
|
||||
ScreensharePortFRP, err := frp.GetFRPServerPort("http://64.227.168.102:8088")
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
@@ -34,7 +34,7 @@ func EscapeNAT(ScreenSharePort, GameplayServerPort string) (ServerPort string, S
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
// port for the screenshare port
|
||||
ScreensharePort, err = frp.StartFRPClientForServer("64.227.168.102", ScreensharePort, ScreenSharePort)
|
||||
ScreensharePort, err = frp.StartFRPClientForServer("64.227.168.102", ScreensharePortFRP, ScreenSharePort)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/gorilla/websocket"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Room struct {
|
||||
@@ -112,6 +113,7 @@ func (room *Room) writeToFile() error {
|
||||
|
||||
// ReadRoomsFile Reads rooms file and return struct room id
|
||||
func ReadRoomsFile() (*Room, error) {
|
||||
time.Sleep(3 * time.Second)
|
||||
config, err := config.ConfigInit()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"github.com/Akilan1999/remotegameplay/config"
|
||||
"github.com/gorilla/websocket"
|
||||
@@ -35,6 +36,7 @@ func sendHeartBeatWS(ticker *time.Ticker, conn *websocket.Conn, quit chan struct
|
||||
}
|
||||
|
||||
func GetHttp() *http.ServeMux {
|
||||
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
|
||||
server := http.NewServeMux()
|
||||
|
||||
server.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("files/static"))))
|
||||
|
||||
3
main.go
3
main.go
@@ -117,15 +117,18 @@ func main() {
|
||||
|
||||
if *GameServer {
|
||||
go gameserver.Server(Config.InternalGameServerPort)
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
|
||||
if !*GameServer || *BothServers {
|
||||
if *tls {
|
||||
log.Println("Listening on TLS:", *addr+":"+Config.InternalScreenSharePort)
|
||||
go http.ListenAndServeTLS(*addr+":"+Config.InternalScreenSharePort, *certFile, *keyFile, server)
|
||||
time.Sleep(2 * time.Second)
|
||||
} else {
|
||||
log.Println("Listening:", *addr+":"+Config.InternalScreenSharePort)
|
||||
go http.ListenAndServe(*addr+":"+Config.InternalScreenSharePort, server)
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -200,6 +200,10 @@ func CheckIfGameSessionIsActiveOrRemove(gorm *gorm.DB) {
|
||||
return
|
||||
}
|
||||
|
||||
if len(Gamesessions) != 0 {
|
||||
fmt.Println(Gamesessions[0].Link)
|
||||
}
|
||||
|
||||
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
|
||||
for i, _ := range Gamesessions {
|
||||
req, err := http.NewRequest("GET", Gamesessions[i].Link, nil)
|
||||
|
||||
Reference in New Issue
Block a user