Skip to content

WebRTC Relay #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
timzaak opened this issue Oct 13, 2023 · 1 comment
Closed

WebRTC Relay #44

timzaak opened this issue Oct 13, 2023 · 1 comment
Labels

Comments

@timzaak
Copy link
Contributor

timzaak commented Oct 13, 2023

using WebRTC to transfer data

@timzaak
Copy link
Contributor Author

timzaak commented Oct 28, 2023

现有项目兼容 WebRTC 接口可能遇到的问题有:

1. 鉴权

目前使用的是 curve25519+ ed25519 进行动态鉴权。
WebRTC Relay 不支持动态鉴权,只能使用静态密码去做, 另外,双方以 Offer / Answer 的方式进行鉴权设定。存在 Controlling/Controlled 不均等通信,需要提前指定通信双方身份,并相互传递 RTCSessionDescription.

  1. 静态密码可以通过 ID + IP+ ed25519 加密来确认。
  2. RTCSessionDescription 可以通过 Mqtt 来做。
  3. 身份确认规则,可以是 IP/ID 小的触发 Offer, IP/ID 大的进行 Answer 应答。

2. 通信链路

现有通信加密使用 curve25519 来进行加密。
WebRTC relay 可以自动协商加密协议,也可以预先设定加密证书。
两者若直接嵌套,会存在两次加密的情况,需要去除一层加密。

WebRTC DTLS 无法剔除加密机制,Wireguard 若是剔除,需要自行解析包内容,从而确定包 Target IP。

3. 配置

配置内容、下发方式双方都可兼容。

小结

想使用 WebRTC 的原因是, ICE 包含的通信层:mDNS、STUN、TURN 都已经有完整实现,可以不用解决p2p问题。现有的WireGuard TURN 可以使用 Client 替代(现在无法同时兼容多个 Network)。mDNS 和 STUN 需要自行实现,candidate 和 pair candidate 过程也需要做。

两者同时兼容,还不如重新做个基于 WebRTC 的 Client 来的清爽简便。

@timzaak timzaak closed this as completed Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant