1 backend files
Federico Dossena edited this page 2019-06-30 07:49:33 +02:00

garbage.php

Uses OpenSSL to generate a stream of incompressible garbage data for the download test.

If accepts a ckSize GET parameter, which specifies how much garbage data to generate in megabytes (4-1024).

empty.php

An empty file used for the upload and ping test. It only sends headers to create the connection.

getIP.php

Returns client IP, ISP and distance from the server.

GET parameters:

  • isp: if set, fetches ISP info from ipinfo.io
  • distance: if set, calculates distance from server. You can specify km or mi for the format.

If isp is set, the output is a JSON string containing:

  • processedString: string that can be displayed to the user
  • rawIspInfo: info about the client as a JSON string, straight from ipinfo.io

If isp is not set, the output is just a string containing the client's IP address.

Note: if your server is behind some proxy, firewall, VPN, etc., the client's IP address may not be detected properly. If this happens, you must analyze the traffic coming from the client to find the name of the HTTP header that contains the original IP address. getIP.php contains some of these headers but not all of them.

CORS headers

All these files will send the following CORS headers if the GET parameter cors=true is passed to them:

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Headers: Content-Encoding, Content-Type