Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
Metrics
tor-check
Commits
644e1c21
Commit
644e1c21
authored
Jul 08, 2015
by
Amogh Pradeep
Committed by
Arlo Breault
Jul 08, 2015
Browse files
Orfox UA updates, tests also changed
parent
904d3360
Changes
2
Hide whitespace changes
Inline
Side-by-side
utils.go
View file @
644e1c21
...
...
@@ -55,10 +55,11 @@ func GetHost(r *http.Request) (host string, err error) {
return
}
var
TBBUserAgents
=
regexp
.
MustCompile
(
`^Mozilla/5\.0 \(((Windows NT 6\.1)|(Android; Mobile)); rv:[\d]+\.0\) Gecko/20100101 Firefox/[\d]+\.0$`
)
var
TBBUserAgents
=
regexp
.
MustCompile
(
`^Mozilla/5\.0 \(Windows NT 6\.1; rv:[\d]+\.0\) Gecko/20100101 Firefox/[\d]+\.0$`
)
var
OrfoxUserAgents
=
regexp
.
MustCompile
(
`^Mozilla/5\.0 \(Android; Mobile; rv:38.0\) Gecko/38.0 Firefox/38.0$`
)
func
LikelyTBB
(
ua
string
)
bool
{
return
TBBUserAgents
.
MatchString
(
ua
)
return
TBBUserAgents
.
MatchString
(
ua
)
||
OrfoxUserAgents
.
MatchString
(
ua
)
}
var
HaveManual
=
map
[
string
]
bool
{
...
...
utils_test.go
View file @
644e1c21
...
...
@@ -10,7 +10,8 @@ var UserAgents = map[string]bool{
"Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0"
:
true
,
"Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0"
:
true
,
"Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0"
:
true
,
"Mozilla/5.0 (Android; Mobile; rv:24.0) Gecko/20100101 Firefox/24.0"
:
true
,
"Mozilla/5.0 (Android; Mobile; rv:31.0) Gecko/31.0 Firefox/31.0"
:
false
,
"Mozilla/5.0 (Android; Mobile; rv:38.0) Gecko/38.0 Firefox/38.0"
:
true
,
}
func
TestLikelyTBB
(
t
*
testing
.
T
)
{
...
...
Arlo Breault
@arlo
mentioned in commit
aa25675a
·
Apr 20, 2021
mentioned in commit
aa25675a
mentioned in commit aa25675a220bc91104fd887216d09314ca26c822
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment