weather/useragent.go
2026-01-28 12:24:50 -05:00

24 lines
462 B
Go

package main
import (
"fmt"
"os"
"strings"
)
const (
appName = "weather"
appVersion = "0.1"
appRepo = "https://git.keegandeppe.com/kdeppe/weather"
appContact = "contact=19keegandeppe@gmail.com"
)
func buildUserAgent() (string, error) {
host, err := os.Hostname()
if err != nil {
return "", err
}
host = strings.ReplaceAll(host, " ", "-")
return fmt.Sprintf("%s/%s (%s; %s; host=%s)", appName, appVersion, appRepo, appContact, host), nil
}