ISP detection does not work for LAN clients behind NAT
还没有人认领这个 Issue。
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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?
- 主要语言
- JavaScript
- 星标
- 15.3k
- 派生
- 2.5k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
librespeed/speedtest 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
librespeed/speedtest#880 ·
-
Add support for Open Container Initiative (OCI) image format within the Docker artifact integration未关闭
难度 4/5 3-5 天 新手友好度 28/100
librespeed/speedtest#879 ·
-
难度 3/5 1-2 天 新手友好度 72/100
librespeed/speedtest#877 ·
-
难度 4/5 3-5 天 新手友好度 35/100
librespeed/speedtest#876 ·
-
难度 2/5 1-3 小时 新手友好度 42/100
librespeed/speedtest#875 ·
查看 librespeed/speedtest 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
louislam/uptime-kuma#8257 · 1 条评论 ·
维护者通常 1 天内回复
-
bug good first issue
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
good first issue help wanted translation
难度 2/5 1-3 小时 新手友好度 78/100