Skip to content

Commit

Permalink
Added support to Enshrouded game
Browse files Browse the repository at this point in the history
  • Loading branch information
Cabecinha84 committed Jan 29, 2024
1 parent fe4c53a commit 8591827
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/services/application/checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,8 @@ async function checkMinecraft(ip, port) {
host: ip,
port,
attemptTimeout: 5000,
givenPortOnly: true,
maxRetries: 3
});
return true;
} catch (error) {
Expand All @@ -635,6 +637,25 @@ async function checkPalworld(ip, port) {
host: ip,
port,
attemptTimeout: 5000,
givenPortOnly: true,
maxRetries: 3
});
return true;
} catch (error) {
return false;
}
}

async function checkEnshrouded(ip, port) {
try {
const gg = await gamedig;
const state = await gg.GameDig.query({
type: 'enshrouded',
host: ip,
port,
attemptTimeout: 5000,
givenPortOnly: true,
maxRetries: 3,
});
return true;
} catch (error) {
Expand Down Expand Up @@ -664,6 +685,8 @@ async function checkApplication(app, ip) {
isOK = await checkMinecraft(ip.split(':')[0], app.version >= 4 ? app.compose[0].ports[0] : app.ports[0]);
} else if (app.name.toLowerCase().includes('palworld')) {
isOK = await checkPalworld(ip.split(':')[0], app.version >= 4 ? app.compose[0].ports[0] : app.ports[0]);
} else if (app.name.toLowerCase().includes('enshrouded')) {
isOK = await checkEnshrouded(ip.split(':')[0], app.version >= 4 ? app.compose[0].ports[0] : app.ports[0]);
} else {
const matchIndex = ethersList.findIndex((eApp) => app.name.startsWith(eApp.name));
if (matchIndex > -1) {
Expand Down
4 changes: 4 additions & 0 deletions src/services/application/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ function getCustomConfigs(specifications) {
defaultConfig.mode = 'tcp';
defaultConfig.check = false;
}
if (specifications.name.toLowerCase().includes('enshrouded')) {
defaultConfig.mode = 'tcp';
defaultConfig.check = false;
}

const customConfigs = {
'31350.kmdsapactapi.kmdsapactapi': {
Expand Down

0 comments on commit 8591827

Please sign in to comment.