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
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
nexedi
re6stnet
Commits
5ded971e
Commit
5ded971e
authored
Jul 05, 2012
by
Guillaume Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small corrections
parent
bb6e7cb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
+2
-5
main.py
main.py
+2
-5
No files found.
main.py
View file @
5ded971e
...
@@ -7,7 +7,6 @@ import random
...
@@ -7,7 +7,6 @@ import random
VIFIB_NET
=
"2001:db8:42::/48"
VIFIB_NET
=
"2001:db8:42::/48"
connection_dict
=
{}
# to remember current connections
connection_dict
=
{}
# to remember current connections
#avalaible_peer_list = [('10.1.4.2', 1194), ('10.1.4.3', 1194), ('10.1.3.2', 1194)]
free_interface_set
=
set
((
'client1'
,
'client2'
,
'client3'
,
'client4'
,
'client5'
,
'client6'
,
'client7'
,
'client8'
,
'client9'
,
'client10'
))
free_interface_set
=
set
((
'client1'
,
'client2'
,
'client3'
,
'client4'
,
'client5'
,
'client6'
,
'client7'
,
'client8'
,
'client9'
,
'client10'
))
# TODO : How do we get our vifib ip ?
# TODO : How do we get our vifib ip ?
...
@@ -29,7 +28,6 @@ def babel(network_ip, network_mask, verbose_level):
...
@@ -29,7 +28,6 @@ def babel(network_ip, network_mask, verbose_level):
]
]
if
config
.
babel_state
:
if
config
.
babel_state
:
args
+=
'-S'
,
config
.
babel_state
args
+=
'-S'
,
config
.
babel_state
# TODO : add list of interfaces to use with babel
return
subprocess
.
Popen
(
args
+
list
(
free_interface_set
))
return
subprocess
.
Popen
(
args
+
list
(
free_interface_set
))
def
getConfig
():
def
getConfig
():
...
@@ -64,8 +62,6 @@ def getConfig():
...
@@ -64,8 +62,6 @@ def getConfig():
if
config
.
openvpn_args
[
0
]
==
"--"
:
if
config
.
openvpn_args
[
0
]
==
"--"
:
del
config
.
openvpn_args
[
0
]
del
config
.
openvpn_args
[
0
]
# TODO : use port and proto in openvpn client
# TODO : use config.client_count
def
startNewConnection
(
n
):
def
startNewConnection
(
n
):
try
:
try
:
for
id
,
ip
,
port
,
proto
in
peer_db
.
execute
(
for
id
,
ip
,
port
,
proto
in
peer_db
.
execute
(
...
@@ -73,7 +69,8 @@ def startNewConnection(n):
...
@@ -73,7 +69,8 @@ def startNewConnection(n):
if
config
.
verbose
>=
2
:
if
config
.
verbose
>=
2
:
print
'Establishing a connection with %s'
%
ip
print
'Establishing a connection with %s'
%
ip
iface
=
free_interface_set
.
pop
()
iface
=
free_interface_set
.
pop
()
connection_dict
[
id
]
=
(
openvpn
.
client
(
ip
,
'--dev'
,
iface
)
,
iface
)
connection_dict
[
id
]
=
(
openvpn
.
client
(
ip
,
'--dev'
,
iface
,
'--proto'
,
proto
,
'--rport'
,
str
(
port
))
,
iface
)
peer_db
.
execute
(
"UPDATE peers SET used = 1 WHERE id = ?"
,
(
id
,))
peer_db
.
execute
(
"UPDATE peers SET used = 1 WHERE id = ?"
,
(
id
,))
except
KeyError
:
except
KeyError
:
if
config
.
verbose
>=
2
:
if
config
.
verbose
>=
2
:
...
...
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