13414e0abc
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.
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
// Package stuninput contains stun targets as well as
|
|
// code to format such targets according to various conventions.
|
|
package stuninput
|
|
|
|
import (
|
|
"fmt"
|
|
"net/url"
|
|
)
|
|
|
|
// TODO(bassosimone): we need to keep this list in sync with
|
|
// the list internally used by TPO's snowflake.
|
|
var inputs = []string{
|
|
"stun.voip.blackberry.com:3478",
|
|
"stun.altar.com.pl:3478",
|
|
"stun.antisip.com:3478",
|
|
"stun.bluesip.net:3478",
|
|
"stun.dus.net:3478",
|
|
"stun.epygi.com:3478",
|
|
"stun.sonetel.com:3478",
|
|
"stun.sonetel.net:3478",
|
|
"stun.stunprotocol.org:3478",
|
|
"stun.uls.co.za:3478",
|
|
"stun.voipgate.com:3478",
|
|
"stun.voys.nl:3478",
|
|
}
|
|
|
|
// AsSnowflakeInput formats the input in the format
|
|
// that is expected by snowflake.
|
|
func AsSnowflakeInput() (output []string) {
|
|
for _, input := range inputs {
|
|
output = append(output, fmt.Sprintf("stun:%s", input))
|
|
}
|
|
return
|
|
}
|
|
|
|
// AsnStunReachabilityInput formats the input in
|
|
// the format that is expected by stunreachability.
|
|
func AsnStunReachabilityInput() (output []string) {
|
|
for _, input := range inputs {
|
|
serio := (&url.URL{Scheme: "stun", Host: input})
|
|
output = append(output, serio.String())
|
|
}
|
|
return
|
|
}
|