Files
go_clientinfo/server/funcs_tpl.go
brent saner 9f97fcaf81 v0.2.0
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).
2025-12-13 04:19:05 -05:00

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
}