Skip to content

Commit

Permalink
Add DNS map summary ℹ️
Browse files Browse the repository at this point in the history
  • Loading branch information
wotschofsky committed Jan 16, 2024
1 parent cc5a521 commit aa8677d
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions app/lookup/[domain]/map/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isbot } from 'isbot';
import { ShieldAlertIcon } from 'lucide-react';
import { CheckCircleIcon, InfoIcon, ShieldAlertIcon } from 'lucide-react';
import { headers } from 'next/headers';
import type { FC } from 'react';

Expand Down Expand Up @@ -57,7 +57,51 @@ const MapResultsPage: FC<MapResultsPageProps> = async ({
})
);

return <ResultsGlobe domain={domain} markers={markers} />;
let hasDifferentRecords = false;
for (let i = 1; i < markers.length; i++) {
const previous = markers[i - 1].results;
const current = markers[i].results;
if (
previous.A.toSorted().toString() !== current.A.toSorted().toString() ||
previous.AAAA.toSorted().toString() !==
current.AAAA.toSorted().toString() ||
previous.CNAME.toSorted().toString() !==
current.CNAME.toSorted().toString()
) {
console.log(previous, current);
hasDifferentRecords = true;
break;
}
}

return (
<>
<Alert className="mx-auto mt-16 w-max">
{hasDifferentRecords ? (
<>
<InfoIcon className="h-4 w-4" />
<AlertTitle>Different records detected!</AlertTitle>
<AlertDescription>
Not all regions have the same records for this domain. This{' '}
<i>could</i> be an indication for the use of GeoDNS.
<br /> Keep in mind however, that some providers rotate their IP
addresses, which can also lead to different results.
</AlertDescription>
</>
) : (
<>
<CheckCircleIcon className="h-4 w-4" />
<AlertTitle>All records are the same!</AlertTitle>
<AlertDescription>
All records are the same for all regions. Therefore propagation
was successful and the domain is not using GeoDNS.
</AlertDescription>
</>
)}
</Alert>
<ResultsGlobe domain={domain} markers={markers} />
</>
);
};

export default MapResultsPage;

1 comment on commit aa8677d

@vercel
Copy link

@vercel vercel bot commented on aa8677d Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.