Code Monkey home page Code Monkey logo

warp-clash-api's Introduction

WARP Clash API

GitHub License Codacy Badge GitHub Repo stars

中文 | English

Warning

本项目是完全非商业项目,仅供学习交流使用,请勿用于非法用途,否则后果自负。

🤔 这是什么?

该项目可以让你通过订阅的方式使用WARP+,支持ClashShadowrocket等客户端。项目内置了 刷取WARP+流量的功能,可以让你的WARP+流量不再受限制(每18秒可获得1GB流量),同时, 配备了IP选优功能。支持Docker compose 一键部署,无需额外操作,即可享受你自己的WARP+私 有高速节点!

💡 特色功能

  • 💻 支持ClashSurgeShadowrocket等客户端
  • 🔑 支持设置您自己的LicenseKey
  • 🌏 支持IP选优
  • 🐋 支持Docker compose一键部署
  • 📕 全自动刷取WARP+流量,请求经过代理,防封IP
  • ❓ 每次更新订阅随机节点,让你体验抽卡的乐趣

🚀 快速上手

1. 安装DockerDocker compose

2. 下载项目

git clone https://github.com/vvbbnn00/WARP-Clash-API.git

3. [可选] 配置SECRET_KEY

若您需要在公网上部署该项目,建议您配置SECRET_KEYPUBLIC_URL。在项目目录下创建 .env.local文件,写入如下内容:

SECRET_KEY=your_secret_key

关于环境变量的更多信息,请参考环境变量

4. 编译并运行

docker-compose up -d

5. 获取订阅链接

访问http://你的IP:21001,输入SECRET_KEY(若没有配置,则可以留空),即可获取订阅链接。

🎉 大功告成

🌏 手动IP选优

项目本身包含了一个选优过的IP列表,但是由于WARPIP 是动态的,所以可能会出现IP不可用的 情况。若您需要手动选优,可以遵循以下步骤:

若您通过docker-compose部署,可以在项目目录下通过以下命令手动执行IP选优:

docker-compose exec warp-clash python3 app.py optimize

否则,可以在项目目录下执行以下命令:

python3 app.py optimize

🔧 环境变量

没错,您可以通过环境变量来配置该项目,在配置时,只需新建一个.env.local文件,写入您需要的环境 变量即可。

以下是可用的环境变量:

变量名 默认值 说明
DELAY_THRESHOLD 500 延迟阈值,超过该阈值的IP将被剔除
DO_GET_WARP_DATA True 是否刷取WARP+流量,若不需要刷取流量,则设置为False即可
GET_WARP_DATA_INTERVAL 18 刷取WARP+流量的时间间隔,单位为秒,每隔该时间间隔会刷取一次WARP+流量,不建议间隔设置过短。
LOSS_THRESHOLD 10 丢包率阈值,超过该阈值的IP将被剔除
PROXY_POOL_URL https://getproxy.bzpl.tech/get/ IP代理池地址,用于刷取WARP+流量,您可以自行搭建,参照proxy_pool
PUBLIC_URL 部署在公网上时,填写公网IP或域名,用于生成订阅链接,比如 https://subs.zeabur.app
RANDOM_COUNT 10 每次更新订阅随机节点的数量
REOPTIMIZE_INTERVAL -1 重新选优的时间间隔,单位为秒,若小于等于0,则不会重新选优,否则每隔该时间间隔会重新选优一次,不建议间隔设置过短。
REQUEST_RATE_LIMIT 0 限制X秒一次请求,该功能不太稳定,建议不要开启
SECRET_KEY 用于保护订阅链接,若不配置,则不需要输入SECRET_KEY即可获取订阅链接
SHARE_SUBSCRIPTION False 若您的站点想要向社区分享订阅,但不想让自己的账户信息被公开或修改,可以设置为True,此时,访问订阅链接时,不需要输入SECRET_KEY即可获取,而对于其他的操作,仍然需要输入SECRET_KEY

📝 配置示例

例如,您设置SECRET_KEY123456,并打算将订阅分享给社区,那么您的.env.local 文件应该 如下:

SECRET_KEY=123456
SHARE_SUBSCRIPTION=True

🧰 进阶操作

请注意,如果您设置了SECRET_KEY,需要在URL的末尾添加key参数,例如:

http://your_IP:21001/some/api/actions?key=your_secret_key

重置账户的PublicKeyPrivateKey

项目支持您通过请求以下接口来重置PublicKeyPrivateKey

curl -X POST http://host:port/api/account/reset_key

重置过后,需要重新获取订阅内容,否则可能无法使用。

设置自己的LicenseKey

若您已经拥有了WARP+LicenseKey,可以通过以下接口来设置:

curl -X POST http://host:port/api/account/update_license -H "Content-Type: application/json" -d "{\"license_key\": \"your_license_key\"}"

请注意,当您设置了LicenseKey后,其PublicKeyPrivateKey将会被重置,需要重新获取订阅 内容。

使用 IPv6 优选

从原理上来看,本服务通过读取config/result_v6.csv文件获取IPv6地址,因此您可以在支持 IPv6的服务器上运行IP选优功能来获得IPv6地址。获取到的接入地址列表只需写入 config/result_v6.csv文件中,相比在Docker容器中运行IP选优功能,此方法更为简便。

如果您需要在Docker容器中运行IP选优功能,可以使用docker-compose_ipv6.yaml 文件来让Docker镜像支持IPv6。在运行前,请确保您的服务器支持IPv6,并在Docker服务的 /etc/docker/daemon.json中添加以下内容,并重启Docker服务:

{
  "experimental": true,
  "ip6tables": true,
  "ipv6": true,
  "fixed-cidr-v6": "2001:db8:1::/64"
}

若您在先前已经运行过Docker服务,在运行之前,请先停止之前的服务:

docker-compose down

然后,您可以通过以下命令来运行Docker服务:

docker-compose -f docker-compose_ipv6.yaml up -d

🗂️ 引用项目

本项目的开发参照了以下项目,感谢这些开源项目的作者:

warp-clash-api's People

Contributors

correctroadh avatar dependabot[bot] avatar fgprodigal avatar focusprogram avatar hu3rror avatar hynor avatar vvbbnn00 avatar xx10n31y avatar yaoyinying avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

warp-clash-api's Issues

优选ip功能不工作

您好,compose部署,尝试执行docker compose exec warp-clash python3 app.py optimize
ip优选操作时,发现无法正常工作。
app_background.log日志如下:
2024-02-25 08:52:18,503 - INFO - Get current account
2024-02-25 08:52:48,027 - WARNING - Failed to get account from Cloudflare.
2024-02-25 08:52:48,027 - WARNING - HTTPSConnectionPool(host='getproxy.bzpl.tech', port=443): Max retries exceeded with url: /get/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f4ffd00c210>, 'Connection to getproxy.bzpl.tech timed out. (connect timeout=None)'))
2024-02-25 08:53:00,502 - INFO - Get current account
2024-02-25 08:53:00,503 - INFO - WORK ON ID: d77e2fed-7b74-4113-b5de-fe979470150d
2024-02-25 08:55:11,377 - WARNING - Failed to get account from Cloudflare.
2024-02-25 08:55:11,377 - WARNING - HTTPSConnectionPool(host='getproxy.bzpl.tech', port=443): Max retries exceeded with url: /get/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f4ffd014990>, 'Connection to getproxy.bzpl.tech timed out. (connect timeout=None)'))
2024-02-25 08:55:24,502 - INFO - Get current account
2024-02-25 08:55:24,503 - INFO - WORK ON ID: d77e2fed-7b74-4113-b5de-fe979470150d
2024-02-25 08:56:18,503 - INFO - Get current account

使用内置账户和自己注册warp+账户均无法正常运行

docker日志如下:
root@iStoreOS:/opt/DockerCompose/WARPClashAPI # docker logs -f warpclashapi-warp-clash-1
/usr/local/lib/python3.11/site-packages/tzlocal/unix.py:193: UserWarning: Can not find any timezone configuration, defaulting to UTC.
warnings.warn("Can not find any timezone configuration, defaulting to UTC.")
2024-02-25 08:50:18,501 - INFO - Start scheduler.
2024-02-25 08:50:18,501 - INFO - DO_GET_WARP_DATA is True, will fetch WARP data per 18 seconds.
2024-02-25 08:50:18,502 - INFO - Start save account job, will update account info per 120 seconds.
[2024-02-25 08:50:18 +0000] [8] [INFO] Starting gunicorn 21.2.0
[2024-02-25 08:50:18 +0000] [8] [INFO] Listening at: http://0.0.0.0:3000 (8)
[2024-02-25 08:50:18 +0000] [8] [INFO] Using worker: sync
[2024-02-25 08:50:18 +0000] [10] [INFO] Booting worker with pid: 10
[2024-02-25 08:50:18 +0000] [11] [INFO] Booting worker with pid: 11
[2024-02-25 08:50:18 +0000] [12] [INFO] Booting worker with pid: 12
[2024-02-25 08:50:18 +0000] [13] [INFO] Booting worker with pid: 13
2024-02-25 08:50:36,503 - INFO - Get current account
2024-02-25 08:50:36,503 - INFO - WORK ON ID: d77e2fed-7b74-4113-b5de-fe979470150d
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:50:54 UTC)" skipped: maximum number of running instances reached (1)
2024-02-25 08:50:55,165 - INFO - Get current account
2024-02-25 08:50:55,166 - INFO - Reload entrypoints from ./config/result.csv
2024-02-25 08:50:57,779 - INFO - Get current account
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:51:12 UTC)" skipped: maximum number of running instances reached (1)
[2024-02-25 08:51:27 +0000] [8] [CRITICAL] WORKER TIMEOUT (pid:11)
[2024-02-25 08:51:27 +0000] [11] [INFO] Worker exiting (pid: 11)
[2024-02-25 08:51:27 +0000] [8] [ERROR] Worker (pid:11) exited with code 1
[2024-02-25 08:51:27 +0000] [8] [ERROR] Worker (pid:11) exited with code 1.
[2024-02-25 08:51:27 +0000] [145] [INFO] Booting worker with pid: 145
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:51:30 UTC)" skipped: maximum number of running instances reached (1)
2024-02-25 08:51:47,129 - INFO - Get current account
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:51:48 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:52:06 UTC)" skipped: maximum number of running instances reached (1)
[2024-02-25 08:52:18 +0000] [8] [CRITICAL] WORKER TIMEOUT (pid:10)
[2024-02-25 08:52:18 +0000] [10] [INFO] Worker exiting (pid: 10)
[2024-02-25 08:52:18 +0000] [8] [ERROR] Worker (pid:10) exited with code 1
[2024-02-25 08:52:18 +0000] [8] [ERROR] Worker (pid:10) exited with code 1.
[2024-02-25 08:52:18 +0000] [146] [INFO] Booting worker with pid: 146
2024-02-25 08:52:18,503 - INFO - Get current account
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:52:24 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:52:42 UTC)" skipped: maximum number of running instances reached (1)
2024-02-25 08:52:48,027 - WARNING - Failed to get account from Cloudflare.
2024-02-25 08:52:48,027 - WARNING - HTTPSConnectionPool(host='getproxy.bzpl.tech', port=443): Max retries exceeded with url: /get/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f4ffd00c210>, 'Connection to getproxy.bzpl.tech timed out. (connect timeout=None)'))
2024-02-25 08:53:00,502 - INFO - Get current account
2024-02-25 08:53:00,503 - INFO - WORK ON ID: d77e2fed-7b74-4113-b5de-fe979470150d
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:53:18 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:53:36 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:53:54 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:54:12 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "saveAccount (trigger: interval[0:02:00], next run at: 2024-02-25 08:54:18 UTC)" skipped: maximum number of running instances reached (1)
Job "saveAccount (trigger: interval[0:02:00], next run at: 2024-02-25 08:56:18 UTC)" raised an exception
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 198, in _new_conn
sock = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
raise err
File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Operation timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 793, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1099, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 616, in connect
self.sock = sock = self._new_conn()
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 207, in _new_conn
raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7f4ffd00e410>, 'Connection to api.cloudflareclient.com timed out. (connect timeout=None)')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 847, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.cloudflareclient.com', port=443): Max retries exceeded with url: /v0i2308311933/reg/d77e2fed-7b74-4113-b5de-fe979470150d (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f4ffd00e410>, 'Connection to api.cloudflareclient.com timed out. (connect timeout=None)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/apscheduler/executors/base.py", line 125, in run_job
retval = job.func(*job.args, **job.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/services/tasks.py", line 56, in saveAccount
info = getAccount(account)
^^^^^^^^^^^^^^^^^^^
File "/app/services/cloudflare.py", line 109, in getAccount
response = SESSION.get(f"{API_URL}/{API_VERSION}/reg/{account.account_id}",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 507, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='api.cloudflareclient.com', port=443): Max retries exceeded with url: /v0i2308311933/reg/d77e2fed-7b74-4113-b5de-fe979470150d (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f4ffd00e410>, 'Connection to api.cloudflareclient.com timed out. (connect timeout=None)'))
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:54:30 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:54:48 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:55:06 UTC)" skipped: maximum number of running instances reached (1)
2024-02-25 08:55:11,377 - WARNING - Failed to get account from Cloudflare.
2024-02-25 08:55:11,377 - WARNING - HTTPSConnectionPool(host='getproxy.bzpl.tech', port=443): Max retries exceeded with url: /get/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f4ffd014990>, 'Connection to getproxy.bzpl.tech timed out. (connect timeout=None)'))
2024-02-25 08:55:24,502 - INFO - Get current account
2024-02-25 08:55:24,503 - INFO - WORK ON ID: d77e2fed-7b74-4113-b5de-fe979470150d
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:55:42 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:56:00 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:56:18 UTC)" skipped: maximum number of running instances reached (1)
2024-02-25 08:56:18,503 - INFO - Get current account
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:56:36 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:56:54 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:57:12 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:57:30 UTC)" skipped: maximum number of running instances reached (1)
2024-02-25 08:57:34,737 - WARNING - Failed to get account from Cloudflare.
2024-02-25 08:57:34,737 - WARNING - HTTPSConnectionPool(host='getproxy.bzpl.tech', port=443): Max retries exceeded with url: /get/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f4ffcb85dd0>, 'Connection to getproxy.bzpl.tech timed out. (connect timeout=None)'))
2024-02-25 08:57:48,502 - INFO - Get current account
2024-02-25 08:57:48,503 - INFO - WORK ON ID: d77e2fed-7b74-4113-b5de-fe979470150d
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:58:06 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "saveAccount (trigger: interval[0:02:00], next run at: 2024-02-25 08:58:18 UTC)" skipped: maximum number of running instances reached (1)
Execution of job "doAddDataTaskOnce (trigger: interval[0:00:18], next run at: 2024-02-25 08:58:24 UTC)" skipped: maximum number of running instances reached (1)
Job "saveAccount (trigger: interval[0:02:00], next run at: 2024-02-25 09:00:18 UTC)" raised an exception
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 198, in _new_conn
sock = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
raise err
File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Operation timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 793, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1099, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 616, in connect
self.sock = sock = self._new_conn()
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 207, in _new_conn
raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7f4ffcb87750>, 'Connection to api.cloudflareclient.com timed out. (connect timeout=None)')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 847, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.cloudflareclient.com', port=443): Max retries exceeded with url: /v0i2308311933/reg/d77e2fed-7b74-4113-b5de-fe979470150d (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f4ffcb87750>, 'Connection to api.cloudflareclient.com timed out. (connect timeout=None)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/apscheduler/executors/base.py", line 125, in run_job
retval = job.func(*job.args, **job.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/services/tasks.py", line 56, in saveAccount
info = getAccount(account)
^^^^^^^^^^^^^^^^^^^
File "/app/services/cloudflare.py", line 109, in getAccount
response = SESSION.get(f"{API_URL}/{API_VERSION}/reg/{account.account_id}",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 507, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='api.cloudflareclient.com', port=443): Max retries exceeded with url: /v0i2308311933/reg/d77e2fed-7b74-4113-b5de-fe979470150d (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f4ffcb87750>, 'Connection to api.cloudflareclient.com timed out. (connect timeout=None)'))

docker compose up fails to build

sudo docker compose up -d
[+] Building 26.8s (8/12)
 => [warp-clash internal] load build definition from Dockerfile                                0.2s
 => => transferring dockerfile: 689B                                                           0.0s
 => [warp-clash internal] load .dockerignore                                                   0.1s
 => => transferring context: 125B                                                              0.0s
 => [warp-clash internal] load metadata for docker.io/library/python:3.11-alpine               1.4s
 => [warp-clash 1/8] FROM docker.io/library/python:3.11-alpine@sha256:2c0e25da660a20c1e99ccd0  9.7s
 => => resolve docker.io/library/python:3.11-alpine@sha256:2c0e25da660a20c1e99ccd091a3fdda4c6  0.0s
 => => sha256:2c0e25da660a20c1e99ccd091a3fdda4c6e3525d91fe5306d89cc24b54fc6b9 1.65kB / 1.65kB  0.0s
 => => sha256:d1975f2182c9962f5daa1ad935eb092e3e32dce11d8105cb3584a31afc7b451 1.37kB / 1.37kB  0.0s
 => => sha256:82d7337f8f9414d725a28b8c1c2a4ccf33eca41ccf76d6e86eb19a790396868 6.26kB / 6.26kB  0.0s
 => => sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf 3.41MB / 3.41MB  1.1s
 => => sha256:dca80dc46cecdd1a97787a1dd6f74263b9d2f7b0dd3e2e15c109f5e3484 622.15kB / 622.15kB  0.8s
 => => sha256:1eedcd8cec5653cf18f418910cf3a85a6fa05204897bcd3d59b2ffe4f22fc 12.66MB / 12.66MB  2.1s
 => => sha256:6d299437f6b433cfb6303b1f5ed739cb25eab4e32ae16e096aacefe4dcd86464 239B / 239B     1.2s
 => => sha256:655c65f49da74e6db86d39a9bd3acb6dc6d26afa77f4781bbcf1843305d0321 3.13MB / 3.13MB  1.8s
 => => extracting sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8      1.1s
 => => extracting sha256:dca80dc46cecdd1a97787a1dd6f74263b9d2f7b0dd3e2e15c109f5e34848c932      1.0s
 => => extracting sha256:1eedcd8cec5653cf18f418910cf3a85a6fa05204897bcd3d59b2ffe4f22fc5e7      3.1s
 => => extracting sha256:6d299437f6b433cfb6303b1f5ed739cb25eab4e32ae16e096aacefe4dcd86464      0.0s
 => => extracting sha256:655c65f49da74e6db86d39a9bd3acb6dc6d26afa77f4781bbcf1843305d03211      1.5s
 => [warp-clash internal] load build context                                                   2.1s
 => => transferring context: 11.02MB                                                           1.6s
 => [warp-clash 2/8] WORKDIR /app                                                              0.5s
 => [warp-clash 3/8] RUN if [ "$GITHUB_ACTIONS" != "true" ]; then         sed -i 's/dl-cdn.al  2.3s
 => ERROR [warp-clash 4/8] RUN apk add --no-cache bash build-base libffi-dev openssl-dev      12.1s
------
 > [warp-clash 4/8] RUN apk add --no-cache bash build-base libffi-dev openssl-dev:
#0 1.999 fetch https://mirrors.aliyun.com/alpine/v3.19/main/x86_64/APKINDEX.tar.gz
#0 7.011 fetch https://mirrors.aliyun.com/alpine/v3.19/community/x86_64/APKINDEX.tar.gz
#0 7.014 WARNING: fetching https://mirrors.aliyun.com/alpine/v3.19/main: temporary error (try again later)
#0 12.02 WARNING: fetching https://mirrors.aliyun.com/alpine/v3.19/community: temporary error (try again later)
#0 12.02 ERROR: unable to select packages:
#0 12.02   bash (no such package):
#0 12.02     required by: world[bash]
#0 12.02   build-base (no such package):
#0 12.02     required by: world[build-base]
#0 12.02   libffi-dev (no such package):
#0 12.02     required by: world[libffi-dev]
#0 12.02   openssl-dev (no such package):
#0 12.02     required by: world[openssl-dev]
------
failed to solve: process "/bin/sh -c apk add --no-cache bash build-base libffi-dev openssl-dev" did not complete successfully: exit code: 4

设置自己的LicenseKey时, 返回400错误

出现的问题
当我尝试设置自己的LicenseKey时, 返回了

<!doctype html>
<html lang=en>
<title>400 Bad Request</title>
<h1>Bad Request</h1>
<p>The browser (or proxy) sent a request that this server could not understand.</p>
curl: (3) URL rejected: Malformed input to a URL function

我操作的步骤

  1. 拉取最新的代码
  2. .env.local内容如下
PUBLIC_URL=*******
REOPTIMIZE_INTERVAL=3600
SHARE_SUBSCRIPTION=True
DO_GET_WARP_DATA=False
SECRET_KEY=*******
  1. 使用docker-compose down && docker-compose up -d --build重新运行
  2. 使用curl -X POST https://我的域名/api/account/update_license?key=******* -H "Content-Type: application/json" -d "{\"license_key\": \"Ed1964AJ-7exRw182-4308EKgH\"}"
  3. 得到了400的返回

按照说明用docker安装了之后,无法成功运行,帮忙看看是什么原因。

log的内容为:

FileNotFoundError: [Errno 2] No such file or directory: './config/cf-config.json'
/usr/local/lib/python3.11/site-packages/tzlocal/unix.py:193: UserWarning: Can not find any timezone configuration, defaulting to UTC.
warnings.warn("Can not find any timezone configuration, defaulting to UTC.")
2024-02-22 08:08:22,353 - INFO - Start scheduler
Traceback (most recent call last):
File "/app/app.py", line 82, in
main()
File "/app/app.py", line 54, in main
from services.web_service import createApp
File "/app/services/web_service.py", line 6, in
from services.subscription import generateClashSubFile, generateWireguardSubFile, generateSurgeSubFile
File "/app/services/subscription.py", line 18, in
CF_CONFIG = json.load(open("./config/cf-config.json", "r", encoding="utf8"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './config/cf-config.json'

无法访问gpt

gpt无法访问,使用的社区实例
clash-verge-rev,规则模式

Unable to load site

Please try again later. If you are using a VPN, try turning it off. Check the [status page](https://status.openai.com/) for information on outages.

[feature discuss]更好的节点名

现在的随机节点名为emoji CF-{color}。意义较低,我在想能不能改成机场中更常见的格式,通过geoip拿到ip所在的位置,用国旗 地址-CF-{随机}的方式给节点一个更有意思的名字。🤔

可以ok的话,我可以提一个 PR

请教一下手动优选IP问题

请问一下, 如果在海外的服务器上使用docker-compose exec warp-clash python3 app.py optimize进行手动IP优选, 得到的优选结果是针对这台海外服务器IP的优选结果吗? 还是针对**大陆的优选结果?

社区实例不可用

刚看到项目尚未自行部署,想尝试一下社区实例看看效果。用安卓端Clash Meta导入配置后,可测延迟正常,但是无法打开墙后网页和应用。想确认一下可能是什么问题?

修改前端页面样式不生效

出现的问题
修改template/index.html中的前端样式后, 重启docker, 前端页面依旧保持原样, 并没有我做的改动

复现步骤

  1. 先git clone仓库, 配置.env.local, 其余什么都不改, 使用docker-compose up -d直接运行
  2. 修改template/index.html
  3. 使用docker-compose down && docker-compose up -d重启项目
  4. 发现页面依旧是最开始clone下来的样子, 并没有第2步做的修改

额外的补充
还试验过完全删除文件夹, 重新clone等方法, 总之21001端口上的页面只会停留在第一次docker启动的时候, 后面的怎么改index.html都不会变

DO_GET_WARP_DATA=False 似乎无效

有个奇怪的地方没搞懂,我明明给了 DO_GET_WARP_DATA=False 但是容器启动后还是会刷流量。我现在的做法是直接把run.sh里的 python3 app.py background& 注释掉了。不清楚是不是bug

Originally posted by @hahach in #38 (comment)

部署报错failed to solve: failed to read expected number of bytes: unexpected EOF

[+] Building 63.1s (5/12)                                                                                                                                                                                                              docker:default
 => [warp-clash internal] load build definition from Dockerfile                                                                                                                                                                                  0.1s
 => => transferring dockerfile: 689B                                                                                                                                                                                                             0.0s
 => [warp-clash internal] load metadata for docker.io/library/python:3.11-alpine                                                                                                                                                                 7.5s
 => [warp-clash internal] load .dockerignore                                                                                                                                                                                                     0.1s
 => => transferring context: 125B                                                                                                                                                                                                                0.0s
 => ERROR [warp-clash 1/8] FROM docker.io/library/python:3.11-alpine@sha256:2c0e25da660a20c1e99ccd091a3fdda4c6e3525d91fe5306d89cc24b54fc6b95                                                                                                    54.8s
 => => resolve docker.io/library/python:3.11-alpine@sha256:2c0e25da660a20c1e99ccd091a3fdda4c6e3525d91fe5306d89cc24b54fc6b95                                                                                                                      0.2s
 => => sha256:82d7337f8f9414d725a28b8c1c2a4ccf33eca41ccf76d6e86eb19a790396868e 6.26kB / 6.26kB                                                                                                                                                   0.0s
 => => sha256:2c0e25da660a20c1e99ccd091a3fdda4c6e3525d91fe5306d89cc24b54fc6b95 1.65kB / 1.65kB                                                                                                                                                   0.0s
 => => sha256:d1975f2182c9962f5daa1ad935eb092e3e32dce11d8105cb3584a31afc7b451b 1.37kB / 1.37kB                                                                                                                                                   0.0s
 => => sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8 0B / 3.41MB                                                                                                                                                      55.0s
 => => sha256:dca80dc46cecdd1a97787a1dd6f74263b9d2f7b0dd3e2e15c109f5e34848c932 622.15kB / 622.15kB                                                                                                                                               1.4s
 => => sha256:1eedcd8cec5653cf18f418910cf3a85a6fa05204897bcd3d59b2ffe4f22fc5e7 12.66MB / 12.66MB                                                                                                                                                15.8s
 => => sha256:6d299437f6b433cfb6303b1f5ed739cb25eab4e32ae16e096aacefe4dcd86464 239B / 239B                                                                                                                                                       2.3s
 => => sha256:655c65f49da74e6db86d39a9bd3acb6dc6d26afa77f4781bbcf1843305d03211 3.13MB / 3.13MB                                                                                                                                                   3.8s
 => [warp-clash internal] load build context                                                                                                                                                                                                     0.4s
 => => transferring context: 3.72kB                                                                                                                                                                                                              0.0s
------
 > [warp-clash 1/8] FROM docker.io/library/python:3.11-alpine@sha256:2c0e25da660a20c1e99ccd091a3fdda4c6e3525d91fe5306d89cc24b54fc6b95:
------
failed to solve: failed to read expected number of bytes: unexpected EOF

ip优选

每次clash更新时,都会自动优选ip吗?

在编译完成后,运行开始时跳出exited

warp-clash-api-warp-clash-1 exited with code 127
warp-clash-api-warp-clash-1 | 2023-10-22T06:56:40.940651810Z ./scripts/run.sh: line 2:: not found
: not found14:56:40 warp-clash-api-warp-clash-1 | ./scripts/run.sh: line 4:
: not found14:56:40 warp-clash-api-warp-clash-1 | ./scripts/run.sh: line 5:
2023-10-22 14:56:40 warp-clash-api-warp-clash-1 | usage: app.py [-h] {web,background,optimize}
2023-10-22 14:56:40 warp-clash-api-warp-clash-1 | app.py: error: argument command: invalid choice: 'web\r' (choose from 'web', 'background', 'optimize')
: not found14:56:40 warp-clash-api-warp-clash-1 | ./scripts/run.sh: line 7:

请问是否支持shellcrash

我导入配置文件后无法正常使用。具体表现为能正常导入,也能在dashboard上看到节点,可以访问GitHub、telegram。但是无法访问Google、YouTube。shellcrash地址

Surge订阅地址有bug

当使用secure_key时,订阅地址第一次可以拉去节点,更新的时候会报403,是因为订阅内容第一行少了key=secure_key值

Internal Server Error!

问题:本地docker-compose运行的时候打开链接报错

描述:这个页面是正常的

image

这个链接打开就500

image

Failed to get account from Cloudflare

日志

2024-01-29 04:33:25,786 - INFO - Get current account

2024-01-29 04:33:19,638 - INFO - Get current account

2024-01-29 04:33:15,972 - WARNING - 429 Client Error: Too Many Requests for url: https://api.cloudflareclient.com/v0a1922/reg

2024-01-29 04:33:15,971 - WARNING - Failed to get account from Cloudflare.

2024-01-29 04:33:15,237 - INFO - WORK ON ID: 42767b16-0439-49cc-8246-b7ee1da49983

2024-01-29 04:33:15,237 - INFO - Get current account

2024-01-29 04:33:07,764 - INFO - Get current account

2024-01-29 04:33:05,114 - INFO - Get current account

2024-01-29 04:32:59,240 - INFO - Get current account

2024-01-29 04:32:57,922 - WARNING - 429 Client Error: Too Many Requests for url: https://api.cloudflareclient.com/v0a1922/reg

2024-01-29 04:32:57,922 - WARNING - Failed to get account from Cloudflare.

2024-01-29 04:32:57,237 - INFO - WORK ON ID: 42767b16-0439-49cc-8246-b7ee1da49983

2024-01-29 04:32:57,237 - INFO - Get current account

2024-01-29 04:32:39,615 - WARNING - 429 Client Error: Too Many Requests for url: https://api.cloudflareclient.com/v0a1922/reg

2024-01-29 04:32:39,615 - WARNING - Failed to get account from Cloudflare.

2024-01-29 04:32:39,237 - INFO - WORK ON ID: 42767b16-0439-49cc-8246-b7ee1da49983

🤔这个warp是我部署公网想分享给别人使用的。但是会有这样的问题。

我在想能不能通过计划上的手段绕过一下,比如通过Warp Plus中的分享的key去拿一批不同的 cf key。
CleanShot 2024-01-29 at 12 34 45@2x

我计划提一些PR来实现它,但是我对这里 warp+ 不是很熟,希望大佬能给点指点。🥺

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.