mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-08-22 16:44:08 -05:00
QR2/SB: Allow different public IP for TCP and UDP
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"math/rand"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"wwfc/common"
|
||||
"wwfc/logging"
|
||||
@@ -187,10 +186,7 @@ func (session *Session) setProfileID(moduleName string, newPID string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if strings.Split(gpPublicIP, ":")[0] != strings.Split(session.Addr.String(), ":")[0] {
|
||||
logging.Error(moduleName, "Caller public IP does not match GPCM session")
|
||||
return false
|
||||
}
|
||||
// TODO: Some kind of authentication
|
||||
|
||||
if ratingError := checkValidRating(moduleName, session.Data); ratingError != "ok" {
|
||||
callback := loginInfo.GPErrorCallback
|
||||
@@ -218,6 +214,8 @@ func (session *Session) setProfileID(moduleName string, newPID string) bool {
|
||||
session.Data["+deviceauth"] = "0"
|
||||
}
|
||||
|
||||
session.Data["+gppublicip"], _ = common.IPFormatToString(gpPublicIP)
|
||||
|
||||
session.Data["dwc_pid"] = newPID
|
||||
logging.Notice(moduleName, "Opened session with PID", aurora.Cyan(newPID))
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ func handleServerListRequest(conn net.Conn, buffer []byte) {
|
||||
continue
|
||||
}
|
||||
|
||||
if publicip == callerPublicIP {
|
||||
if publicip == callerPublicIP || server["+gppublicip"] == callerPublicIP {
|
||||
// Use the real public IP if it matches the caller's
|
||||
ip, err := strconv.ParseInt(publicip, 10, 32)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user