Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
zhifan huang
re6stnet
Commits
fd9b9646
Commit
fd9b9646
authored
Mar 13, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept multiple --ip arguments
parent
7aa2195e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
re6stnet
re6stnet
+7
-4
No files found.
re6stnet
View file @
fd9b9646
...
@@ -9,7 +9,7 @@ def getConfig():
...
@@ -9,7 +9,7 @@ def getConfig():
description
=
"Resilient virtual private network application."
)
description
=
"Resilient virtual private network application."
)
_
=
parser
.
add_argument
_
=
parser
.
add_argument
_
(
'--ip'
,
_
(
'--ip'
,
action
=
'append'
,
default
=
[],
help
=
"IP address advertised to other nodes. Special values:
\
n
"
help
=
"IP address advertised to other nodes. Special values:
\
n
"
"- upnp: redirect ports when UPnP device is found
\
n
"
"- upnp: redirect ports when UPnP device is found
\
n
"
"- any: ask peers our IP
\
n
"
"- any: ask peers our IP
\
n
"
...
@@ -153,7 +153,10 @@ def main():
...
@@ -153,7 +153,10 @@ def main():
remote_gateway
=
config
.
gw_list
and
(
lambda
_
:
remote_gateway
=
config
.
gw_list
and
(
lambda
_
:
random
.
choice
(
config
.
gw_list
))
random
.
choice
(
config
.
gw_list
))
forwarder
=
None
forwarder
=
None
if
config
.
ip
==
'upnp'
or
not
config
.
ip
:
if
len
(
config
.
ip
)
>
1
and
'upnp'
in
config
.
ip
or
'any'
in
config
.
ip
:
sys
.
exit
(
"error: argument --ip can be given only once with 'any'"
" or 'upnp' value"
)
if
'upnp'
in
config
.
ip
or
not
config
.
ip
:
logging
.
info
(
'Attempting automatic configuration via UPnP...'
)
logging
.
info
(
'Attempting automatic configuration via UPnP...'
)
try
:
try
:
from
re6st.upnpigd
import
Forwarder
from
re6st.upnpigd
import
Forwarder
...
@@ -168,8 +171,8 @@ def main():
...
@@ -168,8 +171,8 @@ def main():
forwarder
.
addRule
(
port
,
proto
)
forwarder
.
addRule
(
port
,
proto
)
ip_changed
=
forwarder
.
checkExternalIp
ip_changed
=
forwarder
.
checkExternalIp
address
=
ip_changed
()
address
=
ip_changed
()
elif
config
.
ip
!=
'any'
:
elif
'any'
not
in
config
.
ip
:
address
=
ip_changed
(
config
.
ip
)
address
=
sum
(
map
(
ip_changed
,
config
.
ip
),
[]
)
ip_changed
=
None
ip_changed
=
None
for
x
in
pp
:
for
x
in
pp
:
server_tunnels
.
setdefault
(
're6stnet-'
+
x
[
1
],
x
)
server_tunnels
.
setdefault
(
're6stnet-'
+
x
[
1
],
x
)
...
...
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