eio icon indicating copy to clipboard operation
eio copied to clipboard

DNS utility functions

Open v0idpwn opened this issue 3 years ago • 1 comments

Hi! First off, thanks for the amazing work in eio!

I'd like to have an API for uv_getaddrinfo and uv_getnameinfo. Luv has bindings to these on their DNS module: https://github.com/aantron/luv/blob/0ed668e87ca55d65f4f84422b0dd3381701c71b0/src/DNS.ml

If this feature is welcome in eio, I'd gladly send a PR.

v0idpwn avatar Jul 23 '22 06:07 v0idpwn

Yes please! For uring, something like this could be used:

Eio_unix.run_in_systhread (fun () -> Unix.gethostbyaddr name)

There is a whole family of these get* functions in OCaml's Unix module. I'm not sure how many are useful. The types will need to be wrapped, because Eio.Net can't depend on Unix (it has to work on non-Unix platforms like MirageOS too).

talex5 avatar Jul 23 '22 08:07 talex5

Note: getaddrinfo was added in #278. Do we need getnameinfo too?

talex5 avatar Aug 17 '22 15:08 talex5

Hi, sorry for not following up on this. I've written an implementation for my use case but couldn't settle on a good enough "universal" API to fit in Eio.

he implementation of #278 doesn't support all the features of getaddrinfo but its enough for most of the cases (including mine), so I guess its fine. I don't really need getnameinfo.

v0idpwn avatar Aug 17 '22 15:08 v0idpwn

OK, thanks for confirming!

talex5 avatar Aug 17 '22 16:08 talex5