File size: 2,343 Bytes
399bcc0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
const http = require('http');
const dns = require('dns');
// Get DNS servers from environment variables
const dnsServers = [
process.env.DNS_SERVER_1 || '8.8.8.8', // Default to Google DNS
process.env.DNS_SERVER_2 || '8.8.4.4'
];
// Set the DNS servers
dns.setServers(dnsServers);
// DNS resolution example
const checkDNS = (domain) => {
return new Promise((resolve, reject) => {
dns.resolve4(domain, (err, addresses) => {
if (err) {
reject(`Error resolving ${domain}: ${err.message}`);
} else {
resolve(`Resolved ${domain} to IP addresses: ${addresses.join(', ')}`);
}
});
});
};
// HTML template
const htmlTemplate = async () => {
let dnsStatus = 'Checking DNS...';
try {
dnsStatus = await checkDNS('web.whatsapp.com');
} catch (err) {
dnsStatus = err;
}
return `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ayanokoji Kiyotaka</title>
<style>
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #282c34;
color: white;
font-family: 'Arial', sans-serif;
}
h1 {
font-size: 4em;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
marquee {
font-size: 3em;
color: #ffcc00;
font-weight: bold;
margin: 20px;
}
p {
font-size: 1.2em;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>Welcome to Ayanokoji Kiyotaka's World!</h1>
<marquee>AYANOKOJI KIYOTAKA</marquee>
<p>DNS Status: ${dnsStatus}</p>
</body>
</html>
`;
};
// Create the HTTP server
http.createServer(async (req, res) => {
res.writeHead(200, { 'Content-Type': 'text/html' });
const content = await htmlTemplate();
res.end(content);
}).listen(7860, () => {
console.log('Server listening on port 7860');
console.log(`Using DNS servers: ${dnsServers.join(', ')}`);
});
|