1
0
mirror of https://github.com/MontFerret/ferret.git synced 2024-12-16 11:37:36 +02:00
ferret/pkg/html/common/ua.go
Tim Voronov a3d3fe727d
Bug/#31 ua (#73)
* Made custom and random UA optional

* Added pirvate context keys
2018-10-07 22:18:57 -04:00

20 lines
291 B
Go

package common
import (
"github.com/MontFerret/ferret/pkg/runtime/env"
"github.com/corpix/uarand"
)
func GetUserAgent(val string) string {
if val == "" {
return val
}
if val != env.RandomUserAgent {
return val
}
// TODO: Change the implementation
return uarand.GetRandom()
}