diff --git a/src/modules/misc/mcserver.js b/src/modules/misc/mcserver.js index 2ad0cbd..741e0d7 100644 --- a/src/modules/misc/mcserver.js +++ b/src/modules/misc/mcserver.js @@ -2,7 +2,7 @@ const Command = require("../../lib/command.js"); const logger = require("../../lib/logger.js"); const net = require("node:net"); -const {resolveSrv} = require("node:dns/promises"); +const {resolveCname, resolveSrv} = require("node:dns/promises"); function readVarInt(data) { var result = 0; @@ -193,10 +193,13 @@ mcserver.callback = async function (msg, line) { const port = split[1] ?? 25565; try { - const addrs = await resolveSrv(ip); + const addrs = await resolveSrv("_tcp." + ip); if (addrs.length > 0) { const mcAddr = addrs.find((a) => a.port == port); if (mcAddr?.name) ip = mcAddr.name; + } else { + const addrs = await resolveCname("_tcp." + ip); + if (addrs.length > 0) ip = addrs[0]; } } catch { // noop