Commit 8e3cc1ea authored by Julien Muchembled's avatar Julien Muchembled

Clarify description of protocol between nodes

parent 9be8cf80
...@@ -372,7 +372,7 @@ class BaseTunnelManager(object): ...@@ -372,7 +372,7 @@ class BaseTunnelManager(object):
self._makeTunnel(peer, msg) self._makeTunnel(peer, msg)
else: else:
return ';'.join(self._address.itervalues()) return ';'.join(self._address.itervalues())
elif not code: # ver elif not code: # network version
if peer: if peer:
try: try:
if msg == self._version: if msg == self._version:
...@@ -402,7 +402,7 @@ class BaseTunnelManager(object): ...@@ -402,7 +402,7 @@ class BaseTunnelManager(object):
else: else:
if code == 3 and tunnel_killer.state == 'locked': # response if code == 3 and tunnel_killer.state == 'locked': # response
self._kill(peer) self._kill(peer)
elif code == 4: elif code == 4: # node information
if not msg: if not msg:
return version.version return version.version
elif code == 5: elif code == 5:
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import calendar, hashlib, hmac, logging, os, struct, subprocess, threading, time import calendar, hashlib, hmac, logging, os, struct, subprocess, threading, time
from collections import deque
from datetime import datetime from datetime import datetime
from OpenSSL import crypto from OpenSSL import crypto
from . import utils from . import utils
...@@ -164,12 +163,12 @@ class Peer(object): ...@@ -164,12 +163,12 @@ class Peer(object):
hello0: 0, A hello0: 0, A
1, fingerprint(B), A 1, fingerprint(B), A
hello: 2, X = E(B)(secret), S(A)(X) hello: 2, X = encrypt(B, secret), sign(A, X)
!hello: #, ver, type, value, HMAC(secret)(payload) !hello: #, type, value, hmac(secret, payload)
└──── payload ────┘ └── payload ──┘
new secret > old secret new secret > old secret
(concat timestamp with random bits) (timestamp + random bits)
Reject messages with # smaller or equal than previously processed. Reject messages with # smaller or equal than previously processed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment