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

Abierto
#877 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
docker, php

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
JavaScript
Estrellas
15.3k
Forks
2.5k
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de librespeed/speedtest

Todos los issues de librespeed/speedtest

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.