mirror of
https://gitea.tendokyu.moe/CharaLol/Yukiotoko.git
synced 2026-10-11 16:58:16 +03:00
we gettin symmetrical up in this bitch
This commit is contained in:
@@ -116,9 +116,23 @@ class UdpClass {
|
||||
this.Client = udp.createSocket('udp4')
|
||||
console.log("Opening Socket on Port " + port)
|
||||
this.Client.bind(port)
|
||||
this.Client.on('message', async function (msg, info) {
|
||||
this.Client.on('message', async (msg, info) => {
|
||||
//console.log(mappedUDP.get(info.port))
|
||||
mappedUDP.get(info.port)!.sendPacket(ip, port, msg, `${e.PUBLIC_IP}:${info.port}`)
|
||||
var clientmap = mappedUDP.get(info.port)
|
||||
if (clientmap != undefined) {
|
||||
clientmap.sendPacket(ip, this.port, msg, `${e.PUBLIC_IP}:${info.port}`)
|
||||
} else {
|
||||
console.log(`Detected Symmetrical NAT, Old Port ${port} New Port ${info.port}`)
|
||||
mappedUDP.forEach((entry: any, index: number) => {
|
||||
if (entry.ip == info.address) {
|
||||
let oldentry = entry.port
|
||||
entry.port = info.port
|
||||
mappedUDP.set(oldentry, entry)
|
||||
mappedUDP.set(info.port, entry)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user