Skip to content

Instantly share code, notes, and snippets.

@AndyIsHereBoi
Last active November 26, 2025 08:41
Show Gist options
  • Select an option

  • Save AndyIsHereBoi/eed5853873e8296a249f7136fc8ad040 to your computer and use it in GitHub Desktop.

Select an option

Save AndyIsHereBoi/eed5853873e8296a249f7136fc8ad040 to your computer and use it in GitHub Desktop.
Scans Discord for its voice servers.
import dns from 'node:dns';
import fetch from 'node-fetch';
import regions from "./regions.json" assert { type: "json" };
import fs from 'node:fs';
const IPINFO_API_KEY = "key here";
const loops = 15000;
var regionscomplete = {};
async function processDomains() {
for (const region of regions) {
for (let i = 0; i < loops; i++) {
const domain = `${region}${i + 1}.discord.gg`;
console.log(domain)
try {
const address = await resolveDNS(domain);
await resolveData(address, domain, region);
} catch (error) {
// console.error(`Error resolving ${domain}:`, error);
}
}
}
}
function resolveDNS(domain) {
return new Promise((resolve, reject) => {
dns.lookup(domain, (err, address) => {
if (err) {
reject(err);
} else {
resolve(address);
}
});
});
};
async function resolveData(ip, dnsDomain, region) {
console.log('getting ip info');
try {
const response = await fetch(`https://ipinfo.io/${ip}/json?token=${IPINFO_API_KEY}`);
const responseData = await response.json();
const completeObject = {
"ip": ip,
"dns": dnsDomain,
"city": responseData.city,
"region": responseData.region,
"country": responseData.country,
"org": responseData.org
};
console.log(completeObject);
pushRegionData(region, completeObject)
} catch (error) {
console.error(`Error fetching IP info for ${dnsDomain}:`, error);
};
};
function pushRegionData(region, data) {
if (!regionscomplete.hasOwnProperty(region)) {
regionscomplete[region] = []; // initialize an empty array for the region if it doesn't exist already
};
regionscomplete[region].push(data); // add the resolved data to the region array
};
processDomains();
process.on('exit', beforeProcessExit);
function beforeProcessExit() {
const jsonContent = JSON.stringify(regionscomplete);
fs.writeFileSync('./output.json', jsonContent, (err) => {
if (err) {
console.error('Error writing JSON file:', err);
} else {
console.log('JSON file saved successfully!');
}
});
console.log("Before process exit");
console.log(regionscomplete);
// Write the JSON string to a file
};
{
"name": "discord-voice-servers",
"version": "0.0.1",
"description": "Resolve all discord voice server IPS",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "AndyIsHereBoi",
"license": "ISC",
"dependencies": {
"axios": "^1.6.5",
"node-fetch": "^3.3.2"
}
}
[
"atlanta",
"brazil",
"bucharest",
"buenos-aires",
"dammam",
"dubai",
"finland",
"frankfurt",
"hongkong",
"india",
"jakarta",
"japan",
"madrid",
"milan",
"montreal",
"newark",
"oregon",
"rotterdam",
"russia",
"santa-clara",
"santiago",
"seattle",
"singapore",
"south-korea",
"southafrica",
"st-pete",
"stage-scale",
"stockholm",
"sydney",
"tel-aviv",
"us-central",
"us-east",
"us-south",
"us-west",
"warsaw"
]
@AndyIsHereBoi
Copy link
Author

Hi, they are using the same ips for API request too? I need to test some blockage at my end. Thanks

I'm not sure

@Hendrik292
Copy link

Hi, I saw discord changed the server names e.g. "c-syd06-d39b72ca"
Screenshot_32

Is there a way to scan the new IPs?

@AndyIsHereBoi
Copy link
Author

AndyIsHereBoi commented Nov 19, 2025

@Hendrik292 check the other gist
https://gist.github.com/AndyIsHereBoi/bf57d7fa1661c82b4a7f5987e56420bf

I commented on there but I'm not sure if we can get them all now by old hostnames or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment