From b3d8b01775ceb2587e1defe0e51c6114eda8a8d8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 4 Jan 2022 18:01:30 +0900 Subject: [PATCH] clean up --- .../server/api/endpoints/federation/dns.ts | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 packages/backend/src/server/api/endpoints/federation/dns.ts diff --git a/packages/backend/src/server/api/endpoints/federation/dns.ts b/packages/backend/src/server/api/endpoints/federation/dns.ts deleted file mode 100644 index 76084ad08..000000000 --- a/packages/backend/src/server/api/endpoints/federation/dns.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { promises as dns } from 'dns'; -import $ from 'cafy'; -import define from '../../define'; -import { Instances } from '@/models/index'; -import { toPuny } from '@/misc/convert-host'; - -const resolver = new dns.Resolver(); -resolver.setServers(['1.1.1.1']); - -export const meta = { - tags: ['federation'], - - requireCredential: false as const, - - params: { - host: { - validator: $.str, - }, - }, -}; - -// eslint-disable-next-line import/no-default-export -export default define(meta, async (ps, me) => { - const instance = await Instances.findOneOrFail({ host: toPuny(ps.host) }); - - const [ - resolved4, - resolved6, - resolvedCname, - resolvedTxt, - ] = await Promise.all([ - resolver.resolve4(instance.host).catch(() => []), - resolver.resolve6(instance.host).catch(() => []), - resolver.resolveCname(instance.host).catch(() => []), - resolver.resolveTxt(instance.host).catch(() => []), - ]); - - return { - a: resolved4, - aaaa: resolved6, - cname: resolvedCname, - txt: resolvedTxt, - }; -});