justincormack / ljsyscall

LuaJIT Unix syscall FFI
http://www.myriabit.com/ljsyscall/
Other
441 stars 54 forks source link

getaddrinfo, gethostbyname, etc missing #140

Closed lipp closed 10 years ago

justincormack commented 10 years ago

Yes, they are out of the current scope, which is the system calls, while these are in the C library, although I have put a couple of C library things in syscall/libc.lua.

There are a whole lot of issues that need to be addressed with those (do you want to just use the C implementations or reimplement in Lua, how to deal with the fact that some of these do memory allocations which you need to gc etc). Also a lot of people want non blocking implementations which libc does not provide.

There is scope to either use another library for these, or to use existing Lua libraries, but I would rather that there were other libraries that worked well with ljsyscall rather than adding them...

lipp commented 10 years ago

Ok, I understand. Right now it would be convenient to have it. I'd prefer to not depend on luasocket, but I will do "raw" dns via socket+dns server anyhow for having not blocking dns. The aim of nodish is to stay small and to not require C stuff like c-ares and the like.

justincormack commented 10 years ago

I was thinking of porting https://github.com/agentzh/lua-resty-dns which is a pure Lua resolver, although it needs some stuff form nginx - I was going to work on a stub library for porting these lua-resty-* modules (there are ones for http etc too).

daurnimator commented 10 years ago

Have a look at http://hg.prosody.im/trunk/file/3b7206981317/net/adns.lua but I feel like this shouldn't be part of ljsyscall

EDIT: herp; I linked to wrong file; look at http://hg.prosody.im/trunk/file/3b7206981317/net/dns.lua

lipp commented 10 years ago

Great, I'll have a look at it. To me it seems, that it is no biggy if you can deal with sockets. Just the "query/resolve" part is of interest for me.