Skip to content

Instantly share code, notes, and snippets.

@jmorton
Created April 29, 2010 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmorton/383785 to your computer and use it in GitHub Desktop.
Save jmorton/383785 to your computer and use it in GitHub Desktop.
def localhost
reverse_lookup "127.0.0.1"
end
require 'socket'
def reverse_lookup(address)
Socket.getaddrinfo address, 0, 'AF_UNSPEC', Socket::SOCK_STREAM
end
@jmorton
Copy link
Author

jmorton commented Apr 29, 2010

ruby-1.8.7-p249 > reverse_lookup("75.126.76.113")
=> [["AF_INET", 0, "75.126.76.113-static.reverse.softlayer.com", "75.126.76.113", 2, 1, 6]] 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment