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
ced3ef90
Commit
ced3ef90
authored
Feb 05, 2025
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
b52a9e19
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
16 deletions
+21
-16
demo/demo
demo/demo
+5
-2
demo/test_hmac.py
demo/test_hmac.py
+1
-1
re6st/registry.py
re6st/registry.py
+2
-1
re6st/tunnel.py
re6st/tunnel.py
+13
-12
No files found.
demo/demo
View file @
ced3ef90
...
...
@@ -339,8 +339,11 @@ if args.ping:
class testHMAC(Thread):
def run(self):
updateHMAC = ('python', '-c', "import urllib, sys; sys.exit("
"204 != urllib.urlopen('http://127.0.0.1/updateHMAC').code)")
updateHMAC = (sys.executable, '-c', """if 1:
from urllib.request import urlopen
import sys
sys.exit(204 != urlopen('http://127.0.0.1/updateHMAC').code)
""")
reg1_db = sqlite3.connect('registry/registry.db', isolation_level=None,
check_same_thread=False)
reg2_db = sqlite3.connect('registry2/registry.db', isolation_level=None,
...
...
demo/test_hmac.py
View file @
ced3ef90
...
...
@@ -6,7 +6,7 @@ BABEL_HMAC = 'babel_hmac0', 'babel_hmac1', 'babel_hmac2'
def
getConfig
(
db
,
name
):
r
=
db
.
execute
(
"SELECT value FROM config WHERE name=?"
,
(
name
,)).
fetchone
()
if
r
:
return
b2a_hex
(
*
r
)
return
b2a_hex
(
*
r
)
.
decode
()
def
killRe6st
(
node
):
for
p
in
psutil
.
Process
(
node
.
_screen
.
pid
).
children
():
...
...
re6st/registry.py
View file @
ced3ef90
...
...
@@ -729,7 +729,8 @@ class RegistryServer:
self
.
newHMAC
(
2
,
b''
)
self
.
increaseVersion
()
self
.
setConfig
(
'version'
,
self
.
version
)
self
.
network_config
[
'version'
]
=
base64
.
b64encode
(
self
.
version
)
self
.
network_config
[
'version'
]
=
\
base64
.
b64encode
(
self
.
version
).
decode
()
self
.
sendto
(
self
.
prefix
,
0
)
@
rpc_private
...
...
re6st/tunnel.py
View file @
ced3ef90
...
...
@@ -380,7 +380,8 @@ class BaseTunnelManager:
if
prefix
==
self
.
_prefix
:
msg
=
self
.
_processPacket
(
msg
)
if
msg
:
self
.
_sendto
(
to
,
'%s
\
0
%c%s'
%
(
prefix
,
code
,
msg
))
self
.
_sendto
(
to
,
b'%s
\
0
%c%s'
%
(
prefix
.
encode
(),
code
,
msg
))
else
:
self
.
sendto
(
prefix
,
bytes
([
code
|
0x80
])
+
msg
[
1
:])
return
...
...
@@ -455,9 +456,7 @@ class BaseTunnelManager:
# We got a valid and non-empty message. Always reply
# something so that the sender knows we're still connected.
answer
=
self
.
_processPacket
(
msg
,
peer
.
prefix
)
self
.
_sendto
(
to
,
msg
[
0
:
1
]
+
answer
.
encode
()
if
answer
else
b''
,
peer
)
self
.
_sendto
(
to
,
msg
[
0
:
1
]
+
answer
if
answer
else
b''
,
peer
)
def
_processPacket
(
self
,
msg
:
bytes
,
peer
:
x509
.
Peer
|
str
=
None
):
c
=
msg
[
0
]
...
...
@@ -478,12 +477,13 @@ class BaseTunnelManager:
return
self
.
_makeTunnel
(
peer
,
msg
)
else
:
if
peer
:
# Don't send country to old nodes
if
self
.
_getPeer
(
peer
).
protocol
<
7
:
return
';'
.
join
(
','
.
join
(
a
.
split
(
','
)[:
3
])
for
a
in
';'
.
join
(
self
.
_address
.
values
()).
split
(
';'
))
return
';'
.
join
(
self
.
_address
.
values
())
return
';'
.
join
(
(
','
.
join
(
a
.
split
(
','
)[:
3
])
for
a
in
';'
.
join
(
self
.
_address
.
values
()).
split
(
';'
))
if
peer
and
# Don't send country to old nodes
self
.
_getPeer
(
peer
).
protocol
<
7
else
self
.
_address
.
values
()).
encode
()
elif
not
code
:
# network version
if
peer
:
try
:
...
...
@@ -516,14 +516,15 @@ class BaseTunnelManager:
self
.
_kill
(
peer
)
elif
code
==
4
:
# node information
if
not
msg
:
return
"%s, %s"
%
(
version
.
version
,
platform
.
platform
())
return
(
"%s, %s"
%
(
version
.
version
,
platform
.
platform
())).
encode
()
elif
code
==
5
:
# the registry wants to know the topology for debugging purpose
if
not
peer
or
peer
==
self
.
cache
.
registry_prefix
:
return
str
(
len
(
self
.
_connection_dict
))
+
''
.
join
(
' %s/%s'
%
(
int
(
x
,
2
),
len
(
x
))
for
x
in
(
self
.
_connection_dict
,
self
.
_served
)
for
x
in
x
)
for
x
in
x
)
.
encode
()
elif
code
==
7
:
# XXX: Quick'n dirty way to log in a common place.
if
peer
and
self
.
_prefix
==
self
.
cache
.
registry_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