Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sbws
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
juga
sbws
Commits
a3951327
Commit
a3951327
authored
6 years ago
by
juga
Browse files
Options
Downloads
Patches
Plain Diff
scanner: log circuit path nicknames and errors
parent
90a882d5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sbws/core/scanner.py
+17
-12
17 additions, 12 deletions
sbws/core/scanner.py
sbws/lib/destination.py
+1
-1
1 addition, 1 deletion
sbws/lib/destination.py
with
18 additions
and
13 deletions
sbws/core/scanner.py
+
17
−
12
View file @
a3951327
...
...
@@ -192,11 +192,14 @@ def measure_relay(args, conf, destinations, cb, rl, relay):
relay
,
dest
,
rl
,
cb
.
controller
,
is_exit
=
False
)
if
helper
:
circ_fps
=
[
helper
.
fingerprint
,
relay
.
fingerprint
]
# stored for debugging
nicknames
=
[
helper
.
nickname
,
relay
.
nickname
]
else
:
helper
=
_pick_ideal_second_hop
(
relay
,
dest
,
rl
,
cb
.
controller
,
is_exit
=
True
)
if
helper
:
circ_fps
=
[
relay
.
fingerprint
,
helper
.
fingerprint
]
nicknames
=
[
relay
.
nickname
,
helper
.
nickname
]
if
not
helper
:
# TODO: Return ResultError of some sort
log
.
debug
(
'
Unable to pick a 2nd hop to help measure %s %s
'
,
...
...
@@ -208,22 +211,20 @@ def measure_relay(args, conf, destinations, cb, rl, relay):
our_nick
=
conf
[
'
scanner
'
][
'
nickname
'
]
circ_id
,
reason
=
cb
.
build_circuit
(
circ_fps
)
if
not
circ_id
:
log
.
debug
(
'
Could not build circuit
involving %s
'
,
relay
.
nickname
)
msg
=
'
Unable to complete circuit
'
log
.
debug
(
'
Could not build circuit
with path %s (%s): %s
'
,
circ_fps
,
nicknames
,
reason
)
return
[
ResultErrorCircuit
(
relay
,
circ_fps
,
dest
.
url
,
our_nick
,
msg
=
reason
),
]
log
.
debug
(
'
Built circ %s %s for relay %s %s
'
,
circ_id
,
stem_utils
.
circuit_str
(
cb
.
controller
,
circ_id
),
relay
.
nickname
,
relay
.
fingerprint
[
0
:
8
])
log
.
debug
(
'
Built circuit with path %s (%s) to measure %s (%s)
'
,
circ_fps
,
nicknames
,
relay
.
fingerprint
,
relay
.
nickname
)
# Make a connection to the destionation webserver and make sure it can
# still help us measure
is_usable
,
usable_data
=
dest
.
is_usable
(
circ_id
,
s
,
cb
.
controller
)
if
not
is_usable
:
log
.
debug
(
'
When measuring %s %s the destination seemed to have
'
'
stopped being usable: %s
'
,
relay
.
nickname
,
relay
.
fingerprint
[
0
:
8
],
usable_data
)
log
.
debug
(
'
Destination %s unusable via circuit %s (%s), %s
'
,
dest
.
url
,
circ_fps
,
nicknames
,
usable_data
)
cb
.
close_circuit
(
circ_id
)
# TODO: Return a different/new type of ResultError?
msg
=
'
The destination seemed to have stopped being usable
'
...
...
@@ -236,8 +237,9 @@ def measure_relay(args, conf, destinations, cb, rl, relay):
rtts
,
reason
=
measure_rtt_to_server
(
s
,
conf
,
dest
,
usable_data
[
'
content_length
'
])
if
rtts
is
None
:
log
.
debug
(
'
Unable to measure RTT to %s via relay %s %s
'
,
dest
.
url
,
relay
.
nickname
,
relay
.
fingerprint
[
0
:
8
])
log
.
debug
(
'
Unable to measure RTT for %s (%s) to %s via circuit
'
'
%s (%s): %s
'
,
relay
.
fingerprint
,
relay
.
nickname
,
dest
.
url
,
circ_fps
,
nicknames
,
reason
)
cb
.
close_circuit
(
circ_id
)
return
[
ResultErrorStream
(
relay
,
circ_fps
,
dest
.
url
,
our_nick
,
...
...
@@ -247,8 +249,9 @@ def measure_relay(args, conf, destinations, cb, rl, relay):
bw_results
,
reason
=
measure_bandwidth_to_server
(
s
,
conf
,
dest
,
usable_data
[
'
content_length
'
])
if
bw_results
is
None
:
log
.
debug
(
'
Unable to measure bandwidth to %s via relay %s %s
'
,
dest
.
url
,
relay
.
nickname
,
relay
.
fingerprint
[
0
:
8
])
log
.
debug
(
'
Unable to measure bandwidth for %s (%s) to %s via circuit
'
'
%s (%s): %s
'
,
relay
.
fingerprint
,
relay
.
nickname
,
dest
.
url
,
circ_fps
,
nicknames
,
reason
)
cb
.
close_circuit
(
circ_id
)
return
[
ResultErrorStream
(
relay
,
circ_fps
,
dest
.
url
,
our_nick
,
...
...
@@ -256,6 +259,8 @@ def measure_relay(args, conf, destinations, cb, rl, relay):
]
cb
.
close_circuit
(
circ_id
)
# Finally: store result
log
.
debug
(
'
Success measurement for %s (%s) via circuit %s (%s) to %s
'
,
relay
.
fingerprint
,
relay
.
nickname
,
circ_fps
,
nicknames
,
dest
.
url
)
return
[
ResultSuccess
(
rtts
,
bw_results
,
relay
,
circ_fps
,
dest
.
url
,
our_nick
),
]
...
...
This diff is collapsed.
Click to expand it.
sbws/lib/destination.py
+
1
−
1
View file @
a3951327
...
...
@@ -195,7 +195,7 @@ class DestinationList:
# Pick a random exit
exit
=
self
.
_rng
.
choice
(
exits
)
circ_id
,
reason
=
\
self
.
_cb
.
build_circuit
([
None
,
exit
.
fingerprint
])
self
.
_cb
.
build_circuit
([
None
,
exit
.
fingerprint
])
if
circ_id
:
break
if
not
circ_id
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment