mirror of https://github.com/TildeNIC/site.git
add location information for nameservers
This commit is contained in:
parent
ee16042f86
commit
785f58fb4a
|
@ -15,6 +15,13 @@ function getDnsServersInfo() {
|
||||||
$servers = [];
|
$servers = [];
|
||||||
$nsFilter = ['ns1', 'ns2']; // Add more nameserver identifiers as needed
|
$nsFilter = ['ns1', 'ns2']; // Add more nameserver identifiers as needed
|
||||||
|
|
||||||
|
// Manually assigned geographical areas for each nameserver
|
||||||
|
$nsGeographicalAreas = [
|
||||||
|
'ns1' => 'Quebec, Canada', // Replace with actual locations
|
||||||
|
'ns2' => 'Frankfurt, Germany',
|
||||||
|
// Add more as needed
|
||||||
|
];
|
||||||
|
|
||||||
if (file_exists($masterFile)) {
|
if (file_exists($masterFile)) {
|
||||||
$content = file_get_contents($masterFile);
|
$content = file_get_contents($masterFile);
|
||||||
// Regex to match A records (IPv4)
|
// Regex to match A records (IPv4)
|
||||||
|
@ -26,19 +33,16 @@ function getDnsServersInfo() {
|
||||||
$ipv6Records = array_combine($aaaaMatches[1], $aaaaMatches[2]);
|
$ipv6Records = array_combine($aaaaMatches[1], $aaaaMatches[2]);
|
||||||
|
|
||||||
foreach ($nsFilter as $nsName) {
|
foreach ($nsFilter as $nsName) {
|
||||||
if (isset($ipv4Records[$nsName])) {
|
$ipv4 = isset($ipv4Records[$nsName]) ? $ipv4Records[$nsName] : 'IPv4 not found';
|
||||||
$ipv4 = $ipv4Records[$nsName];
|
$ipv6 = isset($ipv6Records[$nsName]) ? $ipv6Records[$nsName] : 'IPv6 not found';
|
||||||
} else {
|
$geographicalArea = isset($nsGeographicalAreas[$nsName]) ? $nsGeographicalAreas[$nsName] : 'Unknown Location';
|
||||||
$ipv4 = 'IPv4 not found';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($ipv6Records[$nsName])) {
|
$servers[] = [
|
||||||
$ipv6 = $ipv6Records[$nsName];
|
'hostname' => $nsName,
|
||||||
} else {
|
'ipv4' => $ipv4,
|
||||||
$ipv6 = 'IPv6 not found';
|
'ipv6' => $ipv6,
|
||||||
}
|
'location' => $geographicalArea
|
||||||
|
];
|
||||||
$servers[] = ['hostname' => $nsName, 'ipv4' => $ipv4, 'ipv6' => $ipv6];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,16 +112,16 @@ function checkServerStatus($server) {
|
||||||
<div class="server-list">
|
<div class="server-list">
|
||||||
<h2>TildeNIC Available DNS Servers</h2>
|
<h2>TildeNIC Available DNS Servers</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<?php foreach ($dnsServers as $server): ?>
|
||||||
<?php foreach ($dnsServers as $server): ?>
|
<li>
|
||||||
<li>
|
<?php echo htmlspecialchars($server['hostname']); ?> -
|
||||||
<?php echo htmlspecialchars($server['hostname']); ?> -
|
IPv4: <?php echo htmlspecialchars($server['ipv4']); ?>,
|
||||||
IPv4: <?php echo htmlspecialchars($server['ipv4']); ?>,
|
IPv6: <?php echo htmlspecialchars($server['ipv6']); ?>,
|
||||||
IPv6: <?php echo htmlspecialchars($server['ipv6']); ?> -
|
Location: <?php echo htmlspecialchars($server['location']); ?> -
|
||||||
<span class="status <?php echo checkServerStatus($server['hostname']) === 'Online' ? 'online' : 'offline'; ?>">
|
<span class="status <?php echo checkServerStatus($server['hostname']) === 'Online' ? 'online' : 'offline'; ?>">
|
||||||
<?php echo checkServerStatus($server['hostname']); ?>
|
<?php echo checkServerStatus($server['hostname']); ?>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue