fixed detect servers
This commit is contained in:
@@ -1,44 +1,44 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"github.com/Akilan1999/p2p-rendering-computation/abstractions"
|
||||
"github.com/Akilan1999/remotegameplay/config"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/abstractions"
|
||||
"github.com/Akilan1999/remotegameplay/config"
|
||||
)
|
||||
|
||||
// EscapeNAT Func to escape NAT
|
||||
// - 1 port for server
|
||||
// - 2 port for barrierKVM
|
||||
func EscapeNAT(ScreenPort, GameplayServerPort string) (ServerPort string, ScreenSharePort string, err error) {
|
||||
port, err := abstractions.MapPort(ScreenPort, "", "")
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
port, err := abstractions.MapPort(ScreenPort, "", "")
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
ScreenSharePort = port.EntireAddress
|
||||
ScreenSharePort = port.EntireAddress
|
||||
|
||||
// init config to get domain name
|
||||
Config, err := config.ConfigInit()
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
// init config to get domain name
|
||||
Config, err := config.ConfigInit()
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
port, err = abstractions.MapPort(GameplayServerPort, Config.DomainName, "")
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
port, err = abstractions.MapPort(GameplayServerPort, Config.DomainName, "")
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
ServerPort = port.EntireAddress
|
||||
ServerPort = port.EntireAddress
|
||||
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
func EscapeNATBarrier() (barrierKVMport string, err error) {
|
||||
port, err := abstractions.MapPort("24798", "", "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
port, err := abstractions.MapPort("24798", "", "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
barrierKVMport = port.EntireAddress
|
||||
barrierKVMport = port.EntireAddress
|
||||
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
2
main.go
2
main.go
@@ -160,7 +160,7 @@ func main() {
|
||||
|
||||
// If both server selected set the remote Gameserver to local now.
|
||||
if *BothServers {
|
||||
Config.BackendURL = "http://" + Config.IPAddress + ":" + Config.NATEscapeGameServerPort + "/"
|
||||
Config.BackendURL = Config.NATEscapeGameServerPort + "/"
|
||||
err = Config.WriteConfig()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
||||
Reference in New Issue
Block a user