ISP detection does not work for LAN clients behind NAT
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
Línea de trabajo
Start with backend/getIP.php, especially getLocalOrPrivateIpInfo($ip) and the existing IPinfo request used by /backend/getIP.php?isp=true. Trace how configuration is defined and how the response is formatted before deciding where the opt-in setting belongs. Done means private client IPs remain unchanged while enabled deployments can use the server's public IP for ISP/location data, without changing the default behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hi Team, I'm running LibreSpeed on a server inside my home network. When I access the speedtest from another device on the same LAN, LibreSpeed correctly detects the client's private IP address, but ISP detection is skipped.
For example, the client is:
192.168.1.23
and the LibreSpeed server is:
192.168.1.10
Calling:
/backend/getIP.php?isp=true
returns:
{
"processedString": "192.168.1.23 - private IPv4 access",
"rawIspInfo": ""
}
Why this happens
backend/getIP.php checks for private addresses before trying IPinfo:
$localIpInfo = getLocalOrPrivateIpInfo($ip);
if (is_string($localIpInfo)) {
echo formatResponse_simple($ip,$localIpInfo);
}
So an address such as 192.168.1.23 is never sent to IPinfo.
That makes sense by itself, since a private IP cannot be geolocated. However, for a typical home network the LibreSpeed server and the client are behind the same NAT gateway and therefore share the same public IP.
The server can already determine its public IP using the existing IPinfo integration:
https://ipinfo.io/json?token=...
So it seems possible to use the server's public IP for ISP/location lookup when the client IP is private.
Possible solution
Would it make sense to add an optional setting for this use case?
For example:
USE_SERVER_PUBLIC_IP_FOR_PRIVATE_CLIENTS=true
When enabled:
- Detect the client IP as usual.
- If it is a private/local address, don't send that address to IPinfo.
- Instead query IPinfo without an IP address so that IPinfo sees the server's public address.
- Use the returned ISP/country/location information for the result.
- Keep the actual client IP unchanged.
For example, instead of:
192.168.1.23 - private IPv4 access
the result could show something like:
192.168.1.23 - Example ISP, DE
Why should this be optional?
The server and client do not necessarily have to use the same public IP. This could be wrong when LibreSpeed is behind a VPN, proxy, multiple network interfaces, etc.
Therefore I think this should be opt-in rather than changing the current behavior for every private IP.
Environment
- LibreSpeed Docker image:
ghcr.io/librespeed/speedtest:latest - Client and server are on the same private LAN
- Server has Internet access through a NAT router
- IPinfo API key is configured and working
/backend/getIP.php?isp=trueworks correctly for public IPs
Expected behavior
It would be useful if LibreSpeed could optionally provide ISP/location information for LAN clients behind NAT, while still correctly identifying the actual client IP as private.
Is this something that would be considered?
- 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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de librespeed/speedtest
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
librespeed/speedtest#880 ·
-
Add support for Open Container Initiative (OCI) image format within the Docker artifact integrationAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 28/100
librespeed/speedtest#879 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
librespeed/speedtest#877 ·
-
PHP vulnerabilitiesAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
librespeed/speedtest#876 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 42/100
librespeed/speedtest#875 ·
Todos los issues de librespeed/speedtest
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
volcengine/OpenViking#8432 ·
Los mantenedores suelen responder en 1 día
-
[bug] Explorer trims leading spaces on file namesPosiblemente ocupada @unshade la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
mickael-kerjean/filestash#1033 · 1 comentario ·
-
area/frontend good first issue topic/delivery
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
aws-samples/sample-collaborative-ai-dlc#866 ·
Los mantenedores suelen responder en 1 día
-
bug pdd
Dificultad 2/5 Menos de una hora Aptitud para principiantes 76/100
objectionary/eoc#1555 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ClouGence/open-cdm#487 · 2 comentarios ·
Los mantenedores suelen responder en 1 día