omrva / webshare_php_proxy
用于与Webshare代理一起工作的PHP仓库。
v1.0.2
2024-06-04 06:35 UTC
Requires
- php: ^8.2
- ext-curl: *
- illuminate/collections: ^9.0|^10.0|^11.0
- illuminate/support: ^9.0|^10.0|^11.0
This package is auto-updated.
Last update: 2024-09-04 07:11:30 UTC
README
描述
用于与Webshare代理服务器一起工作的仓库。
服务将代理服务器列表存储在缓存中,以减少响应时间。
默认缓存时间为1天。
设置
WebshareProxyRepository 类有少数属性需要设置以正确运行。
这些属性被声明为 static,因此设置这些属性的简单方法是扩展 WebshareProxyRepository 并设置静态值。
属性
$authToken- Webshare API的认证令牌$proxyListUrl- 获取代理服务器列表的URL(如果不同于常规情况)$proxyListCacheKey- 存储带有数据的代理服务器列表的缓存键$proxyListCacheLifetimeInSeconds- 代理列表缓存数据的生命周期(以秒为单位)
方法
createProxyList - 从Webshare API创建、存储并返回新获取的代理列表
getProxyList - 从缓存中返回代理列表(如果可用),或者调用 createProxyList 方法并返回其结果
getRandomProxyServer - 从列表中返回随机服务器(从 getProxyList 方法获得)