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
12729533
Commit
12729533
authored
Aug 10, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing the bootstrap option from the registry
parent
2fc3ee74
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
51 deletions
+22
-51
TODO
TODO
+2
-1
docs/re6st-registry.rst
docs/re6st-registry.rst
+3
-18
docs/re6stnet.rst
docs/re6stnet.rst
+9
-14
re6st-registry
re6st-registry
+6
-18
re6st/db.py
re6st/db.py
+2
-0
No files found.
TODO
View file @
12729533
Bug :
Peers stay connected to the bootstrap node so none can enter
possible bug in the upnp refresh
possible bug in the upnp refresh
possible freeze in the regisrty
To be done :
test with python 2.6
...
...
docs/re6st-registry.rst
View file @
12729533
...
...
@@ -20,9 +20,9 @@ DESCRIPTION
===========
re6st-registry is a server for the re6st network. Its role is to deliver
v
ertificates to new nodes, and to maintain the complete table of peers, so it
c
ertificates to new nodes, and to maintain the complete table of peers, so it
can send part of it to nodes asking for new peers.
As of now, o
nly one re6st-registry per re6st network should run. The node
O
nly one re6st-registry per re6st network should run. The node
running the re6st-registry must also have a client ( re6stnet ) running.
USAGE
...
...
@@ -31,7 +31,7 @@ USAGE
The re6st-registry will automatically listen on both ipv4 and ipv6 for incomming
request.
port
--port
port
The port on which the server will listen
--db path
...
...
@@ -59,21 +59,6 @@ port
address will be advertised only to nodes having a valid
certificate.
Options
-------
--bootstrap prefix
Prefix of a node to be given to other as a bootstrap node to
initiate connection with the network.A prefix is an id given to
each node, which is used to generate the re6st ip address of the
node. A prefix is a string representing binary number.
By default the registry delivers 16 bits prefix. You can get your
prefix from the python interpreter (see re6stnet man page HOW TO)
By default the registry delivers 16 bits prefix.
Asusming a network prefix ``2001:db8:42::/48``, the re6st ip address
``2001:db8:42:1::1/64`` corresponds to a prefix ``1/16`` i.e
``00000000000000010``.
SEE ALSO
========
...
...
docs/re6stnet.rst
View file @
12729533
...
...
@@ -252,25 +252,20 @@ these files in a different directory than the certificates for the registry,
although the names shouldn't conflict.
Now here's the tricky part. For your network to work, you need to restart the
registry (maybe it will be fixed one day...), this time with more information
than the last time. You need to get your hands on the individual prefix of your
node, and the re6st ipv6 address associated. These should have been printed
at the end of re6st-conf. If you have missed them, for one reason or another,
you can get them in the python interpreter::
>>> from re6st import utils
>>> network = utils.networkFromCa('ca.pem')
>>> re6st_ip, prefix = utils.ipFromCert(network, 'cert.crt')
>>> print re6st_ip
2001:0db8:0042:0003:0000:0000:0000:0001
>>> print prefix
0000000000000011
registry with more information than the last time. You need to get your hands
on the re6st ipv6 address associated with your node. These should have been
printed at the end of re6st-conf. If you have missed them, for one reason or
another, you can get it in the python interpreter::
from re6st import utils
network = utils.networkFromCa('ca.pem')
re6st_ip, _ = utils.ipFromCert(network, 'cert.crt')
print re6st_ip
Now you can restart your re6st-registry with two more options:
``re6st-registry port_number --db db_path --ca path_to_ca.crt
--key path_to_ca.key --mailhost yourmailhost --private 2001:db8:42:3::1
--bootstrap 0000000000000011``
Finally, you can start your own re6st node following the instructions in the
precedent section.
...
...
re6st-registry
View file @
12729533
...
...
@@ -60,9 +60,6 @@ class main(object):
help
=
'Path to certificate key'
)
_
(
'--mailhost'
,
required
=
True
,
help
=
'SMTP server mail host'
)
_
(
'--bootstrap'
,
action
=
"append"
,
help
=
'''VPN prefix of the peers to send as bootstrap peer,
instead of random ones'''
)
_
(
'--private'
,
help
=
'VPN IP of the node on which runs the registry'
)
self
.
config
=
parser
.
parse_args
()
...
...
@@ -201,25 +198,16 @@ class main(object):
def
getPrivateAddress
(
self
,
handler
):
return
'http://[%s]:%u'
%
(
self
.
config
.
private
,
self
.
config
.
port
)
def
_randomPeer
(
self
):
return
self
.
db
.
execute
(
"""SELECT prefix, address
FROM peers ORDER BY random() LIMIT 1"""
).
next
()
def
getBootstrapPeer
(
self
,
handler
,
client_prefix
):
cert
,
=
self
.
db
.
execute
(
"SELECT cert FROM vpn WHERE prefix = ?"
,
(
client_prefix
,)).
next
()
logging
.
trace
(
'Getting bootpeer info...'
)
if
self
.
config
.
bootstrap
:
bootpeer
=
random
.
choice
(
self
.
config
.
bootstrap
)
try
:
prefix
,
address
=
self
.
db
.
execute
(
"""SELECT prefix, address
FROM peers WHERE prefix = ?"""
,
(
bootpeer
,)).
next
()
except
StopIteration
:
logging
.
info
(
'Bootstrap peer %s unknown, sending random peer'
%
hex
(
int
(
bootpeer
,
2
))[
2
:])
prefix
,
address
=
self
.
_randomPeer
()
else
:
prefix
,
address
=
self
.
_randomPeer
()
try
:
prefix
,
address
=
self
.
db
.
execute
(
"""SELECT prefix, address FROM peers
WHERE prefix != ? ORDER BY random() LIMIT 1"""
,
(
client_prefix
,)).
next
()
except
StopIteration
:
logging
.
info
(
'No peer to send for bootstrap'
)
raise
logging
.
trace
(
'Gotten bootpeer info from db'
)
r
,
w
=
os
.
pipe
()
try
:
...
...
re6st/db.py
View file @
12729533
...
...
@@ -139,6 +139,8 @@ class PeerManager:
except
sqlite3
.
IntegrityError
,
e
:
if
e
.
args
[
0
]
!=
'column prefix is not unique'
:
raise
except
StopIteration
:
logging
.
info
(
'No peer available for bootstrap'
)
return
False
def
usePeer
(
self
,
prefix
):
...
...
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