Send a proper IP

This commit is contained in:
Sketch 2023-09-14 22:05:32 -04:00 committed by GitHub
parent fbdb19b8b4
commit 26617d96f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ package matchmaking
import (
"encoding/binary"
"net"
"strconv"
"strings"
"wwfc/common"
"wwfc/logging"
@ -35,9 +36,18 @@ func serverList(conn net.Conn, buffer []byte) {
logging.Notice(ModuleName, "Values", queryGame, gameName, string(challenge), string(options))
// TODO: Find a game if possible, but there is nobody to do that with yet!
output := []byte(strings.Replace(conn.RemoteAddr().String(), ".", "", -1))
var output []byte
for _, s := range strings.Split(strings.Split(conn.RemoteAddr().String(), ":")[0], ".") {
val, err := strconv.Atoi(s)
if err != nil {
panic(err)
}
output = append(output, byte(val))
}
output = binary.BigEndian.AppendUint16(output, 6500)
// encrypted := common.EncryptTypeX([]byte("9r3Rmy"), challenge, output)
conn.Write(output)
encrypted := common.EncryptTypeX([]byte("9r3Rmy"), challenge, output)
conn.Write(encrypted)
}