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
Xiaowu Zhang
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
Show 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 :
Bug :
Peers stay connected to the bootstrap node so none can enter
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 :
To be done :
test with python 2.6
test with python 2.6
...
...
docs/re6st-registry.rst
View file @
12729533
...
@@ -20,9 +20,9 @@ DESCRIPTION
...
@@ -20,9 +20,9 @@ DESCRIPTION
===========
===========
re6st-registry is a server for the re6st network. Its role is to deliver
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.
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.
running the re6st-registry must also have a client ( re6stnet ) running.
USAGE
USAGE
...
@@ -31,7 +31,7 @@ USAGE
...
@@ -31,7 +31,7 @@ USAGE
The re6st-registry will automatically listen on both ipv4 and ipv6 for incomming
The re6st-registry will automatically listen on both ipv4 and ipv6 for incomming
request.
request.
port
--port
port
The port on which the server will listen
The port on which the server will listen
--db path
--db path
...
@@ -59,21 +59,6 @@ port
...
@@ -59,21 +59,6 @@ port
address will be advertised only to nodes having a valid
address will be advertised only to nodes having a valid
certificate.
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
SEE ALSO
========
========
...
...
docs/re6stnet.rst
View file @
12729533
...
@@ -252,25 +252,20 @@ these files in a different directory than the certificates for the registry,
...
@@ -252,25 +252,20 @@ these files in a different directory than the certificates for the registry,
although the names shouldn't conflict.
although the names shouldn't conflict.
Now here's the tricky part. For your network to work, you need to restart the
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
registry with more information than the last time. You need to get your hands
than the last time. You need to get your hands on the individual prefix of your
on the re6st ipv6 address associated with your node. These should have been
node, and the re6st ipv6 address associated. These should have been printed
printed at the end of re6st-conf. If you have missed them, for one reason or
at the end of re6st-conf. If you have missed them, for one reason or another,
another, you can get it in the python interpreter::
you can get them in the python interpreter::
from re6st import utils
>>> from re6st import utils
network = utils.networkFromCa('ca.pem')
>>> network = utils.networkFromCa('ca.pem')
re6st_ip, _ = utils.ipFromCert(network, 'cert.crt')
>>> re6st_ip, prefix = utils.ipFromCert(network, 'cert.crt')
print re6st_ip
>>> print re6st_ip
2001:0db8:0042:0003:0000:0000:0000:0001
>>> print prefix
0000000000000011
Now you can restart your re6st-registry with two more options:
Now you can restart your re6st-registry with two more options:
``re6st-registry port_number --db db_path --ca path_to_ca.crt
``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
--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
Finally, you can start your own re6st node following the instructions in the
precedent section.
precedent section.
...
...
re6st-registry
View file @
12729533
...
@@ -60,9 +60,6 @@ class main(object):
...
@@ -60,9 +60,6 @@ class main(object):
help
=
'Path to certificate key'
)
help
=
'Path to certificate key'
)
_
(
'--mailhost'
,
required
=
True
,
_
(
'--mailhost'
,
required
=
True
,
help
=
'SMTP server mail host'
)
help
=
'SMTP server mail host'
)
_
(
'--bootstrap'
,
action
=
"append"
,
help
=
'''VPN prefix of the peers to send as bootstrap peer,
instead of random ones'''
)
_
(
'--private'
,
_
(
'--private'
,
help
=
'VPN IP of the node on which runs the registry'
)
help
=
'VPN IP of the node on which runs the registry'
)
self
.
config
=
parser
.
parse_args
()
self
.
config
=
parser
.
parse_args
()
...
@@ -201,25 +198,16 @@ class main(object):
...
@@ -201,25 +198,16 @@ class main(object):
def
getPrivateAddress
(
self
,
handler
):
def
getPrivateAddress
(
self
,
handler
):
return
'http://[%s]:%u'
%
(
self
.
config
.
private
,
self
.
config
.
port
)
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
):
def
getBootstrapPeer
(
self
,
handler
,
client_prefix
):
cert
,
=
self
.
db
.
execute
(
"SELECT cert FROM vpn WHERE prefix = ?"
,
cert
,
=
self
.
db
.
execute
(
"SELECT cert FROM vpn WHERE prefix = ?"
,
(
client_prefix
,)).
next
()
(
client_prefix
,)).
next
()
logging
.
trace
(
'Getting bootpeer info...'
)
logging
.
trace
(
'Getting bootpeer info...'
)
if
self
.
config
.
bootstrap
:
bootpeer
=
random
.
choice
(
self
.
config
.
bootstrap
)
try
:
try
:
prefix
,
address
=
self
.
db
.
execute
(
"""SELECT prefix, addres
s
prefix
,
address
=
self
.
db
.
execute
(
"""SELECT prefix, address FROM peer
s
FROM peers WHERE prefix = ?"""
,
(
bootpeer
,)).
next
()
WHERE prefix != ? ORDER BY random() LIMIT 1"""
,
(
client_prefix
,)).
next
()
except
StopIteration
:
except
StopIteration
:
logging
.
info
(
'Bootstrap peer %s unknown, sending random peer'
logging
.
info
(
'No peer to send for bootstrap'
)
%
hex
(
int
(
bootpeer
,
2
))[
2
:])
raise
prefix
,
address
=
self
.
_randomPeer
()
else
:
prefix
,
address
=
self
.
_randomPeer
()
logging
.
trace
(
'Gotten bootpeer info from db'
)
logging
.
trace
(
'Gotten bootpeer info from db'
)
r
,
w
=
os
.
pipe
()
r
,
w
=
os
.
pipe
()
try
:
try
:
...
...
re6st/db.py
View file @
12729533
...
@@ -139,6 +139,8 @@ class PeerManager:
...
@@ -139,6 +139,8 @@ class PeerManager:
except
sqlite3
.
IntegrityError
,
e
:
except
sqlite3
.
IntegrityError
,
e
:
if
e
.
args
[
0
]
!=
'column prefix is not unique'
:
if
e
.
args
[
0
]
!=
'column prefix is not unique'
:
raise
raise
except
StopIteration
:
logging
.
info
(
'No peer available for bootstrap'
)
return
False
return
False
def
usePeer
(
self
,
prefix
):
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