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