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
64d5c77a
Commit
64d5c77a
authored
Oct 17, 2020
by
Scott Kuhl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix flake8 issues, clarify comment
parent
036c49e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
cmdline.py
sshuttle/cmdline.py
+5
-4
options.py
sshuttle/options.py
+4
-4
No files found.
sshuttle/cmdline.py
View file @
64d5c77a
...
@@ -48,10 +48,11 @@ def main():
...
@@ -48,10 +48,11 @@ def main():
return
hostwatch
.
hw_main
(
opt
.
subnets
,
opt
.
auto_hosts
)
return
hostwatch
.
hw_main
(
opt
.
subnets
,
opt
.
auto_hosts
)
else
:
else
:
# parse_subnetports() is used to create a list of includes
# parse_subnetports() is used to create a list of includes
# and excludes. It returns a list of one or more items for
# and excludes. It is called once for each parameter and
# each subnet. It returns a list since "-x example.com"
# returns a list of one or more items for each subnet (it
# might find that example.com has multiple IP addresses. Here,
# can return more than one item when a hostname in the
# we flatten these lists.
# parameter resolves to multiple IP addresses. Here, we
# flatten these lists.
includes
=
[
item
for
sublist
in
opt
.
subnets
+
opt
.
subnets_file
includes
=
[
item
for
sublist
in
opt
.
subnets
+
opt
.
subnets_file
for
item
in
sublist
]
for
item
in
sublist
]
excludes
=
[
item
for
sublist
in
opt
.
exclude
for
item
in
sublist
]
excludes
=
[
item
for
sublist
in
opt
.
exclude
for
item
in
sublist
]
...
...
sshuttle/options.py
View file @
64d5c77a
...
@@ -67,7 +67,7 @@ def parse_subnetport(s):
...
@@ -67,7 +67,7 @@ def parse_subnetport(s):
"of /
%
s is not supported. Specify the IP "
"of /
%
s is not supported. Specify the IP "
"addresses directly if you wish to specify "
"addresses directly if you wish to specify "
"a mask."
%
(
host
,
cidr
))
"a mask."
%
(
host
,
cidr
))
# Warn if a domain has multiple IPs of the same type (IPv4 vs
# Warn if a domain has multiple IPs of the same type (IPv4 vs
# IPv6) and the mask is applied to all of the IPs.
# IPv6) and the mask is applied to all of the IPs.
if
len
(
addr_v4
)
>
1
or
len
(
addr_v6
)
>
1
:
if
len
(
addr_v4
)
>
1
or
len
(
addr_v6
)
>
1
:
...
@@ -81,7 +81,7 @@ def parse_subnetport(s):
...
@@ -81,7 +81,7 @@ def parse_subnetport(s):
# Largest possible slash value we can use with this IP:
# Largest possible slash value we can use with this IP:
max_cidr
=
32
if
family
==
socket
.
AF_INET
else
128
max_cidr
=
32
if
family
==
socket
.
AF_INET
else
128
if
cidr
is
None
:
# if no mask, use largest mask
if
cidr
is
None
:
# if no mask, use largest mask
cidr_to_use
=
max_cidr
cidr_to_use
=
max_cidr
else
:
# verify user-provided mask is appropriate
else
:
# verify user-provided mask is appropriate
...
@@ -94,7 +94,6 @@ def parse_subnetport(s):
...
@@ -94,7 +94,6 @@ def parse_subnetport(s):
rv
.
append
((
family
,
addr
[
0
],
cidr_to_use
,
rv
.
append
((
family
,
addr
[
0
],
cidr_to_use
,
int
(
fport
or
0
),
int
(
lport
or
fport
or
0
)))
int
(
fport
or
0
),
int
(
lport
or
fport
or
0
)))
return
rv
return
rv
...
@@ -124,7 +123,8 @@ def parse_ipport(s):
...
@@ -124,7 +123,8 @@ def parse_ipport(s):
raise
Fatal
(
'Unable to resolve address:
%
s'
%
host
)
raise
Fatal
(
'Unable to resolve address:
%
s'
%
host
)
if
len
(
addrinfo
)
>
1
:
if
len
(
addrinfo
)
>
1
:
print
(
"WARNING: Host
%
s has more than one IP, only using one of them."
%
host
)
print
(
"WARNING: Host
%
s has more than one IP, only using one of them."
%
host
)
family
,
_
,
_
,
_
,
addr
=
min
(
addrinfo
)
family
,
_
,
_
,
_
,
addr
=
min
(
addrinfo
)
# Note: addr contains (ip, port)
# Note: addr contains (ip, port)
...
...
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