• Stars
    star
    336
  • Rank 124,856 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ping all the ips of cloudflare.

博客:Oliverxu's blog

中文说明

cloudflare-ip-ping

Cloudflare provides a CDN service which can speed up the websites. While using the free plan, you could not choose the nodes of the CDN. However, The cloudflare partner project allows users to use cname to get their websites into the CDN, which means users can choose whichever nodes they like.

There are some situations that you only want to speed up your websites at your location. I will tell you how to use Python to choose the the ip that suits you best.

Principle

Cloudflare has a ip list of their CDN, which can be obtained at here. The method that i use is very simple:

  1. Ping the IPs and get the latency and loss.
  2. Choose the best IP.
  3. Use Cloudflare Partner Project to cname your domain to the chosen ip.

Usage

python pingip.py

You will get a log file in your current directory.

In pingip.py file. You could change:

  • the number of threads to fit the performance of your computer and your network capacity.
  • the THRESHOLD under which the ip and latency will be logged into the log file.

Windows Clients

If you are using windows 10 x64. You can directly use the package I packed, It can be found [here].(https://github.com/olixu/cloudflare-ip-ping/releases)

How to contribute this repo

You could open an issue and upload your log file, tell me whether this script works or not, please attach your location and your network supplier.

Recommend VPS

To Do