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
Boris Kocherov
re6stnet
Commits
3825276f
Commit
3825276f
authored
Jul 20, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.erp5.org/repos/vifibnet
parents
5086a20a
ef42f40f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
vifibnet.py
vifibnet.py
+4
-5
No files found.
vifibnet.py
View file @
3825276f
...
@@ -4,10 +4,10 @@ from argparse import ArgumentParser
...
@@ -4,10 +4,10 @@ from argparse import ArgumentParser
from
OpenSSL
import
crypto
from
OpenSSL
import
crypto
import
db
,
plib
,
upnpigd
,
utils
,
tunnel
import
db
,
plib
,
upnpigd
,
utils
,
tunnel
def
ArgParser
(
ArgumentParser
):
class
ArgParser
(
ArgumentParser
):
def
convert_arg_line_to_args
(
self
,
arg_line
):
def
convert_arg_line_to_args
(
self
,
arg_line
):
for
arg
in
(
'--'
+
arg_line
.
strip
(
)).
split
():
for
arg
in
(
'--'
+
arg_line
.
lstrip
(
'--'
)).
split
():
if
arg
.
strip
():
if
arg
.
strip
():
yield
arg
yield
arg
...
@@ -22,7 +22,7 @@ def ovpnArgs(optional_args, ca_path, cert_path):
...
@@ -22,7 +22,7 @@ def ovpnArgs(optional_args, ca_path, cert_path):
return
optional_args
return
optional_args
def
getConfig
():
def
getConfig
():
parser
=
argparse
.
ArgumentParser
(
parser
=
ArgParser
(
fromfile_prefix_chars
=
'@'
,
description
=
'Resilient virtual private network application'
)
description
=
'Resilient virtual private network application'
)
_
=
parser
.
add_argument
_
=
parser
.
add_argument
# Server address SHOULD be a vifib address ( else requests will be denied )
# Server address SHOULD be a vifib address ( else requests will be denied )
...
@@ -91,14 +91,13 @@ def main():
...
@@ -91,14 +91,13 @@ def main():
if
manual
:
if
manual
:
utils
.
log
(
'Manual external configuration'
,
3
)
utils
.
log
(
'Manual external configuration'
,
3
)
else
:
else
:
utils
.
log
(
'Attempting automatic configuration via UPnP'
,
3
)
utils
.
log
(
'Attempting automatic configuration via UPnP'
,
4
)
try
:
try
:
external_ip
,
external_port
=
upnpigd
.
ForwardViaUPnP
(
config
.
internal_port
)
external_ip
,
external_port
=
upnpigd
.
ForwardViaUPnP
(
config
.
internal_port
)
config
.
address
=
[[
external_ip
,
external_port
,
'udp'
],
config
.
address
=
[[
external_ip
,
external_port
,
'udp'
],
[
external_ip
,
external_port
,
'tcp-client'
]]
[
external_ip
,
external_port
,
'tcp-client'
]]
except
Exception
:
except
Exception
:
utils
.
log
(
'An atempt to forward a port via UPnP failed'
,
4
)
utils
.
log
(
'An atempt to forward a port via UPnP failed'
,
4
)
#raise RuntimeError => this shouldn't raise an error since upnp is not mandatory
peer_db
=
db
.
PeerManager
(
config
.
db
,
config
.
server
,
config
.
server_port
,
peer_db
=
db
.
PeerManager
(
config
.
db
,
config
.
server
,
config
.
server_port
,
config
.
peers_db_refresh
,
config
.
address
,
internal_ip
,
prefix
,
manual
,
200
)
config
.
peers_db_refresh
,
config
.
address
,
internal_ip
,
prefix
,
manual
,
200
)
...
...
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