10000 Detect velocity snapshot logs by JulianVennen · Pull Request #57 · aternosorg/codex-minecraft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Detect velocity snapshot logs #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Log/Minecraft/Velocity/VelocityLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*/
abstract class VelocityLog extends MinecraftLog
{
protected static string $pattern = '/^(\[(?:[0-9]{2}\:?){3}\] \[[^\/]+\/(\w+)\]\:).*$/';
protected static string $prefixPattern = '(\[(?:[0-9]{2}\:?){3}\] \[[^\/]+\/(\w+)\]\:) ';
protected static string $pattern = '/^(\[(?:[0-9]{2}\:?){3}\] \[[^\/]+\/(\w+)\](?: \[[^\]]+\])?\:).*$/';
protected static string $prefixPattern = '(\[(?:[0-9]{2}\:?){3}\] \[[^\/]+\/(\w+)\](?: \[[^\]]+\])?\:) ';

/**
* @return VelocityAnalyser
Expand All @@ -30,7 +30,7 @@ public static function getDefaultAnalyser(): VelocityAnalyser
public static function getDetectors(): array
{
return [
(new SinglePatternDetector())->setPattern('/^' . static::$prefixPattern . 'Booting up Velocity [0-9\.]+$/m')
(new SinglePatternDetector())->setPattern('/^' . static::$prefixPattern . 'Booting up Velocity [0-9\.]+/m')
];
}

Expand Down
101 changes: 101 additions & 0 deletions test/data/Velocity/velocity-snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"id": "velocity\/proxy",
"name": "Velocity",
"type": "Proxy Log",
"version": null,
"title": "Velocity Proxy Log",
"entries": [
{
"level": 6,
"time": null,
"prefix": "[11:17:12] [main\/INFO] [com.velocitypowered.proxy.VelocityServer]:",
"lines": [
{
"number": 1,
"content": "[11:17:12] [main\/INFO] [com.velocitypowered.proxy.VelocityServer]: Booting up Velocity 3.2.0-SNAPSHOT (git-19abb909-b265)..."
}
]
},
{
"level": 6,
"time": null,
"prefix": "[11:17:12] [main\/INFO] [com.velocitypowered.proxy.VelocityServer]:",
"lines": [
{
"number": 2,
"content": "[11:17:12] [main\/INFO] [com.velocitypowered.proxy.VelocityServer]: Loading localizations..."
}
]
},
{
"level": 6,
"time": null,
"prefix": "[11:17:13] [main\/INFO] [com.velocitypowered.proxy.network.ConnectionManager]:",
"lines": [
{
"number": 3,
"content": "[11:17:13] [main\/INFO] [com.velocitypowered.proxy.network.ConnectionManager]: Connections will use epoll channels, libdeflate (Linux x86_64) compression, OpenSSL 3.0.x (Linux x86_64) ciphers"
}
]
},
{
"level": 4,
"time": null,
"prefix": "[11:17:13] [main\/WARN] [com.velocitypowered.proxy.config.VelocityConfiguration]:",
"lines": [
{
"number": 4,
"content": "[11:17:13] [main\/WARN] [com.velocitypowered.proxy.config.VelocityConfiguration]: Player info forwarding is disabled! All players will appear to be connecting from the proxy and will have offline-mode UUIDs."
}
]
},
{
"level": 6,
"time": null,
"prefix": "[11:17:13] [main\/INFO] [com.velocitypowered.proxy.VelocityServer]:",
"lines": [
{
"number": 5,
"content": "[11:17:13] [main\/INFO] [com.velocitypowered.proxy.VelocityServer]: Loading plugins..."
}
]
},
{
"level": 6,
"time": null,
"prefix": "[11:17:13] [main\/INFO] [com.velocitypowered.proxy.VelocityServer]:",
"lines": [
{
"number": 6,
"content": "[11:17:13] [main\/INFO] [com.velocitypowered.proxy.VelocityServer]: Loaded 0 plugins"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[11:17:13] [Netty epoll Boss #0\/INFO] [com.velocitypowered.proxy.network.ConnectionManager]:",
"lines": [
{
"number": 7,
"content": "[11:17:13] [Netty epoll Boss #0\/INFO] [com.velocitypowered.proxy.network.ConnectionManager]: Listening on \/0.0.0.0:25577"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[11:17:13] [main\/INFO] [com.velocitypowered.proxy.Velocity]:",
"lines": [
{
"number": 8,
"content": "[11:17:13] [main\/INFO] [com.velocitypowered.proxy.Velocity]: Done (0.7s)!"
}
]
}
],
"analysis": {
"problems": [],
"information": []
}
}
8 changes: 8 additions & 0 deletions test/data/Velocity/velocity-snapshot.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[11:17:12] [main/INFO] [com.velocitypowered.proxy.VelocityServer]: Booting up Velocity 3.2.0-SNAPSHOT (git-19abb909-b265)...
[11:17:12] [main/INFO] [com.velocitypowered.proxy.VelocityServer]: Loading localizations...
[11:17:13] [main/INFO] [com.velocitypowered.proxy.network.ConnectionManager]: Connections will use epoll channels, libdeflate (Linux x86_64) compression, OpenSSL 3.0.x (Linux x86_64) ciphers
[11:17:13] [main/WARN] [com.velocitypowered.proxy.config.VelocityConfiguration]: Player info forwarding is disabled! All players will appear to be connecting from the proxy and will have offline-mode UUIDs.
[11:17:13] [main/INFO] [com.velocitypowered.proxy.VelocityServer]: Loading plugins...
[11:17:13] [main/INFO] [com.velocitypowered.proxy.VelocityServer]: Loaded 0 plugins
[11:17:13] [Netty epoll Boss #0/INFO] [com.velocitypowered.proxy.network.ConnectionManager]: Listening on /0.0.0.0:25577
[11:17:13] [main/INFO] [com.velocitypowered.proxy.Velocity]: Done (0.7s)!
10 changes: 10 additions & 0 deletions test/tests/Logs/AutoLogsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,16 @@ public function test_vanilla_start_1132(): void
$this->assertStringEqualsFile($log->getExpectedPath(), $log->getOutput(), $log->getLogPath());
}

/**
* @return void
* @throws Exception
*/
public function test_velocity_snapshot(): void
{
$log = new TestLog('Velocity/velocity-snapshot.log');
$this->assertStringEqualsFile($log->getExpectedPath(), $log->getOutput(), $log->getLogPath());
}

/**
* @return void
* @throws Exception
Expand Down
0