如何检查服务器是否支持xmpp协议?
我正在寻找一种方法来检查服务器是否支持 xmpp 协议,即 xmpp-server 正在该域上运行。
也许是特殊的 DNS 检查或类似的东西?
I'm looking for a way to check if a server is support xmpp protocol, i.e. xmpp-server is running on this domain.
Maybe special DNS check or something like that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
大多数 XMPP 服务器应至少支持以下 DNS SRV 记录之一:
example.com
example.com
某些服务器可能没有发布这些记录,但其中大多数服务器不想与外界通信。 例如,您可以在命令行上使用“dig”来检查域,如下所示:
“+short”删除大量 DNS 详细信息,“-t SRV”表示我们需要 SRV 记录,点位于最后说忽略你的本地域名设置。
(响应@user188719添加)
如果没有找到SRV记录,您可以尝试使用原始域名,并假设端口5222用于客户端连接或5269用于服务器连接。
获得要连接的主机名和端口号后,您可以使用 telnet 主机名端口 来查看是否有进程正在侦听。 但是,要真正检测该主机/端口是否是 XMPP 服务器,请在 XMPP 流的开头发送。
nc
或netcat
为此提供了一种方便的机制。 服务器到服务器检查的示例:Most XMPP servers should support at least one of these DNS SRV records:
example.com
example.com
Some servers may not have these records published, but most of those will not want to talk to the outside world. As an example, you can use "dig" on the command line to check a domain, like this:
"+short" gets rid of a lot of DNS details, "-t SRV" says we want SRV records, and the dot at the end says to ignore your local domain name settings.
(adding in response to @user188719)
If you don't find an SRV record, you can try using the original domain name, and assuming port 5222 for client connections or 5269 for server connections.
Once you have the hostname and port number to connect to, you can use
telnet hostname port
to see if there is a process listening there. However, to really detect if it's an XMPP server at that host/port, send in the start of an XMPP stream.nc
ornetcat
provide a convenient mechanism for this. Example for a server-to-server check:按照 Joe 的解释,我个人会检查 SRV 记录并回退到端口 5269 上的快速(短超时)连接检查。然后缓存结果。
Following Joe's explanation, I personally would check SRV records and fall back to a quick (short timeout) connect check on port 5269. Then cache the result.
您可以尝试 IMtrends: http://www.process-one.net/en/imtrends/
You can try IMtrends: http://www.process-one.net/en/imtrends/