Использование whois rubygem с флагом -h - PullRequest
0 голосов
/ 11 апреля 2019

Есть ли способ использовать гем whois (https://github.com/weppos/whois) с флагом -h? Я ищу для выполнения запросов whois к определенному хосту базы данных в моем проекте rails (например, whois -h whois.myserver.example google.com)

Если нет, есть ли другие способы сделать это?

1 Ответ

0 голосов
/ 14 апреля 2019

Из документации на https://www.rubydoc.info/gems/whois/Whois/Client

Параметры:

settings (Hash) (defaults to: {}) —

Hash of settings to customize the client behavior.

Опции Hash (настройки):

:timeout (Integer, nil) — default: DEFAULT_TIMEOUT —

The timeout for a WHOIS query, expressed in seconds.
:bind_host (String) — default: nil —

Providing an IP address or hostname will bind the Socket connection to the specific local host.
:bind_port (Fixnum) — default: nil —

Providing port number will bind the Socket connection to the specific local port.
:host (String, nil) — default: nil —

The server host to query. Leave it blank for intelligent detection.

So

client = Whois::Client.new(:host => "whois.myserver.example")

должно быть то, что вам нужно. Не знаю, нужно ли вам тоже сменить порт.

...