// DNS Things - Whois Module // Initialize Whois lookup form function initWhoisForm() { const form = document.getElementById('whois-form'); const input = document.getElementById('whois-input'); const results = document.getElementById('whois-results'); const loader = document.getElementById('whois-loader'); if (!form || !input || !results || !loader) return; form.addEventListener('submit', async (e) => { e.preventDefault(); const domain = input.value.trim(); if (!domain) return; // Show loader loader.classList.remove('hidden'); results.innerHTML = ''; try { // Use DNS-based domain information lookup as a free alternative const recordTypes = ['A', 'AAAA', 'MX', 'TXT', 'NS', 'SOA']; const queries = recordTypes.map(type => fetch(`https://dns.google/resolve?name=${encodeURIComponent(domain)}&type=${type}`) .then(response => response.json()) .then(data => ({ type, data })) .catch(error => ({ type, error })) ); const responses = await Promise.all(queries); // Process DNS data const dnsData = {}; const ipAddresses = { ipv4: [], ipv6: [] }; responses.forEach(({ type, data, error }) => { if (!error && data.Answer && data.Answer.length > 0) { dnsData[type] = data.Answer.map(record => record.data); if (type === 'A') { ipAddresses.ipv4.push(...data.Answer.map(record => record.data)); } else if (type === 'AAAA') { ipAddresses.ipv6.push(...data.Answer.map(record => record.data)); } } }); // Determine TLD registry const tld = domain.split('.').pop().toLowerCase(); const tldRegistries = { 'com': 'Verisign', 'net': 'Verisign', 'org': 'Public Interest Registry (PIR)', 'info': 'Afilias', 'biz': 'NeuStar', 'name': 'Verisign', 'mobi': 'Afilias', 'travel': 'Tralliance', 'museum': 'MuseDoma', 'coop': 'DotCooperation', 'aero': 'SITA', 'pro': 'RegistryPro', 'edu': 'Educause', 'gov': 'General Services Administration', 'mil': 'DoD Network Information Center', 'int': 'IANA' }; // Build results let resultsHTML = '
Note: This is a DNS-based lookup providing practical domain information. For detailed registration data, use official whois services.
Failed to lookup domain information. Please try again.