> For the complete documentation index, see [llms.txt](https://docs.ipcheck.ing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ipcheck.ing/knowledge-base/zh/connection-tools/webrtc-test.md).

# WebRTC 测试

## 它的作用

WebRTC 是浏览器用于语音通话、视频通话和屏幕共享的技术。要让两个人直接连接，它必须弄清楚双方分别可以通过什么地址联系到——而它常常会在你正常的代理设置之外、通过 UDP 来完成这件事。这意味着浏览器可能会泄露一个本应由你的 VPN 隐藏的地址。完整内容请参见 [什么是 WebRTC？](/knowledge-base/zh/concepts/what-is-webrtc.md).

这个 **WebRTC 泄漏测试** 会准确显示在该协商过程中浏览器暴露了哪个地址。

它会向四个公共 STUN 服务器——Google、BlackBerry、Twilio 和 Cloudflare——提出与 WebRTC 在真实通话中相同的问题：“你看到我来自哪个地址？”每个回答都会变成一张卡片。

## 如何运行

测试会在页面加载时自动运行。点击该部分标题中的刷新按钮（**刷新 WebRTC 泄漏测试**）即可再次运行。每个服务器大约有五秒钟的时间作答。

## 读取结果

每张卡片都会显示 STUN 服务器报告的地址，以及基于该地址查询到的三项信息：

* **NAT** — 你的连接看起来所使用的网络地址转换类型。
* **ISP** — 拥有该报告地址的组织。
* **地区** — 该地址映射到的国家。

打开 **SDP 日志** 可在卡片底部查看带时间戳的原始连接事件。这是调试视图；除非你在排查问题，否则可以忽略。

### 结果状态

| 你看到的内容       | 其含义                           |
| ------------ | ----------------------------- |
| 一个 IP 地址     | WebRTC 协商已完成并暴露了该地址           |
| `等待测试`       | 仍在运行                          |
| `连接错误`       | 该 STUN 服务器未能及时响应，或者浏览器阻止了部分交换 |
| `WebRTC 不可用` | 你的浏览器已完全关闭 WebRTC             |

`WebRTC 不可用` 故意以绿色显示。对于泄漏测试来说，完全没有 WebRTC 的浏览器是最安全的结果。

### 现在将它与你的公网 IP 进行比较

这正是测试的核心。先看 WebRTC 卡片中的地址，再看你的 [IP 信息](/knowledge-base/zh/connection-tools/ip-information.md) 卡片中的地址。

| 比较                            | 结论                                    |
| ----------------------------- | ------------------------------------- |
| 与你的公网 IP 相同，而且你没有使用 VPN       | 正常。没有任何内容被隐藏，也没有任何泄漏                  |
| 与你的 VPN 出口 IP 相同              | 很好。你的 VPN 也覆盖了 WebRTC                 |
| 与你的 VPN 出口 IP 不同，而且看起来像你的真实地址 | **这是一次泄漏。** 使用 WebRTC 的网站可以看到你试图隐藏的地址 |
| 一个类似这样的私有地址 `192.168.x.x`     | 你的本地网络地址。单独看无害，但它确实会向网站透露一些关于你家庭网络的信息 |

{% hint style="warning" %}
如果你使用 VPN 保护隐私，这里的泄漏最值得关注。你访问的网站不需要你的配合就能执行这一操作——任何页面都可以在后台进行同样的协商。参见 [我泄漏了真实 IP 吗？](/knowledge-base/zh/diagnose/am-i-leaking-my-real-ip.md)
{% endhint %}

### 关于 NAT 类型

这个 **NAT** 字段是根据浏览器生成的连接候选类型进行的猜测。正如应用所说明的，NAT 类型检测并非 100% 准确，仅供参考。可能的值包括 完全锥形、端口受限锥形、端口受限锥形或对称型、对称型 和 未知类型。

对称型 NAT 通常表明你位于运营商级 NAT（CGNAT）之后，这也会影响传入连接和一些游戏。参见 [我在 CGNAT 后面吗？](/knowledge-base/zh/diagnose/am-i-behind-cgnat.md)

## 发现泄漏后该怎么办

{% stepper %}
{% step %}

### 检查你的 VPN 自身设置

许多 VPN 客户端都有一个默认关闭的“WebRTC 泄漏保护”或“阻止 WebRTC”选项。将其开启后再运行一次测试。
{% endstep %}

{% step %}

### 使用浏览器内置控制

Firefox：打开 `about:config` 并将 `media.peerconnection.enabled` 设置为 `false`。这会完全禁用 WebRTC，同时也会使基于浏览器的通话失效。

Chrome、Edge 和 Brave 没有内置开关。Brave 在其隐私设置中提供 WebRTC IP 处理策略；Chrome 和 Edge 需要扩展程序。
{% endstep %}

{% step %}

### 安装一个阻止 WebRTC 的扩展程序

限制 WebRTC IP 处理的扩展程序会让卡片显示 `WebRTC 不可用` 或你的代理地址，而不是你的真实地址。
{% endstep %}

{% step %}

### 重新运行并确认

刷新测试。卡片现在应与你的 VPN 出口地址一致，或者显示 `WebRTC 不可用`.
{% endstep %}
{% endstepper %}

## 下一步做什么

* 阅读 [我泄漏了真实 IP 吗？](/knowledge-base/zh/diagnose/am-i-leaking-my-real-ip.md) 以查看完整的泄漏检查清单，包括 DNS。
* 运行 [DNS 泄漏测试](/knowledge-base/zh/connection-tools/dns-leak-test.md) — WebRTC 只是两种常见泄漏之一。
* 使用以下工具确认你的其余设置： [我的 VPN 或代理正常工作吗？](/knowledge-base/zh/diagnose/is-my-vpn-working.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ipcheck.ing/knowledge-base/zh/connection-tools/webrtc-test.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
