> ## Documentation Index
> Fetch the complete documentation index at: https://help.decodo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 用户名:密码请求

> 通过用户名:密码身份验证使用移动代理高级参数

使用**回连**时，请确保始终使用以下端点：

* 代理服务器：`gate.decodo.com`
* 代理端口：`7000`

下面的示例中将显示 `cURL` 代码。您可以在您的机器上尝试它们。

***

## `用户名:密码`

<Note>
  ### 用户名和密码参数

  要使用代理用户名和密码，请注意您的用户名行将**始终**以 `user-` 开头，后跟您的代理用户名。
</Note>

使用代理用户名和密码返回随机位置 IP 地址的**轮换代理**示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username:password" -x "gate.decodo.com:7000" "https://ip.decodo.com/json"
  ```
</CodeGroup>

将 `username` 和 `password` 替换为您的凭据，然后在**终端**或**命令提示符**中运行该命令。

您将在输出中看到为此特定请求分配给您的 IP 地址，以及该 IP 地址的信息，包括其位置。

***

## 国家定位

如果需要来自特定国家的 IP，则修改用户名以包含 `country-xx` 参数。使用两个字母的 Alpha-2 代码。完整列表请参见[**此处**](https://www.iban.com/country-codes)。

返回美国 IP 的**轮换代理**示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-country-us:password" -x "gate.decodo.com:7000" "ip.decodo.com/json"
  ```
</CodeGroup>

来自意大利的**轮换** IP：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-country-it:password" -x "gate.decodo.com:7000" "ip.decodo.com/json"
  ```
</CodeGroup>

***

## 城市定位

在用户名中添加 `city-xxxx` 参数以指定国家内的城市。

它与 `country` 参数结合使用，不能单独使用。

如果城市名称由多个单词组成，则使用下划线。

返回纽约市 IP 的**轮换代理**示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-country-us-city-new_york:password" -x "gate.decodo.com:7000" "ip.decodo.com/json"
  ```
</CodeGroup>

返回罗马 IP 的**轮换代理**示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-country-it-city-rome:password" -x "gate.decodo.com:7000" "ip.decodo.com/json"
  ```
</CodeGroup>

***

## 州定位

在用户名中添加 `state-us_xxxxx` 将允许州定位。目前仅支持美国各州。

返回纽约州 IP 的**轮换代理**示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-country-us-state-us_new_york:password" -x "gate.decodo.com:7000" "ip.decodo.com/json"
  ```
</CodeGroup>

来自加利福尼亚州的**轮换** IP：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-country-us-state-us_california:password" -x "gate.decodo.com:7000" "ip.decodo.com/json"
  ```
</CodeGroup>

***

## 大陆定位

在用户名中添加 `continent` 参数将允许您定位来自特定大陆的 IP。

返回欧洲 IP 的**轮换代理**示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-continent-eu:password" -x "gate.decodo.com:7000" "https://ip.decodo.com/json"
  ```
</CodeGroup>

<Note>
  ### 大陆代码

  * 亚洲 – `as`
  * 非洲 – `af`
  * 欧洲 – `eu`
  * 北美洲 – `na`
  * 大洋洲 – `oc`
  * 南美洲 – `sa`
</Note>

***

## ASN 定位

添加 `asn` 参数将允许您定位来自特定运营商的 IP。

* 您必须在 `city` 定位和 `asn` 定位之间进行选择，因为它们不能同时使用。
  * 相同的逻辑也适用于 `continent`、`state` 和 `country` 参数。
* 使用 **AT\&T Mobility LLC** `asn` 号码的轮换会话代理示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-asn-20057:password" -x "gate.decodo.com:7000" "https://ip.decodo.com/json"
  ```
</CodeGroup>

<Note>
  ### 运营商号码

  您可以通过在线搜索查找运营商号码，例如[**此处**](https://asnlookup.com/)。
</Note>

***

## ZIP 定位

添加 `zip` 参数将允许您定位特定邮政编码区域内的 IP。

* ZIP 级别定位**仅**适用于**美国**国家级别，并且必须指定才能使用 `zip` 参数。
* `zip` 参数最多允许 5 个符号。
* 位于**纽约市**的 `zip` 代码的轮换代理示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-country-us-zip-10001:password" -x "gate.decodo.com:7000" "https://ip.decodo.com/json"
  ```
</CodeGroup>

***

## 粘性会话

上面的示例使用轮换会话执行，因此每个请求都会获得一个新的 IP 地址。在用户名中添加 `session` 变量将允许 IP 地址在多个请求中保持不变。

返回美国 IP 地址的**粘性**会话示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-country-us-session-randomstring123:password" -x "gate.decodo.com:7000" "ip.decodo.com/json"
  ```
</CodeGroup>

由于此代理是**粘性**的，如果您再次运行该命令，将返回相同的 IP 地址，因为该 IP 地址仍有活动会话。

**默认**会话持续时间为 **10 分钟**。之后 IP 地址将自动轮换。

必须有一种方法来区分分配给用户的每个会话，因为可以同时拥有多个活动粘性会话。

<Note>
  ### 会话值

  上面的示例中使用了值 – `randomstring123`。可以使用任何字母数字文本/字符串，具体取决于您的偏好。所有这些都是可行的：

  `session-random123`、`session-1`、`session-abcdef`、`session-2` 等。
</Note>

不同的会话参数值用于区分活动会话，其行为就像我们国家端点的不同**粘性代理**端口一样。

例如，如果您使用会话变量 `randomstring123` 运行上述命令，您会发现即使调整其他参数（如国家、城市等），相同的代理 IP 仍然保持不变。

这意味着如果您需要更改位置或更快地轮换代理 IP，则还必须更改会话参数。否则，IP 地址将不会轮换。

<Note>
  ### 使用端口维护会话

  或者，您可以使用端口而不是 `session` 参数。例如：

  * `user-username-country-us-sessionduration-60:[email protected]:10001`；
  * `user-username-country-us-sessionduration-60:[email protected]:10002`；
  * `user-username-country-us-sessionduration-60:[email protected]:10003`。

  可用端口范围为 `10001`-`49999`。
</Note>

***

## 会话持续时间

在用户名中添加 `sessionduration-x` 将允许会话持续最多 **24 小时**。

<Note>
  ### 会话长度

  接受 **1** 到 **1440** 之间的任何整数。

  例如：`sessionduration-1` `sessionduration-10` `sessionduration-600`
</Note>

<Warning>
  ### 过早轮换

  会话时间越长，由于末端的住宅设备离线，**IP 在**您指定的时间之前轮换的可能性就越大。
</Warning>

来自芝加哥的**粘性** IP 将持续最多 90 分钟的代理示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-country-us-city-chicago-session-example1-sessionduration-90:password" -x "gate.decodo.com:7000" "ip.decodo.com/json"
  ```
</CodeGroup>

来自卡萨布兰卡的**粘性** IP 将持续最多 1 分钟的代理示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "user-username-country-ma-city-casablanca-session-example2-sessionduration-1:password" -x "gate.decodo.com:7000" "ip.decodo.com/json"
  ```
</CodeGroup>

<Note>
  ### 注意

  使用**回连**时，我们无法保证 IP 可用性，特别是在定位较小的国家或城市时。
</Note>

***

<Columns cols={2}>
  <Card title="支持" href="https://direct.lc.chat/12092754" cta="让我们聊聊！">
    需要帮助或只是想打个招呼？我们的支持团队全天候为您服务。 \
    您也可以随时通过电子邮件 [support@decodo.com](mailto:support@decodo.com) 联系我们。
  </Card>

  <Card title="反馈" href="mailto:feedback@decodo.com" cta="分享反馈">
    找不到您要找的内容？请求一篇文章！ \
    有反馈意见？分享您对我们如何改进的想法。
  </Card>
</Columns>
