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
Cecylia Bocovich
probetest
Commits
8c514c11
Commit
8c514c11
authored
Aug 24, 2020
by
Cecylia Bocovich
Browse files
Add STUN server test to snowflake tests
parent
76489283
Changes
3
Hide whitespace changes
Inline
Side-by-side
README
View file @
8c514c11
...
...
@@ -2,10 +2,15 @@ Prerequesites:
#Python 3 and related packages
apt install python python3-pip
pip3 install stem
Golang 1.13+
#obfs4 and tor
apt install obfs4proxy tor torsocks
#build scripts
cd stun-test
go build
[SITENAME] is an arbitrary identifier for the probe site
that you have to choose.
...
...
probetest.sh
View file @
8c514c11
...
...
@@ -20,6 +20,10 @@ case $CASE in
"
$dirname
/obfs4test"
"
$dirname
/bridge_lines.txt"
;;
'snowflake'
)
# First test reachability of STUN servers
"
$dirname
/stun-test/stun-test"
# Throughput/reachibility test of 100 snowflakes
"
$dirname
/snowflaketest"
# Process .pcap files and delete
;;
esac
stun-test/stun-test.go
0 → 100644
View file @
8c514c11
package
main
import
(
"flag"
"fmt"
"os"
"github.com/pion/stun"
)
var
defaultSTUNServers
=
[]
string
{
"stun.l.google.com:19302"
,
"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"
,
}
func
main
()
{
flag
.
Usage
=
func
()
{
fmt
.
Fprintf
(
os
.
Stderr
,
"Usage of %s:
\n
"
,
os
.
Args
[
0
])
fmt
.
Fprintln
(
os
.
Stderr
,
os
.
Args
[
0
],
"[path]"
)
}
flag
.
Parse
()
path
:=
flag
.
Arg
(
0
)
if
path
==
""
{
path
=
"."
}
path
=
fmt
.
Sprintf
(
"%s/stun-test.csv"
,
path
)
f
,
err
:=
os
.
OpenFile
(
path
,
os
.
O_CREATE
|
os
.
O_APPEND
|
os
.
O_WRONLY
,
0600
)
if
err
!=
nil
{
panic
(
err
)
}
for
_
,
server
:=
range
defaultSTUNServers
{
res
:=
testServer
(
server
)
if
_
,
err
:=
f
.
Write
([]
byte
(
res
));
err
!=
nil
{
panic
(
err
)
}
}
f
.
Close
()
}
func
testServer
(
addr
string
)
string
{
c
,
err
:=
stun
.
Dial
(
"udp"
,
addr
)
if
err
!=
nil
{
return
fmt
.
Sprintf
(
"%s,false,dial,%s
\n
"
,
addr
,
err
.
Error
())
}
if
err
=
c
.
Do
(
stun
.
MustBuild
(
stun
.
TransactionID
,
stun
.
BindingRequest
),
func
(
res
stun
.
Event
)
{
if
res
.
Error
!=
nil
{
return
}
var
xorAddr
stun
.
XORMappedAddress
if
getErr
:=
xorAddr
.
GetFrom
(
res
.
Message
);
getErr
!=
nil
{
return
}
fmt
.
Println
(
xorAddr
)
});
err
!=
nil
{
return
fmt
.
Sprintf
(
"%s,false,request,%s
\n
"
,
addr
,
err
.
Error
())
}
c
.
Close
()
return
fmt
.
Sprintf
(
"%s,true,,
\n
"
,
addr
)
}
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