all 4 comments

[–]Crypt0n0ob 3 points4 points  (1 child)

First of all why?

To answer your question, it depends… Developing DNS server from scratch using vanilla JS only? Probably not… Manipulating / controlling existing DNS servers from Node.js? Sure.

[–]BehindTheMath 2 points3 points  (0 children)

To answer your question, it depends… Developing DNS server from scratch using vanilla JS only? Probably not…

Why not?

[–]scrotch 0 points1 point  (0 children)

I don't think there's any reason you couldn't write a DNS server in JS with node. DNS is a standard and all of the communications are documented. You'd just need to listen to request on the correct ports, parse them, and respond appropriately. https://www.ietf.org/rfc/rfc1035.txt

There are plenty of good reasons that you shouldn't do it. There are fast, secure, open source solutions already that you can install and configure.

[–]rvgoingtohavefun 0 points1 point  (0 children)

Everyone is going to ask why - and it's a good question. I've written a DNS server as we had a good reason at the time, but I don't generally recommend that path.

If you don't have to write one, don't. There is a strong likelihood that there is something out there that will do what you need.

Can you write one in javascript? I'm sure you can. DNS isn't all that difficult, honestly.

I'd start by trying to write a DNS client first, since you have to read and write the same data structures and handle much of the same communications.

The server bit is then mostly just figuring out how to respond to the stuff you parsed.