refactor getaddrinfo and add support for most remaining features