Skip to content

Commit

Permalink
[backport] doc(whatsapp): explain the tricky >= 2 check (#1000)
Browse files Browse the repository at this point in the history
This diff backports 0103233.

Closes ooni/probe#2383
  • Loading branch information
bassosimone committed Dec 7, 2022
1 parent 7a03da8 commit e3bf526
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/engine/experiment/whatsapp/whatsapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ func (tk *TestKeys) Update(v urlgetter.MultiOutput) {
runtimex.PanicOnError(err, "url.Parse should not fail here")
hostname := parsed.Hostname()
tk.WhatsappEndpointsCount[hostname]++
// Implementation note: here we're counting twice because we test each
// IP address twice: once for 443 and once for 5222. Above we use .Hostname
// therefore URL parsing discards the port and we only get the addr.
//
// This line of code was confusing enough to cause me to create an issue to
// investigate it: https://github.com/ooni/probe/issues/2383. So, it's better
// to document what's going on here :grimacing:.
if tk.WhatsappEndpointsCount[hostname] >= 2 {
tk.WhatsappEndpointsBlocked = append(tk.WhatsappEndpointsBlocked, hostname)
}
Expand Down

0 comments on commit e3bf526

Please sign in to comment.