[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: TCP v6 and LuaSocket
- From: Diego Nehab <diego@...>
- Date: Tue, 22 Mar 2011 13:49:48 -0300
Hi,
How about I make the automatic name resolution in LuaSocket to follow the
principled approach of trying addresses in the order returned by getaddrinfo?
Users could invoke the name resolution function themselves, and filter
out the resolved addresses based on their own family requirements?
In other words, socket.connect("www.example.com", 80) would try whatever
the resolve returns: perhaps IPv6 first then if that fails IPv4, or perhaps the
only address returned is IPv4 so that's what connect tries. On the other hand,
socket.connect("192.168.1.4", 80) would obviously try to connect only through
IPv4 and fail through to the user if that doesn't work, whereas
socket.connect("2001:db8::1", 80) would try only IPv6. Since the user can
perform his/her own name resolution, this would be the method to control
specific behavior without weighting the API down with options.
Wouldn't that be both simple and general enough to satisfy everyone?
Maybe the connect() call could accept a table of IP addresses to try
in sequence, so that socket.connect("www.example.com", 80) is equivalent to
socket.connect(socket.toip("www.example.com"), 80), assuming socket.toip()
simply returns the list of resolved addresses in the order provided by
getaddrinfo...
Regards,
Diego