DNS记录访问Websocket

DNS记录访问Websocket

本文介绍了有没有办法通过SRV DNS记录访问Websocket?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发誓我这么干我想知道是否有任何方法通过解决一个 SRV DNS查询来连接到WebSocket服务。原则上,对我来说听起来是合理的,例如,在服务正在收听的端口取决于主机和没有固定端口的情况。



例如:
服务器在端口1234上监听一个WebSocket。
服务器B在端口1235上侦听一个WebSocket。



服务器NS向A分配一个 CNAME ,将一个 CNAME 分配给B.它还添加了一个 SRV 条目指向A和B的 CNAME s,并指向每个端口。



连接时,用户应该连接到一些类似 srvws:// websockethost 而不是 ws:// aorbcname:aorbport



甚至可以做这样的事情吗?有没有计划呢?有什么办法可以解决这种问题,在那里我需要与DNS查询一起传送端口?



更新:环顾四周发现了这个草案:



但我不太确定如何解释这个。这是标准吗?这甚至被批准了吗?这只是一个提案吗?

解决方案

在RFC 2782中它说明

SRV RR的格式是

没有技术原因,您无法使用SRV记录指向WS。正如你所指出的,它已经成为IETF草案的主题。这似乎没有任何进一步的,尽管其原因不清楚,它的它似乎已经与RFC 6455合并有关于包含的 IETF草案具有以下

所以没有技术规范,当然没有理由你不能/不应该。这个想法已被提出并被允许死亡,因为如果要使用SRV记录来查找完全在协议中的WS服务,最终取决于您。



在我看来,这将解决一些问题。



已编辑添加



在IETF留言板上进行了更多的挖掘之后。 (好奇,为什么没有实现得到我的更好)我发现来自提出这个消息的人

所以虽然听起来不错,但真正的人了解这些东西(并为其编写标准)发现一些问题,建议使用标准的HTTP / A记录查找。


I swear I googled this. I was wondering if there is any way to connect to a WebSocket service by resolving a SRV DNS query. In principle, this sounds reasonable to me, e.g., in a situation where the port where the service is going to be listening depends on the host and there is not a fixed port.

For example:Server A listens with a WebSocket on port 1234.Server B listens with a WebSocket on port 1235.

Server NS assigns a CNAME to A, and a CNAME to B. It also adds a SRV entry that points to A's and B's CNAMEs, and also points to each port.

When connecting, an user should then connect to something like srvws://websockethost rather than ws://aorbcname:aorbport.

Is it even possible to do such a thing? Is there any planning at all about this? Is there any alternative to solve this kind of problem, where I need to communicate ports along with the DNS query?

Update: looking around I found this draft: https://tools.ietf.org/html/draft-ibc-websocket-dns-srv-02

But I am not really sure how to interpret this. Is this a standard? Was this even approved? Is this just a proposal?

解决方案

In RFC 2782 A DNS RR for specifying the location of services (DNS SRV) it states

The format of a SRV RR is

There is no technical reason that you couldn't use a SRV record to point to a WS. As you point out it has been the subject of an IETF draft. That doesn't appear to have gone any further, though the reasons aren't clear from its history it does appear to have been merged with RFC 6455 The WebSocket Protocol There is a discussion concerning the inclusion of IETF draft DNS SRV Resource Records for the WebSocket Protocol that has the following

So while there is no technical specification, there is certainly no reason why you can't / shouldn't. The idea has been proposed and allowed to die because ultimately it is up to you if you want to use a SRV record to find a WS service that is perfectly within protocol.

And in my opinion, it would solve a number of problems.

Edited to add

After some more digging around on the IETF message boards. (curiosity as to why it wasn't implemented got the better of me) I found this message from the guy who proposed it

So while it sounds a good idea, the people who really understand this stuff (and write the standards for it) found some issues that suggested simply using standard HTTP / A record look ups.

这篇关于有没有办法通过SRV DNS记录访问Websocket?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 19:31
查看更多