0

有没有办法使用带有标志的 whois gem ( https://github.com/weppos/whois )?-h我希望对我的 rails 项目中的特定数据库主机运行 whois 查询(例如whois -h whois.myserver.example google.com

如果没有,还有其他方法可以做到这一点吗?

4

1 回答 1

0

来自https://www.rubydoc.info/gems/whois/Whois/Client上的文档

参数:

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

Hash of settings to customize the client behavior.

选项哈希(设置):

: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.

所以

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

应该是你需要的。不知道您是否也需要更改端口。

于 2019-04-14T03:37:40.937 回答