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).
39 lines
504 B
Go
39 lines
504 B
Go
package server
|
|
|
|
import (
|
|
`fmt`
|
|
`net/netip`
|
|
`strings`
|
|
`html/template`
|
|
)
|
|
|
|
func getIpver(a netip.Addr) (verStr string) {
|
|
|
|
if a.Is4() {
|
|
verStr = "v4"
|
|
} else if a.Is6() {
|
|
verStr = "v6"
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
func getTitle(subPage string) (title string) {
|
|
|
|
if subPage == "" || subPage == "index" {
|
|
title = baseTitle
|
|
return
|
|
}
|
|
|
|
title = fmt.Sprintf("%s%s%s", baseTitle, titleSep, strings.ToTitle(subPage))
|
|
|
|
return
|
|
}
|
|
|
|
func safeUrl(urlStr string) (u template.URL) {
|
|
|
|
u = template.URL(urlStr)
|
|
|
|
return
|
|
}
|