Using the ruby whois gem, how do I set the server address of the whois service?
Setting the bind_host, I get an error.
> whois_client = Whois::Client.new(bind_host: "192.0.47.59", bind_port: 43)
=> #<Whois::Client:0x00000008188e7e50 @timeout=10, @settings={:bind_host=>"192.0.47.59", :bind_port=>43}>
> record = whois_client.lookup('wandajackson.com')
Whois::ConnectionError: Errno::EADDRNOTAVAIL: Can't assign requested address - bind(2) for "192.0.47.59" port 43
from (irb):4
I'm pretty sure
bind_hostdoesn't refer to the host used for the whois lookup, but instead refers to the adapter binding on the server running your code. By default it binds to 0.0.0.0, or all the adapters on the local server.If you want to have the whois gem use a custom server address for looking up whois information then it appears that you have to specify it in one of the following ways:
These examples were taken from https://www.rubydoc.info/gems/whois/Whois/Server.