Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sshuttle
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pub
sshuttle
Commits
0e51da51
Commit
0e51da51
authored
Feb 15, 2021
by
Kees Hink
Committed by
Brian May
Feb 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow comments in configuration file
parent
a22c453d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
manpage.rst
docs/manpage.rst
+11
-0
options.py
sshuttle/options.py
+4
-0
test_options.py
tests/client/test_options.py
+5
-0
No files found.
docs/manpage.rst
View file @
0e51da51
...
...
@@ -305,6 +305,17 @@ Arguments read from a file must be one per line, as shown below::
--option2
value2
Comments in config file
.......................
It's possible to add comments in the configuration file. This allows annotating the
various subnets with human-readable descriptions, like::
# company-internal API
8.8.8.8/32
# home IoT
192.168.63.0/24
Examples
--------
...
...
sshuttle/options.py
View file @
0e51da51
...
...
@@ -152,6 +152,10 @@ class Concat(Action):
# beginning/end of the lines.
class
MyArgumentParser
(
ArgumentParser
):
def
convert_arg_line_to_args
(
self
,
arg_line
):
# Ignore comments
if
arg_line
.
startswith
(
"#"
):
return
[]
# strip whitespace at beginning and end of line
arg_line
=
arg_line
.
strip
()
...
...
tests/client/test_options.py
View file @
0e51da51
...
...
@@ -100,3 +100,8 @@ def test_parse_subnetport_ip6_with_mask_and_port():
==
[(
socket
.
AF_INET6
,
ip
,
128
,
80
,
80
)]
assert
sshuttle
.
options
.
parse_subnetport
(
'['
+
ip_repr
+
'/16]:80-90'
)
\
==
[(
socket
.
AF_INET6
,
ip
,
16
,
80
,
90
)]
def
test_convert_arg_line_to_args_skips_comments
():
parser
=
sshuttle
.
options
.
MyArgumentParser
()
assert
parser
.
convert_arg_line_to_args
(
"# whatever something"
)
==
[]
Write
Preview
Markdown
is supported
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