191 lines
3.3 KiB
Markdown
191 lines
3.3 KiB
Markdown
# 🌐 myip – IP & RIPE Lookup WebApp
|
||
|
||
myip è una webapp minimale e containerizzata che mostra:
|
||
|
||
- il **tuo IP pubblico**
|
||
- informazioni RIPE utili (ASN, Provider/Holder, Prefisso annunciato)
|
||
- UI moderna e responsiva
|
||
- pulsante **Copia IP**
|
||
- integrazione con ingress-nginx e PROXY protocol
|
||
- design personalizzabile tramite CSS dedicato
|
||
|
||
Pensata per essere deployata come micro-servizio in Kubernetes.
|
||
|
||
---
|
||
|
||
## ✨ Screenshot
|
||
|
||
> 
|
||
|
||
---
|
||
|
||
## 🚀 Funzionalità
|
||
|
||
### 🔍 Identificazione del client
|
||
- Recupero del **vero IP del client** anche dietro più proxy/load balancer.
|
||
- Compatibile con:
|
||
- `X-Forwarded-For`
|
||
- `X-Real-IP`
|
||
- PROXY protocol v2
|
||
|
||
### 🛰️ Lookup RIPEstat
|
||
Per l’indirizzo IP viene mostrato:
|
||
- ASN
|
||
- Provider (holder)
|
||
- Prefisso annunciato
|
||
|
||
### 🎨 UI moderna
|
||
- Font Montserrat
|
||
- Layout centrato
|
||
- Logo cliccabile
|
||
- Animazioni CSS
|
||
- Copy-to-clipboard
|
||
- Modalità dark automatica
|
||
|
||
### 🔧 Semplice da deployare
|
||
- Dockerfile incluso
|
||
- Configurazione Helm-ready
|
||
- Compatibile con ingress-nginx e cert-manager
|
||
|
||
---
|
||
|
||
## 📂 Struttura del progetto
|
||
|
||
```
|
||
myip-webapp/
|
||
├─ app.py
|
||
├─ requirements.txt
|
||
├─ Dockerfile
|
||
├─ static/
|
||
│ ├─ myip.css
|
||
│ ├─ logo.png
|
||
│ └─ favicon.ico
|
||
└─ README.md
|
||
```
|
||
|
||
---
|
||
|
||
## 🐳 Deploy con Docker
|
||
|
||
### Build
|
||
|
||
```bash
|
||
docker build -t myip:latest .
|
||
```
|
||
|
||
### Run
|
||
|
||
```bash
|
||
docker run -p 8080:8000 myip
|
||
```
|
||
|
||
Apri:
|
||
|
||
```
|
||
http://localhost:8080
|
||
```
|
||
|
||
---
|
||
|
||
## ☸️ Deploy in Kubernetes (Helm)
|
||
|
||
### values.yaml minimale
|
||
|
||
```yaml
|
||
ingress:
|
||
enabled: true
|
||
className: nginx
|
||
host: myip.example.com
|
||
|
||
annotations:
|
||
cert-manager.io/cluster-issuer: letsencrypt-production
|
||
nginx.ingress.kubernetes.io/use-forwarded-headers: "true"
|
||
nginx.ingress.kubernetes.io/real-ip-header: "X-Forwarded-For"
|
||
nginx.ingress.kubernetes.io/compute-full-forwarded-for: "true"
|
||
|
||
tls:
|
||
enabled: true
|
||
```
|
||
|
||
### ingress-nginx PROXY protocol (fondamentale)
|
||
|
||
Nella ConfigMap del controller:
|
||
|
||
```yaml
|
||
data:
|
||
use-proxy-protocol: "true"
|
||
real-ip-header: "proxy_protocol"
|
||
set-real-ip-from: "xxx.xxx.xxx.0/24"
|
||
use-forwarded-headers: "true"
|
||
```
|
||
|
||
### HAProxy (L4) davanti ad ingress-nginx
|
||
|
||
```haproxy
|
||
server backend1 xxx.xxx.xxx.xxx:443 send-proxy-v2 check
|
||
server backend2 xxx.xxx.xxx.xxx:443 send-proxy-v2 check
|
||
server backend3 xxx.xxx.xxx.xxx:443 send-proxy-v2 check
|
||
```
|
||
|
||
---
|
||
|
||
## 🧠 Note Tecniche
|
||
|
||
### Determinazione dell’IP reale
|
||
|
||
L’app utilizza:
|
||
|
||
```python
|
||
X-Forwarded-For → X-Real-IP → remote_addr
|
||
```
|
||
|
||
ed è compatibile con proxy multipli e ingress-nginx.
|
||
|
||
### Lookup RIPE
|
||
|
||
Usa la API ufficiale RIPEstat:
|
||
|
||
- `/network-info/`
|
||
- `/as-overview/`
|
||
|
||
Timeout veloce (2s) per non bloccare la UI.
|
||
|
||
---
|
||
|
||
## 🎨 Personalizzazioni
|
||
|
||
Tutto il design è modificabile in:
|
||
|
||
```
|
||
static/myip.css
|
||
```
|
||
|
||
Puoi sostituire:
|
||
- `logo.png` → per branding
|
||
- `favicon.ico` → icona personalizzata
|
||
|
||
---
|
||
|
||
## 🏁 Roadmap
|
||
|
||
- [ ] Endpoint `/api/ip`
|
||
- [ ] Multi-theme (light/dark manuale)
|
||
- [ ] Mini-widget JavaScript includibile in altri siti
|
||
- [ ] Supporto IPv6-only
|
||
- [ ] Caching locale del lookup RIPE
|
||
|
||
---
|
||
|
||
## 🤝 Credits
|
||
|
||
- Frontend & Styling by ChatGPT + AB style guidelines
|
||
- Backend Python + Flask
|
||
- Lookup dati: **RIPEstat Data API**
|
||
- Supporto PROXY prot. v2: HAProxy + ingress-nginx
|
||
|
||
---
|
||
|
||
## 📄 Licenza
|
||
|
||
MIT (o altra licenza a tua scelta)
|