使用带有-h标志的whois ruby gem

问题描述 投票:0回答:1

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

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

ruby-on-rails whois
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")

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

© www.soinside.com 2019 - 2024. All rights reserved.