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:
98
tests/debug/test-rs-reference-data-ec.php
Normal file
98
tests/debug/test-rs-reference-data-ec.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
use App\Framework\QrCode\ErrorCorrection\ReedSolomonEncoder;
|
||||
|
||||
echo "=== RS with Reference Data Codewords ===\n\n";
|
||||
|
||||
// Reference data codewords from QR code specification
|
||||
$referenceData = [64, 180, 132, 84, 196, 196, 242, 5, 116, 245, 174, 59, 64, 109, 236, 233];
|
||||
$ecCodewords = 10;
|
||||
|
||||
echo "Reference data codewords:\n";
|
||||
echo implode(', ', $referenceData) . "\n\n";
|
||||
|
||||
$rs = new ReedSolomonEncoder();
|
||||
$ec = $rs->encode($referenceData, $ecCodewords);
|
||||
|
||||
echo "Generated EC codewords:\n";
|
||||
echo implode(', ', $ec) . "\n\n";
|
||||
|
||||
// Known reference EC codewords from QR code specification
|
||||
// These should be the correct EC codewords for the reference data
|
||||
$referenceEC = [0, 245, 228, 127, 21, 207, 194, 102, 66, 52];
|
||||
|
||||
echo "Expected EC codewords (from spec):\n";
|
||||
echo implode(', ', $referenceEC) . "\n\n";
|
||||
|
||||
// Compare
|
||||
$matches = 0;
|
||||
for ($i = 0; $i < min(count($ec), count($referenceEC)); $i++) {
|
||||
if ($ec[$i] === $referenceEC[$i]) {
|
||||
$matches++;
|
||||
} else {
|
||||
echo "❌ EC codeword {$i}: got {$ec[$i]}, expected {$referenceEC[$i]}\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($matches === count($referenceEC)) {
|
||||
echo "✅ All EC codewords match reference!\n";
|
||||
} else {
|
||||
echo "❌ {$matches}/" . count($referenceEC) . " EC codewords match\n";
|
||||
}
|
||||
|
||||
// Verify with decoder
|
||||
require_once __DIR__ . '/test-reed-solomon-decoder.php';
|
||||
$decoder = new SimpleRSDecoder();
|
||||
|
||||
$fullCodeword = array_merge($referenceData, $ec);
|
||||
$syndromes = $decoder->calculateSyndromes($fullCodeword, 10);
|
||||
|
||||
echo "\nSyndromes (should all be 0):\n";
|
||||
echo implode(', ', $syndromes) . "\n";
|
||||
|
||||
$allZero = true;
|
||||
foreach ($syndromes as $s) {
|
||||
if ($s !== 0) {
|
||||
$allZero = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($allZero) {
|
||||
echo "\n✅ All syndromes are zero - Reed-Solomon is CORRECT!\n";
|
||||
} else {
|
||||
echo "\n❌ Syndromes are not all zero - Reed-Solomon is WRONG!\n";
|
||||
echo "\nThis confirms the Reed-Solomon implementation has a bug.\n";
|
||||
}
|
||||
|
||||
// Also test with reference EC codewords
|
||||
echo "\n=== Testing with Reference EC Codewords ===\n";
|
||||
$fullWithReferenceEC = array_merge($referenceData, $referenceEC);
|
||||
$syndromesRef = $decoder->calculateSyndromes($fullWithReferenceEC, 10);
|
||||
|
||||
echo "Syndromes with reference EC codewords:\n";
|
||||
echo implode(', ', $syndromesRef) . "\n";
|
||||
|
||||
$allZeroRef = true;
|
||||
foreach ($syndromesRef as $s) {
|
||||
if ($s !== 0) {
|
||||
$allZeroRef = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($allZeroRef) {
|
||||
echo "\n✅ Reference EC codewords are valid!\n";
|
||||
echo "This means the reference EC codewords are correct.\n";
|
||||
echo "Our implementation produces different (incorrect) EC codewords.\n";
|
||||
} else {
|
||||
echo "\n❌ Even reference EC codewords are invalid!\n";
|
||||
echo "This means either:\n";
|
||||
echo " 1. The reference EC codewords are wrong\n";
|
||||
echo " 2. Our syndrome calculation is wrong\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user