refactor: create common package for holding STUN input (#631)

We want stunreachability to use the same STUN servers used by
snowflake, so let's start by making a common package holding the
servers. Let's also use this new package in Snowflake.

We're currently not using this package in stunreachability, but
I am going to apply this as a subsequent diff.

Reference issue: https://github.com/ooni/probe/issues/1814. This
issue is a bit complex to address in a single PR, so we are going
to proceed incremntally.

This diff was extracted from https://github.com/ooni/probe-cli/pull/539.
This commit is contained in:
Simone Basso
2021-12-03 14:45:25 +01:00
committed by GitHub
parent cba72d1ca3
commit 13414e0abc
3 changed files with 77 additions and 14 deletions
+2 -14
View File
@@ -5,6 +5,7 @@ import (
"net"
sflib "git.torproject.org/pluggable-transports/snowflake.git/client/lib"
"github.com/ooni/probe-cli/v3/internal/stuninput"
)
// SnowflakeDialer is a dialer for snowflake. When optional fields are
@@ -115,20 +116,7 @@ func (d *SnowflakeDialer) iceAddresses() []string {
if len(d.ICEAddresses) > 0 {
return d.ICEAddresses
}
return []string{
"stun:stun.voip.blackberry.com:3478",
"stun:stun.altar.com.pl:3478",
"stun:stun.antisip.com:3478",
"stun:stun.bluesip.net:3478",
"stun:stun.dus.net:3478",
"stun:stun.epygi.com:3478",
"stun:stun.sonetel.com:3478",
"stun:stun.sonetel.net:3478",
"stun:stun.stunprotocol.org:3478",
"stun:stun.uls.co.za:3478",
"stun:stun.voipgate.com:3478",
"stun:stun.voys.nl:3478",
}
return stuninput.AsSnowflakeInput()
}
// maxSnowflakes returns the number of snowflakes to collect.