mirror of
https://git.hexahost.dev/smueller/HexaHost-Frontend.git
synced 2026-06-02 08:58:43 +00:00
chore(release): obfuscate and hash production assets [skip ci]
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* HexaDNS - DNS Propagation Check API
|
||||
*
|
||||
* Prüft DNS-Records bei verschiedenen öffentlichen DNS-Servern
|
||||
*
|
||||
* Verwendung: GET /api/dns-propagation.php?domain=example.com&type=A
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
require_once __DIR__ . '/../includes/api-helpers.php';
|
||||
|
||||
@@ -23,7 +23,7 @@ if (!checkApiRateLimit('dns-propagation')) {
|
||||
rejectApiRateLimit();
|
||||
}
|
||||
|
||||
// Öffentliche DNS-Server für Propagation-Check
|
||||
|
||||
$dnsServers = [
|
||||
['name' => 'Google', 'ip' => '8.8.8.8', 'location' => 'Global'],
|
||||
['name' => 'Google Secondary', 'ip' => '8.8.4.4', 'location' => 'Global'],
|
||||
@@ -44,7 +44,7 @@ if ($domain === null) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Erlaubte Record-Typen
|
||||
|
||||
$allowedTypes = ['A', 'AAAA', 'MX', 'NS', 'TXT', 'CNAME'];
|
||||
if (!in_array($type, $allowedTypes)) {
|
||||
$type = 'A';
|
||||
@@ -65,7 +65,7 @@ foreach ($dnsServers as $server) {
|
||||
|
||||
$queryStart = microtime(true);
|
||||
|
||||
// DNS-Abfrage mit spezifischem Server via dig (falls verfügbar) oder dns_get_record
|
||||
|
||||
$records = queryDnsServer($domain, $type, $server['ip']);
|
||||
|
||||
$serverResult['response_time'] = round((microtime(true) - $queryStart) * 1000, 2);
|
||||
@@ -80,7 +80,7 @@ foreach ($dnsServers as $server) {
|
||||
|
||||
$totalTime = round((microtime(true) - $startTime) * 1000, 2);
|
||||
|
||||
// Propagation-Status berechnen
|
||||
|
||||
$propagationStatus = calculatePropagationStatus($results);
|
||||
|
||||
echo json_encode([
|
||||
@@ -93,13 +93,13 @@ echo json_encode([
|
||||
'servers' => $results
|
||||
], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
||||
|
||||
/**
|
||||
* DNS-Abfrage bei spezifischem Server
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function queryDnsServer(string $domain, string $type, string $server): array {
|
||||
$records = [];
|
||||
|
||||
// Versuche zuerst dig zu verwenden (genauer)
|
||||
|
||||
$digResult = @shell_exec(
|
||||
'dig @' . escapeshellarg($server) . ' '
|
||||
. escapeshellarg($domain) . ' '
|
||||
@@ -115,7 +115,7 @@ function queryDnsServer(string $domain, string $type, string $server): array {
|
||||
return $records;
|
||||
}
|
||||
|
||||
// Fallback auf PHP dns_get_record (verwendet System-DNS)
|
||||
|
||||
$dnsType = constant('DNS_' . $type);
|
||||
$result = @dns_get_record($domain, $dnsType);
|
||||
|
||||
@@ -145,9 +145,9 @@ function queryDnsServer(string $domain, string $type, string $server): array {
|
||||
return array_filter($records);
|
||||
}
|
||||
|
||||
/**
|
||||
* Berechnet den Propagation-Status
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function calculatePropagationStatus(array $results): array {
|
||||
$totalServers = count($results);
|
||||
$serversWithRecords = 0;
|
||||
@@ -162,10 +162,10 @@ function calculatePropagationStatus(array $results): array {
|
||||
}
|
||||
}
|
||||
|
||||
// Einzigartige Records
|
||||
|
||||
$uniqueRecords = array_unique($allRecords);
|
||||
|
||||
// Konsistenz prüfen (haben alle Server die gleichen Records?)
|
||||
|
||||
$isConsistent = count($uniqueRecords) <= 1 || $serversWithRecords === 0;
|
||||
|
||||
$percentage = $totalServers > 0 ? round(($serversWithRecords / $totalServers) * 100) : 0;
|
||||
|
||||
Reference in New Issue
Block a user