Add -T option to mimic Tor Browser's User-Agent

This commit is contained in:
Alexey Yerin 2021-01-18 23:30:26 +03:00
parent e471749a85
commit 9f3f2fbb4a
1 changed files with 6 additions and 0 deletions

View File

@ -39,8 +39,14 @@ func main() {
staticDir := pflag.String("static-dir", "./static", "Static files directory")
proxy := pflag.String("proxy", "", "Proxy URL, with no scheme http is assumed")
userAgent := pflag.String("user-agent", "", "User-Agent header to use")
tor := pflag.BoolP("tor", "T", false, "Use Tor Browser's User-Agent string")
pflag.Parse()
if *tor {
// https://tor.stackexchange.com/questions/4890/tor-browser-user-agent-strings/4892#4892
*userAgent = "Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0"
}
var proxyUrl *url.URL
if *proxy != "" {
u, err := url.Parse(*proxy)