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