influxdb/http/ua.go

18 lines
252 B
Go

package http
import (
"net/http"
useragent "github.com/mileusna/useragent"
)
func userAgent(r *http.Request) string {
header := r.Header.Get("User-Agent")
if header == "" {
return "unknown"
}
ua := useragent.Parse(header)
return ua.Name
}