Skip to content

NimbleEngineer21/can-i-ping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Global Internet Connectivity Monitor

A real-time dashboard for monitoring internet connectivity in countries known for internet restrictions and control. The system aggregates data from multiple authoritative sources to provide visibility into network outages, government-imposed shutdowns, and censorship patterns.

Features

  • Interactive World Map: Visual overview of connectivity status across monitored countries using Leaflet.js
  • Real-time Data Aggregation: Combines data from IODA, Cloudflare Radar, and OONI
  • Historical Tracking: Stores and visualizes connectivity history with Chart.js
  • Outage Detection: Tracks both government-imposed shutdowns and technical outages
  • Multi-source Scoring: Weighted connectivity scores from BGP routing, active probing, traffic analysis, and censorship measurements

Data Sources

  • BGP routing visibility from RouteViews and RIPE RIS
  • Active probing from CAIDA Ark nodes
  • Internet Background Radiation (darknet traffic)
  • Traffic anomaly detection
  • Outage tracking from Cloudflare's global network
  • Real-time traffic patterns
  • Censorship measurements
  • Website blocking detection
  • Messaging app accessibility

Monitored Countries

The system monitors countries known for internet control:

Country Code Notes
Iran IR Frequent shutdowns, heavy censorship
Russia RU Increasing restrictions, VPN blocks
China CN Great Firewall, heavy censorship
North Korea KP Extremely limited access
Syria SY Conflict-related outages
Turkmenistan TM Heavy censorship
Belarus BY Shutdown during protests
Myanmar MM Military-imposed restrictions
Saudi Arabia SA Selective blocking
Cuba CU Limited infrastructure
Venezuela VE Political restrictions
Ethiopia ET Regional shutdowns
Pakistan PK Periodic blocking

Installation

Prerequisites

  • Python 3.8+
  • pip

Setup

  1. Clone the repository:
git clone https://github.com/yourusername/can-i-ping.git
cd can-i-ping
  1. Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. (Optional) Seed sample data for testing:
python seed_data.py
  1. Run the application:
python run.py

The dashboard will be available at http://localhost:5000

Configuration

Environment Variables

Variable Description Default
SECRET_KEY Flask secret key dev-secret-key
CLOUDFLARE_RADAR_TOKEN Cloudflare API token (optional) None

Configuration File

Edit app/config.py to:

  • Add/remove monitored countries
  • Adjust collection intervals
  • Modify status thresholds

API Endpoints

Endpoint Method Description
/ GET Main dashboard
/api/countries GET List monitored countries
/api/connectivity/current GET Current connectivity for all countries
/api/connectivity/<code> GET Detailed data for a specific country
/api/connectivity/<code>/history GET Historical data (query: ?days=7)
/api/outages GET Recent outages (query: ?days=7&country=IR)
/api/outages/refresh GET Trigger outage data refresh
/api/sources/health GET Check data source health
/api/stats/global GET Global statistics

Architecture

can-i-ping/
├── app/
│   ├── __init__.py
│   ├── app.py              # Flask application
│   ├── config.py           # Configuration
│   ├── models.py           # SQLAlchemy models
│   ├── scheduler.py        # Background data collection
│   ├── data_sources/
│   │   ├── __init__.py
│   │   ├── aggregator.py   # Data aggregation logic
│   │   ├── ioda.py         # IODA API client
│   │   ├── cloudflare.py   # Cloudflare Radar client
│   │   └── ooni.py         # OONI API client
│   ├── static/
│   │   ├── css/style.css
│   │   └── js/app.js
│   └── templates/
│       └── index.html
├── run.py                  # Application entry point
├── seed_data.py            # Sample data generator
├── requirements.txt
└── README.md

Scoring Methodology

The overall connectivity score is calculated as a weighted average:

Component Weight Source
BGP Routing Visibility 25% IODA
Active Probing 15% IODA
Traffic Levels 30% Cloudflare Radar
Openness (inverse censorship) 30% OONI

Status Thresholds

Status Score Range Description
Normal 80-100% No significant issues
Degraded 50-80% Some connectivity issues
Disrupted 20-50% Significant problems
Down 0-20% Severe outage

Development

Running in Debug Mode

python run.py --debug

Disabling Scheduler (for development)

python run.py --no-scheduler

Database

The application uses SQLite by default. The database file (connectivity.db) is created automatically in the project root.

To reset the database:

rm connectivity.db
python run.py  # Will recreate tables
python seed_data.py  # Optional: add sample data

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Acknowledgments

About

Availability checker for countries that are known to control Internet access

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors