- Go stdlib-only gateway: serves noVNC client, password auth, WS<->TCP relay - auth: PBKDF2-HMAC-SHA256 password hash, HMAC session cookies, login rate limit - relay: hand-written RFC 6455 WebSocket + transparent RFB bridge - vncspawner: cross-OS VNC server detection/launch (Windows/Linux/macOS) - server: /login /logout /vnc /api/status routes, session middleware, embed.FS - scripts: get-novnc, get-vnc (zip-verified), list-ips, open-firewall - run.bat: one-click launcher (asks only password), lists access IPs - README/AGENTS.md (Russian), .gitignore (root-anchored binaries)
33 lines
1.4 KiB
PowerShell
33 lines
1.4 KiB
PowerShell
# list-ips.ps1 — prints reachable IPv4 addresses of this machine (one per line).
|
|
# Used by run.bat to show http://<ip>:8080 access URLs.
|
|
$ErrorActionPreference = "SilentlyContinue"
|
|
$ips = New-Object System.Collections.Generic.List[string]
|
|
|
|
# Primary: pure .NET network interfaces (locale independent).
|
|
try {
|
|
[System.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces() |
|
|
Where-Object {
|
|
$_.OperationalStatus -eq [System.Net.NetworkInformation.OperationalStatus]::Up -and
|
|
$_.NetworkInterfaceType -ne [System.Net.NetworkInformation.NetworkInterfaceType]::Loopback
|
|
} |
|
|
ForEach-Object { $_.GetIPProperties().UnicastAddresses } |
|
|
Where-Object {
|
|
$_.Address.AddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork -and
|
|
$_.Address.IPAddressToString -notlike "127.*" -and
|
|
$_.Address.IPAddressToString -notlike "169.254.*"
|
|
} |
|
|
ForEach-Object { $ips.Add($_.Address.IPAddressToString) }
|
|
} catch {}
|
|
|
|
# Fallback: parse ipconfig (handles localized output via the "IPv4" token).
|
|
if ($ips.Count -eq 0) {
|
|
ipconfig | Select-String -Pattern "IPv4" | ForEach-Object {
|
|
if ($_ -match "(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})") {
|
|
$ip = $matches[1]
|
|
if ($ip -notlike "127.*" -and $ip -notlike "169.254.*") { $ips.Add($ip) }
|
|
}
|
|
}
|
|
}
|
|
|
|
# Deduplicate and print.
|
|
$ips | Sort-Object -Unique | ForEach-Object { Write-Output $_ } |