mirror of
https://github.com/PretendoNetwork/wiiu-chat-secure.git
synced 2026-04-25 15:58:14 -05:00
NAT should have never been created, and I wish Nintendo's stuff actually worked like one would expect
This commit is contained in:
parent
3514033ec5
commit
ebea74e29b
|
|
@ -140,6 +140,13 @@ func updatePlayerSessionAll(pid uint32, urls []string, ip string, port string) {
|
|||
}
|
||||
}
|
||||
|
||||
func updatePlayerSessionPort(pid uint32, port string) {
|
||||
_, err := sessionsCollection.UpdateOne(context.TODO(), bson.D{{"pid", pid}}, bson.D{{"$set", bson.D{{"port", port}}}})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func updatePlayerSessionUrl(pid uint32, oldurl string, newurl string) {
|
||||
var result bson.M
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@ import (
|
|||
func getFriendNotificationData(err error, client *nex.Client, callID uint32, uiType int32) {
|
||||
fmt.Println(client.PID()) // DEBUG
|
||||
|
||||
if !isUserAllowed(client.PID()) {
|
||||
nexServer.Kick(client)
|
||||
// get outta here
|
||||
}
|
||||
|
||||
notifications := make([]*nexproto.NotificationEvent, 0)
|
||||
|
||||
caller, target, ringing := getCallInfoByTarget(client.PID())
|
||||
|
|
|
|||
7
main.go
7
main.go
|
|
@ -73,12 +73,5 @@ func main() {
|
|||
return doesSessionExist(pid)
|
||||
})
|
||||
|
||||
nexServer.On("Connect", func(packet *nex.PacketV1) {
|
||||
if !isUserAllowed(packet.Sender().PID()) {
|
||||
nexServer.Kick(packet.Sender())
|
||||
// get outta here
|
||||
}
|
||||
})
|
||||
|
||||
nexServer.Listen(":60005")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,15 +31,21 @@ func requestProbeInitiationExt(err error, client *nex.Client, callID uint32, tar
|
|||
|
||||
nexServer.Send(responsePacket)
|
||||
|
||||
rmcMessage := nex.RMCRequest{}
|
||||
rmcMessage.SetProtocolID(nexproto.NATTraversalProtocolID)
|
||||
rmcMessage.SetCallID(0xffff0000 + callID)
|
||||
rmcMessage.SetMethodID(nexproto.NATTraversalMethodInitiateProbe)
|
||||
// Send probe to other users
|
||||
|
||||
rmcRequestStream := nex.NewStreamOut(nexServer)
|
||||
|
||||
rmcRequestStream.WriteString(stationToProbe)
|
||||
|
||||
rmcRequestBody := rmcRequestStream.Bytes()
|
||||
rmcMessage.SetParameters(rmcRequestBody)
|
||||
rmcMessageBytes := rmcMessage.Bytes()
|
||||
|
||||
rmcRequest := nex.NewRMCRequest()
|
||||
rmcRequest.SetProtocolID(nexproto.NATTraversalProtocolID)
|
||||
rmcRequest.SetCallID(3810693103)
|
||||
rmcRequest.SetMethodID(nexproto.NATTraversalMethodInitiateProbe)
|
||||
rmcRequest.SetParameters(rmcRequestBody)
|
||||
|
||||
rmcRequestBytes := rmcRequest.Bytes()
|
||||
|
||||
for _, target := range targetList {
|
||||
targetUrl := nex.NewStationURL(target)
|
||||
|
|
@ -47,17 +53,17 @@ func requestProbeInitiationExt(err error, client *nex.Client, callID uint32, tar
|
|||
targetClient := nexServer.FindClientFromPID(uint32(targetPID))
|
||||
fmt.Println(targetClient)
|
||||
if targetClient != nil {
|
||||
messagePacket, _ := nex.NewPacketV1(targetClient, nil)
|
||||
messagePacket.SetVersion(1)
|
||||
messagePacket.SetSource(0xA1)
|
||||
messagePacket.SetDestination(0xAF)
|
||||
messagePacket.SetType(nex.DataPacket)
|
||||
messagePacket.SetPayload(rmcMessageBytes)
|
||||
requestPacket, _ := nex.NewPacketV1(targetClient, nil)
|
||||
requestPacket.SetVersion(1)
|
||||
requestPacket.SetSource(0xA1)
|
||||
requestPacket.SetDestination(0xAF)
|
||||
requestPacket.SetType(nex.DataPacket)
|
||||
requestPacket.SetPayload(rmcRequestBytes)
|
||||
|
||||
messagePacket.AddFlag(nex.FlagNeedsAck)
|
||||
messagePacket.AddFlag(nex.FlagReliable)
|
||||
requestPacket.AddFlag(nex.FlagNeedsAck)
|
||||
requestPacket.AddFlag(nex.FlagReliable)
|
||||
|
||||
nexServer.Send(messagePacket)
|
||||
nexServer.Send(requestPacket)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user