refactor(deployment): Remove WireGuard VPN dependency and restore public service access
Remove WireGuard integration from production deployment to simplify infrastructure: - Remove docker-compose-direct-access.yml (VPN-bound services) - Remove VPN-only middlewares from Grafana, Prometheus, Portainer - Remove WireGuard middleware definitions from Traefik - Remove WireGuard IPs (10.8.0.0/24) from Traefik forwarded headers All monitoring services now publicly accessible via subdomains: - grafana.michaelschiemer.de (with Grafana native auth) - prometheus.michaelschiemer.de (with Basic Auth) - portainer.michaelschiemer.de (with Portainer native auth) All services use Let's Encrypt SSL certificates via Traefik.
This commit is contained in:
106
tests/debug/analyze-expected-codewords.php
Normal file
106
tests/debug/analyze-expected-codewords.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
echo "=== Analyzing Expected Codewords ===\n\n";
|
||||
|
||||
$expectedCodewords = [64, 180, 132, 84, 196, 196, 242, 5, 116, 245, 174, 59, 64, 109, 236, 233];
|
||||
|
||||
// Convert to bits
|
||||
$expectedBits = '';
|
||||
foreach ($expectedCodewords as $cw) {
|
||||
$expectedBits .= str_pad(decbin($cw), 8, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
echo "Expected bit string (128 bits):\n";
|
||||
echo $expectedBits . "\n\n";
|
||||
|
||||
// Decode expected
|
||||
echo "=== Decoding Expected Codewords ===\n";
|
||||
|
||||
// Mode (4 bits)
|
||||
$modeBits = substr($expectedBits, 0, 4);
|
||||
$mode = bindec($modeBits);
|
||||
echo "Mode (bits 0-3): {$modeBits} = {$mode} (expected: 4 for byte mode)\n";
|
||||
|
||||
// Count (8 bits)
|
||||
$countBits = substr($expectedBits, 4, 8);
|
||||
$count = bindec($countBits);
|
||||
echo "Count (bits 4-11): {$countBits} = {$count}\n";
|
||||
|
||||
// Data (11 bytes = 88 bits)
|
||||
echo "\nData bytes (bits 12-99):\n";
|
||||
$decodedData = '';
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$byteStart = 12 + ($i * 8);
|
||||
$byteBits = substr($expectedBits, $byteStart, 8);
|
||||
$byte = bindec($byteBits);
|
||||
$decodedData .= chr($byte);
|
||||
echo " Byte {$i}: {$byteBits} = {$byte} = '{$decodedData[$i]}'\n";
|
||||
}
|
||||
|
||||
echo "\nDecoded data: '{$decodedData}'\n";
|
||||
echo "Expected: 'HELLO WORLD'\n";
|
||||
|
||||
if ($decodedData === 'HELLO WORLD') {
|
||||
echo "✅ Expected codewords decode to 'HELLO WORLD'!\n\n";
|
||||
} else {
|
||||
echo "❌ Expected codewords don't decode correctly!\n\n";
|
||||
}
|
||||
|
||||
// Now check what comes after data (bits 100-127)
|
||||
echo "Bits after data (100-127):\n";
|
||||
$afterData = substr($expectedBits, 100);
|
||||
echo $afterData . "\n\n";
|
||||
|
||||
// Convert to codewords
|
||||
$afterDataCodewords = [];
|
||||
for ($i = 0; $i < strlen($afterData); $i += 8) {
|
||||
$byte = substr($afterData, $i, 8);
|
||||
$afterDataCodewords[] = bindec($byte);
|
||||
}
|
||||
|
||||
echo "Codewords 12-15: " . implode(', ', $afterDataCodewords) . "\n";
|
||||
echo "Expected: 64, 109, 236, 233\n";
|
||||
|
||||
// Our encoding
|
||||
echo "\n=== Our Encoding (for comparison) ===\n";
|
||||
$ourBits = "0100" . // Mode
|
||||
"00001011" . // Count
|
||||
"0100100001000101010011000100110001001111001000000101011101001111010100100100110001000100" . // Data (88 bits)
|
||||
"0000" . // Terminator
|
||||
"11101100" . // Pad 1
|
||||
"00010001" . // Pad 2
|
||||
"11101100"; // Pad 3
|
||||
|
||||
echo "Our bit string (128 bits):\n";
|
||||
echo $ourBits . "\n\n";
|
||||
|
||||
// Compare
|
||||
echo "=== Comparison ===\n";
|
||||
$differences = [];
|
||||
for ($i = 0; $i < 128; $i++) {
|
||||
if ($ourBits[$i] !== $expectedBits[$i]) {
|
||||
$differences[] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
echo "Differences: " . count($differences) . "\n";
|
||||
echo "Positions: " . implode(', ', array_slice($differences, 0, 30)) . "\n\n";
|
||||
|
||||
// Check if our data bits match
|
||||
$ourDataBits = substr($ourBits, 12, 88);
|
||||
$expectedDataBits = substr($expectedBits, 12, 88);
|
||||
if ($ourDataBits === $expectedDataBits) {
|
||||
echo "✅ Data bits match!\n";
|
||||
} else {
|
||||
echo "❌ Data bits differ!\n";
|
||||
for ($i = 0; $i < 88; $i++) {
|
||||
if ($ourDataBits[$i] !== $expectedDataBits[$i]) {
|
||||
echo "Data bit {$i} differs: got '{$ourDataBits[$i]}', expected '{$expectedDataBits[$i]}'\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user