地理定位
地理定位通过在用户名中添加标志按请求进行配置。无需更改控制面板,无需单独的端点,每个请求都通过同一个网关。
标志以短划线附加到用户名中:
customer-USERNAME-country-<code>-region-<name>-city-<name>-asn-<number>值均为小写。地区和城市名称中的空格用下划线表示。国家代码为 ISO 3166-1 alpha-2 格式。
| 标志 | 值 | 示例 |
|---|---|---|
country | ISO 国家代码 | country-us, country-gb, country-de |
region | 小写地区/州标识 | region-california, region-new_south_wales |
city | 小写城市标识 | city-new_york, city-los_angeles |
asn | ASN 编号 | asn-7922 (Comcast), asn-701 (Verizon) |
strict | true | strict-true(参见回退行为) |
可按任意顺序组合标志:
customer-USERNAME-country-us-region-california-city-los_angelescustomer-USERNAME-country-gb-asn-2856customer-USERNAME-city-berlincurl -x customer-USERNAME-country-de-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443 \ https://ipinfo.io/jsoncurl -x customer-USERNAME-country-us-region-california-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443 \ https://ipinfo.io/jsoncurl -x customer-USERNAME-country-us-city-new_york-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443 \ https://ipinfo.io/jsoncurl -x customer-USERNAME-country-us-asn-7922-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443 \ https://ipinfo.io/json默认情况下,如果在请求时没有 IP 与你的完整过滤条件匹配(例如,某个冷门城市的 IP 池暂时为空),网关会回退到更广泛的池,以便请求仍能完成。
添加 strict-true 可选择退出回退机制,此时将收到 HTTP 502 而非回退结果。当精确的地理匹配比请求成功更重要时,请使用严格匹配:
curl -x customer-USERNAME-country-us-city-new_york-strict-true-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443 \ https://ipinfo.io/json省略所有标志即可从完整的全球池中获取:
USERNAME每个请求仍会轮换到不同的 IP,只是没有地理限制。