Optionally show ISP info for private LAN clients using the server's public IP

Aperta
#877 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, php

Direzione di ricerca

Read backend/getIP_ipInfo_apikey.php and backend/getIP_serverPublicIp.php, then trace how getIP.php handles private client addresses and calls the existing ipinfo API and offline database fallback. Check the option and its Docker environment variable, plus the documentation in doc.md and doc_docker.md. Done means private LAN clients can optionally see the server public IP's ISP while keeping their own IP displayed, with the existing behavior preserved when disabled or lookup fails.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Closes #862

Before: when a client on the same LAN as the server opens the speed test (e.g. 192.168.1.23), getIP.php sees a private IP and skips ISP detection, so it only shows "Private IPv4 access".

After: if $USE_SERVER_PUBLIC_IP_FOR_PRIVATE_CLIENTS = true; is set in backend/getIP_ipInfo_apikey.php (or USE_SERVER_PUBLIC_IP_FOR_PRIVATE_CLIENTS=true in Docker), private clients get the ISP info of the server's public IP, shown with their own IP. It's off by default, so nothing changes unless you turn it on.

How: the server gets its public IP from ipinfo.io/ip (using the API token if one is set) and caches it for an hour in backend/getIP_serverPublicIp.php, which is gitignored. The lookup then goes through the existing ipinfo API, with the offline db as a fallback. I pulled the API-then-offline-db chain into a small getIspInfo() helper so both paths use it. If the public IP can't be fetched, the response is the same as before. I also documented the option in doc.md and doc_docker.md.

I tested it locally with PHP 8.3 and the offline db. It's unchanged when off, public clients are unchanged too, private clients get ISP info when on, and it falls back cleanly when the lookup fails. I used Claude to help write this.

Lingua principale
JavaScript
Stelle
15.3k
Fork
2.5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di librespeed/speedtest

Tutte le issue di librespeed/speedtest

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.