Team-Silver-Sphere / SquadJS

Squad Server Script Framework
Boost Software License 1.0
166 stars 125 forks source link

EOS integration #318

Closed fantinodavide closed 10 months ago

fantinodavide commented 1 year ago

First EOS implementation. Still requires extensive testing.

fantinodavide commented 1 year ago

Every log-parser still emit events with the steamID property, it should be replaced with EOSID. I still haven't done this refactoring, but all the events should have been updated with the proper regex to match the new EOSID, that should already be handled by all the rest of the code that retrieve a player

Ulibos commented 10 months ago

Here is a patch that addresses some of the issues in this PR:

--- a/core/rcon.js
+++ b/core/rcon.js
@@ -186,7 +186,7 @@ export default class Rcon extends EventEmitter {
       return this.soh;
     }
     const bufSize = this.stream.readInt32LE(0);
-    if (bufSize > 4154 || bufSize < 10) return this.badPacket();
+    if (bufSize < 10) return this.badPacket();
     else if (bufSize <= this.stream.byteLength - 4 && this.stream.byteLength >= 12) {
       const bufId = this.stream.readInt32LE(4);
       const bufType = this.stream.readInt32LE(8);
@@ -228,7 +228,7 @@ export default class Rcon extends EventEmitter {
       this.emit(`response${this.responseString.id - 2}`, this.responseString.body);
       this.responseString.body = '';
     } else if (!packet.body.includes('^A')) {
-      this.responseString.body = this.responseString.body += packet.body;
+      this.responseString.body = this.responseString.body + packet.body;
       this.responseString.id = packet.id;
     } else this.badPacket();
   }
@@ -241,7 +241,7 @@ export default class Rcon extends EventEmitter {
       }`
     );
     this.stream = Buffer.alloc(0);
-    this.responseString = '';
+    this.responseString.body = '';
     return null;
   }
   onClose() {

There were 2 typos and a hard limit on a max packet size. I did some test rcon dumps and the biggest packet I got was 13670 bytes long. Since squad has no respect towards the standard, I'd suggest removing the upper limit entirely.

fantinodavide commented 10 months ago

@Ulibos I wouldn't like to remove the check on maximum buffer size, but I'm curious about the other parts of the code. I've placed a comment on the original PR (https://github.com/Team-Silver-Sphere/SquadJS/pull/291#issuecomment-1854006980) to address part of the issues, it would be better to move the discussion there since there are other important changes

Matttor commented 10 months ago

Thank you, for the typo spots! I'd rather not remove a 'safety' max, pre v7 I had been using 6144, I am currently using 8192 with no 'bad packets since'

fantinodavide commented 10 months ago

@Matttor do you suggest to use 8192 instead of 6144?

anklav24 commented 10 months ago

Hi, on custom servers with a password, there is a bug in login-request.js need to fix. In suffix includes custom server passwords.

'[2023.12.18-18.17.41:353][408]LogNet: Login request: ?Name=anklav24?PASSWORD=YOUR_PASSWORD userId: RedpointEOS:0002529ff9a34eb183f6cb2b18e7c580 platform: RedpointEOS'

In the suffix you get anklav24?PASSWORD=YOUR_PASSWORD

I guess regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: Join request: .+\?Name=(.+)(\?PASSWORD=.+)?\?SplitscreenCount=\d$/

Matttor commented 10 months ago

Can confirm that will handle PW'd servers, it misses matches for names that include # due to the way Squad handles such strings, if you wish to cap those use; /^\[(?:[\d.:-]+)]\[(?:[ \d]+)]LogNet: Join request: \/Game\/Maps\/(?:\w+)\/(?:\w+)\?Name=(.+)?\?(?:PASSWORD=.+)?SplitscreenCount=(?:\d)(#.+)?$/

anklav24 commented 10 months ago

I found more easy way for me. suffix: args[3].split('?PASSWORD=')[0]

werewolfboy13 commented 10 months ago

Conflict fixed

vohk commented 10 months ago

On the current (2 days ago) PR, seeing a new error in the console:

(node:15) UnhandledPromiseRejectionWarning: Error
at Query.run (/home/container/node_modules/sequelize/lib/dialects/mysql/query.js:52:25)
at /home/container/node_modules/sequelize/lib/sequelize.js:315:28
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async MySQLQueryInterface.upsert (/home/container/node_modules/sequelize/lib/dialects/mysql/query-interface.js:43:12)
at async DBLog_Player.upsert (/home/container/node_modules/sequelize/lib/model.js:1533:20)
at async DBLog.onPlayerWounded (file:///home/container/squad-server/plugins/db-log.js:535:7)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:15) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 23)

No crashing or functionality impaired that I've yet noticed. If there is any information I can add or provide, let me know.

romanvoloboev commented 10 months ago

looks like something not working?..

image
fantinodavide commented 10 months ago

@romanvoloboev make sure you don't have multiple tools connecting to rcon from the same IP (including loopback), because it would cause both the tools to alternate the connection

romanvoloboev commented 10 months ago

@romanvoloboev make sure you don't have multiple tools connecting to rcon from the same IP (including loopback), because it would cause both the tools to alternate the connection

yep, I have rcon web admin panel..

romanvoloboev commented 10 months ago

@romanvoloboev make sure you don't have multiple tools connecting to rcon from the same IP (including loopback), because it would cause both the tools to alternate the connection

but it's strange, because my setup didn't change and everything was working before..

lbzepoqo commented 10 months ago

@romanvoloboev make sure you don't have multiple tools connecting to rcon from the same IP (including loopback), because it would cause both the tools to alternate the connection

but it's strange, because my setup didn't change and everything was working before..

When was "before"? Were you using the version of rcon.js with passthrough support?

romanvoloboev commented 10 months ago

@romanvoloboev make sure you don't have multiple tools connecting to rcon from the same IP (including loopback), because it would cause both the tools to alternate the connection

but it's strange, because my setup didn't change and everything was working before..

When was "before"? Were you using the version of rcon.js with passthrough support?

Maybe few days ago it was working.. I'm using code from this branch, and no any other "rcon.js with passthrough support". Also I'm using on same host squadjs and server installed with LinuxGsm.. maybe it somehow conflicts, idk..

fantinodavide commented 10 months ago

@romanvoloboev try to stop the other tool and check if the error persists

romanvoloboev commented 10 months ago

@romanvoloboev try to stop the other tool and check if the error persists

I can't stop "other tool", because there is no other tool except LinuxGSM which starts server. For better understanding, I have next setup:

So I rebooted dedicated server, started game server via LinuxGSM, started SquadJS, connected to server and got this:

image

Start params (screenshot from LinuxGSM tool)

image

Another thing that I should mention that I'm building and runing squadJs via docker-compose But I believe it's also not the problem, since before everything was working good.

image

So I don't know what to do.. please try to reproduce by yourself by installing server via LinuxGSM and connect to it SQJS from the same host with 1 static IP.

fantinodavide commented 10 months ago

@romanvoloboev try to stop the other tool and check if the error persists

I can't stop "other tool", because there is no other tool except LinuxGSM which starts server. For better understanding, I have next setup:

  • dedicated server where I run squadserver via LinuxGSM + squadJS
  • VPS on different IP with admin panel connected to squadserver (but I turned it off, and nothing changed, so it's doesn't matter in this case, forget about it)

So I rebooted dedicated server, started game server via LinuxGSM, started SquadJS, connected to server and got this: image

Start params (screenshot from LinuxGSM tool) image

Another thing that I should mention that I'm building and runing squadJs via docker-compose But I believe it's also not the problem, since before everything was working good. image

So I don't know what to do.. please try to reproduce by yourself by installing server via LinuxGSM and connect to it SQJS from the same host with 1 static IP.

@romanvoloboev try to stop the other tool (rcon web admin panel) connecting to the RCON to avoid conflict. Also, this conversation should be moved on discord as it's not related to the developement of this PR

romanvoloboev commented 10 months ago

As I said before, I disconnected from admin rcon panel, but it didn’t help

Ср, 3 янв. 2024 г. в 13:26, Davide Fantino @.***>:

@romanvoloboev https://github.com/romanvoloboev try to stop the other tool and check if the error persists

I can't stop "other tool", because there is no other tool except LinuxGSM which starts server. For better understanding, I have next setup:

  • dedicated server where I run squadserver via LinuxGSM + squadJS
  • VPS on different IP with admin panel connected to squadserver (but I turned it off, and nothing changed, so it's doesn't matter in this case, forget about it)

So I rebooted dedicated server, started game server via LinuxGSM, started SquadJS, connected to server and got this: [image: image] https://private-user-images.githubusercontent.com/13852208/293877892-3a40b67a-9980-4cb6-a589-9d34cb70456e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQyODEyNTQsIm5iZiI6MTcwNDI4MDk1NCwicGF0aCI6Ii8xMzg1MjIwOC8yOTM4Nzc4OTItM2E0MGI2N2EtOTk4MC00Y2I2LWE1ODktOWQzNGNiNzA0NTZlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTAzVDExMjIzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI4MDUyODJmNTc2YWNmYTMwOGNiNTFhMjNmYmJlMDIwMjQzMDY2YTU1MzgzNmNlYTgwNTBkNzcxZTVjM2Y5MjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.KUwFUfZ5XXdIUI-LggC57YI-xv6Y8mFQuK_cecU5ofw

Start params (screenshot from LinuxGSM tool) [image: image] https://private-user-images.githubusercontent.com/13852208/293878578-ffa02bc1-0917-4c96-9c94-bad697d7aecb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQyODEyNTQsIm5iZiI6MTcwNDI4MDk1NCwicGF0aCI6Ii8xMzg1MjIwOC8yOTM4Nzg1NzgtZmZhMDJiYzEtMDkxNy00Yzk2LTljOTQtYmFkNjk3ZDdhZWNiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTAzVDExMjIzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdiYTg1NGNmOTllM2U1YzRiNmMzMDNmZDNmYTJlZjQxOThhMjM5ZDE3MjA1NThjZmZmY2I4ZWZlYTg0MTExM2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.QIsdCoQlVhCCq75ubo0TyBflydEuyOA4PUFMrtZwiO8

Another thing that I should mention that I'm building and runing squadJs via docker-compose But I believe it's also not the problem, since before everything was working good. [image: image] https://private-user-images.githubusercontent.com/13852208/293878924-0ea9c483-2b67-43fa-9606-ce13aae2fcb7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQyODEyNTQsIm5iZiI6MTcwNDI4MDk1NCwicGF0aCI6Ii8xMzg1MjIwOC8yOTM4Nzg5MjQtMGVhOWM0ODMtMmI2Ny00M2ZhLTk2MDYtY2UxM2FhZTJmY2I3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTAzVDExMjIzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk4Y2FiYmNlNmY4N2NjNDY3YWFlM2Y0NGY2ZjcwMDc5NTA1NTdkYzA3YmMxODVlYjg3YWY2NzRiNWQ2Mzg3YTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Xcs9uo7KI-5L80ZV-dvUC99miM5eQONNEbeF9nYKYnQ

So I don't know what to do.. please try to reproduce by yourself by installing server via LinuxGSM and connect to it SQJS from the same host with 1 static IP.

@romanvoloboev https://github.com/romanvoloboev try to stop the other tool (rcon web admin panel) connecting to the RCON to avoid conflict. Also, this conversation should be moved on discord as it's not related to the developement of this PR

— Reply to this email directly, view it on GitHub https://github.com/Team-Silver-Sphere/SquadJS/pull/318#issuecomment-1875218550, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJV4MDGMPUQIF66ATVQHATYMU57FAVCNFSM6AAAAAA7AGYNAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZVGIYTQNJVGA . You are receiving this because you were mentioned.Message ID: @.***>

romanvoloboev commented 10 months ago

@fantinodavide my issue has been fixed by accepting in firewall input udp traffic to 21114 port

fantinodavide commented 10 months ago

@fantinodavide my issue has been fixed by accepting in firewall input udp traffic to 21114 port

very good!

fantinodavide commented 10 months ago

@werewolfboy13 I think it's ready to be merged