# 代理工作原理

代理是一台中转服务器，负责把你的 HTTP(S) 请求转发到目标站点。目标站点看到的是代理的 IP，而不是你的真实 IP。helodata 运营覆盖全球的住宅、移动与 ISP IP 池。

## 请求生命周期

```
┌─────────┐         ┌──────────────────┐         ┌──────────────┐
│  你的   │  HTTP   │  helodata 代理    │  HTTP   │   目标       │
│  应用   ├────────►│  网关             ├────────►│   网站       │
│         │◄────────┤                   │◄────────┤              │
└─────────┘         └──────────────────┘         └──────────────┘
```

1. 应用向 `gate.helodata.io:7777` 发起带凭证的请求。
2. 对于**网关型产品**（住宅、移动），网关会解析你的[用户名字符串](/helodata-zh/kuai-su-ru-men/username-format.md)、验证子账号，并按 `type`、`region`、`state`、`city`、`asn`、`session` 等参数选择一个后端 IP。对于 **ISP 代理**，客户端直接连接到你购买清单中的某个具体 IP，不经过网关路由。
3. 目标站点返回响应，响应体经网关流回到你。

helodata 当前所有上线产品均按\*\*流量（GB）\*\*计费。

## IP 池速览

| IP 池       | `type` 代码                    | 来源           | 适用场景         | 取舍           |
| ---------- | ---------------------------- | ------------ | ------------ | ------------ |
| **住宅代理**   | 网关，`type-res`                | 真实消费者 ISP    | 强反爬站点、地域受限内容 | 速度不稳定        |
| **移动代理**   | 网关，`type-mob`                | 3G/4G/5G 运营商 | 移动端独有内容、社交平台 | 单价最高，池子较小    |
| **ISP 代理** | 按 IP 清单（`ip:port:user:pass`） | 静态住宅         | 账号养号、长会话     | 需自行轮换，池子大小固定 |

即将上线：数据中心代理、Web Unblocker、Scraping API。

拿不准请看[如何选择产品](/helodata-zh/kuai-su-ru-men/choose-a-product.md)。

## 认证方式

helodata 在所有产品上都支持两种认证方式：

* **用户名 + 密码** — 通过 `Proxy-Authorization` 头或 `http://user:pass@host:port` URL 形式传入。最灵活，任意来源 IP 都可使用。所有定位参数都编码在用户名里（参见[用户名格式](/helodata-zh/kuai-su-ru-men/username-format.md)）。
* **IP 白名单** — 在控制台登记你的出口 IP，按源 IP 进行认证。适合无法存放凭证的运行环境。此模式下定位参数在控制台选择，不再写入用户名。

完整说明见[身份认证](/helodata-zh/api-can-kao/authentication.md)。

## 会话与轮换

两种凭证模式处理会话亲和性的方式截然不同。

**网关型产品（住宅、移动）** — 通过用户名中的 `session` + `sesstime` 字段按需开启会话：

```
helo_s1a2b3c4d5e-type-res-region-us-session-abc123-sesstime-30
```

* `session-abc123` — 自定义字符串，用作会话标识。
* `sesstime-30` — 保持该 IP 最长 30 分钟（住宅上限 30，移动上限 60）。

去掉这两段即每个连接获取一个新 IP（轮换模式）。

**ISP 代理** — 你购买清单中的每个 IP 都是永久稳定的，**轮换由客户端控制**：你的代码从清单中挑选下一个条目。详见 [客户端轮换](/helodata-zh/chan-pin/overview-2/rotation.md)。


---

# Agent Instructions: 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:

```
GET https://docs.helodata.com/helodata-zh/kuai-su-ru-men/how-proxies-work.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
