Skip to content

Abohend/GeoGaurd.API

Repository files navigation

Here’s a simple, clean README you can use for now:

🌍 Blocked Countries API

A simple .NET Core Web API that manages blocked countries and validates IP addresses using a third-party geolocation service.


🚀 Features

  • Block / unblock countries
  • Get all blocked countries (with pagination & search)
  • Lookup country information by IP address
  • Check if the current user IP is blocked
  • Log blocked access attempts
  • Temporarily block countries (with automatic expiration)

🛠️ Tech Stack

  • .NET 8 Web API
  • In-memory storage (ConcurrentDictionary / Lists)
  • HttpClient for external API calls
  • Swagger for API documentation

🔑 Setup

  1. Clone the repository
git clone <your-repo-url>
cd <project-folder>
  1. Configure API settings (optional)
// appsettings.json
"GeoApi": {
  "BaseUrl": "https://ipapi.co/",
  "ApiKey": ""
}

Note: API key is optional for ipapi.co (limited usage without it)

  1. Run the project
dotnet run
  1. Open Swagger

https://localhost:{port}/swagger


📌 Main Endpoints

Method Endpoint Description
POST /api/countries/block Block a country
DELETE /api/countries/block/{code} Unblock a country
GET /api/countries/blocked Get blocked countries
GET /api/ip/lookup Get country by IP
GET /api/ip/check-block Check if current IP is blocked
GET /api/logs/blocked-attempts Get logs
POST /api/countries/temporal-block Temporarily block a country

🧠 Notes

  • Data is stored in-memory (no database)
  • Designed for demonstration and assignment purposes
  • Thread-safe collections are used

📄 License

This project is for assessment purposes.

About

A simple .NET Core Web API that manages blocked countries and validates IP addresses using a third-party geolocation service.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages