github.com/lmb/consul@v1.4.1/lib/useragent.go (about) 1 package lib 2 3 import ( 4 "fmt" 5 "runtime" 6 7 "github.com/hashicorp/consul/version" 8 ) 9 10 var ( 11 // projectURL is the project URL. 12 projectURL = "https://www.consul.io/" 13 14 // rt is the runtime - variable for tests. 15 rt = runtime.Version() 16 17 // versionFunc is the func that returns the current version. This is a 18 // function to take into account the different build processes and distinguish 19 // between enterprise and oss builds. 20 versionFunc = func() string { 21 return version.GetHumanVersion() 22 } 23 ) 24 25 // UserAgent returns the consistent user-agent string for Consul. 26 func UserAgent() string { 27 return fmt.Sprintf("Consul/%s (+%s; %s)", 28 versionFunc(), projectURL, rt) 29 }