https://github.com/serverwentdown/sgp-internet-ping
A quick analysis of Internet latency form Singapore to the rest of the world
https://github.com/serverwentdown/sgp-internet-ping
Last synced: about 1 year ago
JSON representation
A quick analysis of Internet latency form Singapore to the rest of the world
- Host: GitHub
- URL: https://github.com/serverwentdown/sgp-internet-ping
- Owner: serverwentdown
- License: mit
- Created: 2018-03-19T16:07:47.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-26T14:40:49.000Z (over 7 years ago)
- Last Synced: 2025-02-05T09:53:49.511Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 11 MB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
sgp-internet-ping
A quick analysis of Internet latency from Singapore to the rest of the world.
## Scanning the Internet
To scan the IPv4 Internet, I used the tool [`masscan`](https://github.com/robertdavidgraham/masscan) by security researcher Robert Graham. He has extensively made use of `masscan` in the security research he does. It provides latency measurements up to the millisecond.
> WARNING: Only scan the Internet if your service provider approves of it. It can cause networking issues.
I wrote a configuration file to run `masscan` on the entire Internet with the included exclusion list, and scan the top 5 open ports according to [speedguide.net](https://www.speedguide.net/ports_common.php). It is stored as `scan.conf`. I started the scan with:
```
masscan -c scan.conf
```
This produces the output file `scan.bin`. You might want to make use of shards to scan only a portion of the internet per file as scanning the entire internet will produce a huge file that cannot be parsed unless you have enough RAM available.
## Counting latency
I need to reduce the data for the five ports per host into a single latency reading for each host.
But first, I had to convert the scan binary into JSON:
```
masscan --readscan scan.bin -oJ scan.json
go run latency.go -in scan.json -out latency.json
```
## Categorising readings by country
To associate an IP address with a country, a geolocation lookup database must be used. I used two sources of geolocation databases; Maxmind's GeoLite2, and Webnet77's IPToCountry; to test the accuracy of either database.
Next, I wrote and used a Go script to group the scans by country:
```
go run country.go -in latency.json -db iptocountry -out country.json
```
## Plotting the latency from Singapore by country
I will start with a simple plot of latency to every country from Singapore.
```
go run boxplot.go -in country.json -out boxplot.csv
```
##