|
2 | 2 |
|
3 | 3 | - There is a `healthcheck.py` script available under /usr/local/bin. It will use `PROTONVPN_IPCHECK_ENDPOINT` (`https://ip.prasadt.workers.dev/` by default) to verify the IP address matches with one of the logical servers. By default service will keep checking every `PROTONVPN_CHECK_INTERVAL` _(default = 90)_ seconds using the same api endpoint.
|
4 | 4 |
|
5 |
| -- `https://ip.prasadt.workers.dev/` Service runs as a cloudflare worker and is fast, as it sits at their edge network. It is very simple, It returns your public IP and nothing else. You can use any of the following services by setting the variable (or host your own) as they too return your public IP address. |
| 5 | +- `https://ip.prasadt.workers.dev/` Service runs as a cloudflare worker and is fast, as it sits at their edge network. It is very simple, It returns your public IP and nothing else. |
| 6 | + |
| 7 | +- You can use any of the following services by setting the variable (or host your own) as they too return your public IP address. These can also be used if default endpoint is rate limited or unavailable. |
6 | 8 | * https://ip.prasadt.workers.dev/
|
7 |
| - * https://checkip.amazonaws.com/ |
8 | 9 | * https://icanhazip.com/
|
| 10 | + * https://checkip.amazonaws.com/ |
9 | 11 | * https://api.ipify.org/
|
10 | 12 |
|
11 | 13 | - Version 4.x and below use `https://ipinfo.io` as healthcheck endpoint and check for connected country. This endpoint be changed. If you are hitting rate limits, you should upgrade to v5.0.0+ or reduce check interval via `PROTONVPN_CHECK_INTERVAL` to 180 seconds or more.
|
| 14 | + |
| 15 | +## Hosting your own ip worker |
| 16 | + |
| 17 | +- Signup for [Cloudflare workers](https://dash.cloudflare.com/sign-up/workers) |
| 18 | +- Create a new worker |
| 19 | +- Code for worker is extremely dumb and simple its less than 10 lines of code. You can simply copy paste the following snipet, or look under worker folder. |
| 20 | + ```js |
| 21 | + addEventListener("fetch", (event) => { |
| 22 | + event.respondWith( |
| 23 | + handleRequest(event.request).catch( |
| 24 | + (err) => new Response(err.stack, { status: 500 }) |
| 25 | + ) |
| 26 | + ); |
| 27 | + }); |
| 28 | + |
| 29 | + async function handleRequest(request) { |
| 30 | + return new Response(request.headers.get("CF-Connecting-IP")) |
| 31 | + } |
| 32 | + ``` |
| 33 | +-. Hit save and deploy. Please note that the preview is not available in the cloudflare console, |
| 34 | +as the script uses CF-* headers which are not availablein preview. |
0 commit comments