chore(GODT-2551): Store and Recover Last User Agent from Vault

This commit is contained in:
Leander Beernaert
2023-04-14 09:48:39 +02:00
parent 2191dc70dc
commit d6760d6f50
10 changed files with 103 additions and 12 deletions

View File

@ -44,6 +44,20 @@ func (ua *UserAgent) SetClient(name, version string) {
ua.client = fmt.Sprintf("%v/%v", name, regexp.MustCompile(`(.*) \((.*)\)`).ReplaceAllString(version, "$1-$2"))
}
func (ua *UserAgent) SetClientString(client string) {
ua.lock.Lock()
defer ua.lock.Unlock()
ua.client = client
}
func (ua *UserAgent) GetClientString() string {
ua.lock.RLock()
defer ua.lock.RUnlock()
return ua.client
}
func (ua *UserAgent) HasClient() bool {
ua.lock.RLock()
defer ua.lock.RUnlock()