#DNS lookups in Gleam
1 messages · Page 1 of 1 (latest)
Nothing turns up in packages so mainly asking if the functionality is nestled in to another library https://packages.gleam.run/?search=dns
Not that I'm aware of
You'd need to have one library for Erlang and another for JS as they have different concurrency systems
I was thinking this library would be synchronous, at least the Erlang inet_res API is synchronous. And then I'd handle any promises directly in JS and return the result directly from the external function
Gotcha thanks been awhile since I developed JavaScript
Funny enough it looks like Node's DNS API is callback-based, no promises as far as I can tell
Same problem
There's no way to take a computation that happens later and return it now without a promise or a callback or some other wrapper
Not without blocking the event loop, which is likely a bad idea for most applications, and rarely there's an API that makes it possible to do
that makes sense thank you! Relatedly - now that I know we need separate libraries - would it make sense eventually for this DNS resolution functionality to live in gleam_erlang and gleam_javascript, as gleam/erlang/inet_res and gleam/javascript/dns modules respectively?
If they're gonna be separate libraries they may as well be direct wrappers , no?
Those libraries are for common platform specific functionality that many programs will need
This isn't common or specifically about JS or Erlang, so they wouldn't be in those libraries
understood
is there a naming convention for libraries wrapping a standard module in one of the targets, that doesn't fall under the gleam_erlang or gleam_javascript umbrellas? I'm interested in implementing this and want to comply with standards, if any
I'm keen in using these wrappers if one gets made, I'll be a JS user.
I think I'm gonna make the erlang one first, only b/c I'm more familiar with that runtime. Willing to collab on a JS lib though!
erlang first is great. I'm keen to see the API you get too and happy to collab on the JS
one thing to keep in mind is that currently bun doesn’t implement node’s dgram module, so getting at udp packets will be impossible. also any web api focused runtime will be challenging (or not possible) for udp support
but node, deno & erlang should be no problem to support
implementing DNS over HTTPS should be no problem anywhere.