ADDED:
* The ability to show both IPv4 and IPv6 addresses (if the client has
  dual-stack and either the server does as well or a separate ClientInfo
  is running on the "other" net family).
This commit is contained in:
brent saner
2025-12-13 04:19:05 -05:00
parent eb5c44e1c3
commit 9f97fcaf81
12 changed files with 244 additions and 93 deletions

View File

@@ -4,9 +4,35 @@
{{- $linkico := "🔗" }}
<h2 id="client">Client/Browser Information<a href="#client">{{ $linkico }}</a></h2>
<p>
<b>Your IP Address is <i><a href="https://ipinfo.io/{{ $page.Info.IP.String }}">{{ $page.Info.IP.String }}</a></i>.</b>
<b>Your IP{{ getIpver $page.Info.IP }} Address is <i><a href="https://ipinfo.io/{{ $page.Info.IP.String }}">{{ $page.Info.IP.String }}</a></i>.</b>
<br/>
<i>You are connecting with port <b>{{ $page.Info.Port }}</b> outbound.</i>
{{- if $page.HasAltURL }}
<div id="alt_addr"></div>
<script>
async function fetchAltAddr() {
try {
const resp = await fetch('{{ safeUrl $page.AltURL }}', {
headers: {
'Accept': 'application/json'
}
});
if (resp.ok) {
const dat = await resp.json();
const addr = dat.ip;
const infoDiv = document.getElementById('alt_addr');
infoDiv.innerHTML = `
<i>You also have IP{{ $page.AltVer }} address <b><a href="https://ipinfo.io/${addr}">${addr}</a></b>.</i>
<br/>
<i>Try loading <b><a href="{{ $page.AltURL }}">{{ $page.AltURL }}</a></b> for more information.</i>`;
}
} catch (error) {
console.info('Did not fetch alternate address: ', error);
}
}
fetchAltAddr()
</script>
{{- end }}
</p>
{{- if $page.Raw }}
<h3 id="client_raw">Raw Block ({{ $page.RawFmt }})<a href="#client_raw">{{ $linkico }}</a></h3>
@@ -42,7 +68,7 @@
</tbody>
</table>
</div>
{{- /*
{{- /*
<ul>
{{- $flds := $ua.ToMap }}