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
Rafael Monnerat
re6stnet
Commits
d0f47075
Commit
d0f47075
authored
Jul 20, 2012
by
Guillaume Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaner server connection
parent
49685121
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
9 deletions
+15
-9
README
README
+1
-2
db.py
db.py
+9
-4
setup.py
setup.py
+4
-3
vifibnet.py
vifibnet.py
+1
-0
No files found.
README
View file @
d0f47075
Vifibnet is a daemon setting up a resilient virtual private network over the
Vifibnet is a daemon setting up a resilient virtual private network over the
internet
internet
To use vifibnet, you need to launch the registry.py on a server to provide the
To use vifibnet, you need to launch the registry.py on a server to provide the
certificates. Then you should run setup.py on each clients tu prepare the
certificates. Then you should run setup.py on each clients tu prepare the
clients and then run vifibnet.py on each client
clients and then run vifibnet.py on each client
...
@@ -13,4 +13,3 @@ The organisation of the code
...
@@ -13,4 +13,3 @@ The organisation of the code
tunnel.py To choose wich connection delete/keep/...
tunnel.py To choose wich connection delete/keep/...
upnpigd.py To open a port
upnpigd.py To open a port
db.py
View file @
d0f47075
import
sqlite3
,
xmlrpclib
,
time
import
sqlite3
,
socket
,
xmlrpclib
,
time
import
utils
import
utils
class
PeerManager
:
class
PeerManager
:
...
@@ -29,9 +29,14 @@ class PeerManager:
...
@@ -29,9 +29,14 @@ class PeerManager:
def
refresh
(
self
):
def
refresh
(
self
):
utils
.
log
(
'Refreshing the peers DB'
,
2
)
utils
.
log
(
'Refreshing the peers DB'
,
2
)
self
.
_declare
()
try
:
self
.
_populate
()
self
.
_declare
()
self
.
next_refresh
=
time
.
time
()
+
self
.
_refresh_time
self
.
_populate
()
self
.
next_refresh
=
time
.
time
()
+
self
.
_refresh_time
except
socket
.
error
,
e
:
utils
.
log
(
str
(
e
),
3
)
utils
.
log
(
'Connection to server failed, retrying in 30s'
,
2
)
self
.
next_refresh
=
time
.
time
()
+
30
def
_declare
(
self
):
def
_declare
(
self
):
if
self
.
_address
!=
None
:
if
self
.
_address
!=
None
:
...
...
setup.py
View file @
d0f47075
...
@@ -42,9 +42,6 @@ def main():
...
@@ -42,9 +42,6 @@ def main():
used INTEGER NOT NULL DEFAULT 0,
used INTEGER NOT NULL DEFAULT 0,
date INTEGER DEFAULT (strftime('%s', 'now')))"""
)
date INTEGER DEFAULT (strftime('%s', 'now')))"""
)
db
.
execute
(
"CREATE INDEX _peers_used ON peers(used)"
)
db
.
execute
(
"CREATE INDEX _peers_used ON peers(used)"
)
if
not
config
.
no_boot
:
prefix
,
address
=
s
.
getBootstrapPeer
()
db
.
execute
(
"INSERT INTO peers (prefix, address) VALUES (?,?)"
,
(
prefix
,
address
))
except
sqlite3
.
OperationalError
,
e
:
except
sqlite3
.
OperationalError
,
e
:
if
e
.
args
[
0
]
==
'table peers already exists'
:
if
e
.
args
[
0
]
==
'table peers already exists'
:
print
"Table peers already exists, leaving it as it is"
print
"Table peers already exists, leaving it as it is"
...
@@ -52,6 +49,10 @@ def main():
...
@@ -52,6 +49,10 @@ def main():
print
"sqlite3.OperationalError :"
+
e
.
args
[
0
]
print
"sqlite3.OperationalError :"
+
e
.
args
[
0
]
sys
.
exit
(
1
)
sys
.
exit
(
1
)
if
not
config
.
no_boot
:
prefix
,
address
=
s
.
getBootstrapPeer
()
db
.
execute
(
"INSERT INTO peers (prefix, address) VALUES (?,?)"
,
(
prefix
,
address
))
if
config
.
db_only
:
if
config
.
db_only
:
sys
.
exit
(
0
)
sys
.
exit
(
0
)
...
...
vifibnet.py
View file @
d0f47075
...
@@ -116,6 +116,7 @@ def main():
...
@@ -116,6 +116,7 @@ def main():
server_process
=
plib
.
server
(
internal_ip
,
network
,
config
.
connection_count
,
config
.
dh
,
write_pipe
,
server_process
=
plib
.
server
(
internal_ip
,
network
,
config
.
connection_count
,
config
.
dh
,
write_pipe
,
config
.
internal_port
,
config
.
proto
,
config
.
hello
,
'--dev'
,
'vifibnet'
,
*
openvpn_args
,
config
.
internal_port
,
config
.
proto
,
config
.
hello
,
'--dev'
,
'vifibnet'
,
*
openvpn_args
,
stdout
=
os
.
open
(
os
.
path
.
join
(
config
.
log
,
'vifibnet.server.log'
),
os
.
O_WRONLY
|
os
.
O_CREAT
|
os
.
O_TRUNC
))
stdout
=
os
.
open
(
os
.
path
.
join
(
config
.
log
,
'vifibnet.server.log'
),
os
.
O_WRONLY
|
os
.
O_CREAT
|
os
.
O_TRUNC
))
tunnel_manager
.
refresh
()
# main loop
# main loop
try
:
try
:
...
...
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