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
6e413483
Commit
6e413483
authored
6 years ago
by
Matt Traudt
Committed by
Matt Traudt
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Better variable names
parent
59172356
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sbws/util/stem.py
+13
-13
13 additions, 13 deletions
sbws/util/stem.py
with
13 additions
and
13 deletions
sbws/util/stem.py
+
13
−
13
View file @
6e413483
...
...
@@ -151,9 +151,9 @@ def launch_tor(conf):
section
=
conf
[
'
tor
'
]
os
.
makedirs
(
section
[
'
datadir
'
],
mode
=
0o700
,
exist_ok
=
True
)
# Bare minimum things, more or less
c
=
copy
.
deepcopy
(
TORRC_STARTING_POINT
)
torr
c
=
copy
.
deepcopy
(
TORRC_STARTING_POINT
)
# Very important and/or common settings that we don't know until runtime
c
.
update
({
torr
c
.
update
({
'
DataDirectory
'
:
section
[
'
datadir
'
],
'
PidFile
'
:
os
.
path
.
join
(
section
[
'
datadir
'
],
'
tor.pid
'
),
'
ControlSocket
'
:
section
[
'
control_socket
'
],
...
...
@@ -193,25 +193,25 @@ def launch_tor(conf):
log
.
info
(
'
Adding
"
%s %s
"
to torrc with which we are launching Tor
'
,
key
,
value
)
# It's really easy to add to the torrc if the key doesn't exist
if
key
not
in
c
:
c
.
update
({
key
:
value
})
if
key
not
in
torr
c
:
torr
c
.
update
({
key
:
value
})
# But if it does, we have to make a list of values. For example, say
# the user wants to add a SocksPort and we already have
# 'SocksPort auto' in the torrc. We'll go from
# c['SocksPort'] == 'auto'
#
torr
c['SocksPort'] == 'auto'
# to
# c['SocksPort'] == ['auto', '9050']
#
torr
c['SocksPort'] == ['auto', '9050']
else
:
v
=
c
[
key
]
if
isinstance
(
v
,
str
):
c
.
update
({
key
:
[
v
,
value
]})
existing_val
=
torr
c
[
key
]
if
isinstance
(
existing_val
,
str
):
torr
c
.
update
({
key
:
[
existing_val
,
value
]})
else
:
assert
isinstance
(
v
,
list
)
v
.
append
(
value
)
c
.
update
({
key
:
v
})
assert
isinstance
(
existing_val
,
list
)
existing_val
.
append
(
value
)
torr
c
.
update
({
key
:
existing_val
})
# Finally launch Tor
stem
.
process
.
launch_tor_with_config
(
c
,
init_msg_handler
=
log
.
debug
,
take_ownership
=
True
)
torr
c
,
init_msg_handler
=
log
.
debug
,
take_ownership
=
True
)
# And return a controller to it
return
_init_controller_socket
(
section
[
'
control_socket
'
])
...
...
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