Commit 2c8212d2 authored by Matt Traudt's avatar Matt Traudt Committed by juga
Browse files

Add ed25519_master_key to results; bump result version to 3

node_id=$B058ABB695524A11D0FE958C0F8AA7963FD4258C bw=5685 nick=exit2 rtt=139 time=2018-06-08T01:06:27 ed25519=g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s
parent 3d47a3b0
......@@ -4,7 +4,7 @@ import socket
log = logging.getLogger(__name__)
RESULT_VERSION = 2
RESULT_VERSION = 3
WIRE_VERSION = 1
SPEC_VERSION = '1.1.0'
......
......@@ -150,14 +150,15 @@ class Result:
class Relay:
''' Implements just enough of a stem RouterStatusEntryV3 for this
Result class to be happy '''
def __init__(self, fingerprint, nickname, address):
def __init__(self, fingerprint, nickname, address, ed25519_master_key):
self.fingerprint = fingerprint
self.nickname = nickname
self.address = address
self.ed25519_master_key = ed25519_master_key
def __init__(self, relay, circ, dest_url, scanner_nick, t=None):
self._relay = Result.Relay(relay.fingerprint, relay.nickname,
relay.address)
relay.address, relay.ed25519_master_key)
self._circ = circ
self._dest_url = dest_url
self._scanner = scanner_nick
......@@ -179,6 +180,10 @@ class Result:
def address(self):
return self._relay.address
@property
def ed25519_master_key(self):
return self._relay.ed25519_master_key
@property
def circ(self):
return self._circ
......@@ -204,6 +209,7 @@ class Result:
'fingerprint': self.fingerprint,
'nickname': self.nickname,
'address': self.address,
'ed25519_master_key': self.ed25519_master_key,
'circ': self.circ,
'dest_url': self.dest_url,
'time': self.time,
......@@ -275,7 +281,9 @@ class ResultError(Result):
def from_dict(d):
assert isinstance(d, dict)
return ResultError(
Result.Relay(d['fingerprint'], d['nickname'], d['address']),
Result.Relay(
d['fingerprint'], d['nickname'], d['address'],
d['ed25519_master_key']),
d['circ'], d['dest_url'], d['scanner'],
msg=d['msg'], t=d['time'])
......@@ -314,7 +322,9 @@ class ResultErrorCircuit(ResultError):
def from_dict(d):
assert isinstance(d, dict)
return ResultErrorCircuit(
Result.Relay(d['fingerprint'], d['nickname'], d['address']),
Result.Relay(
d['fingerprint'], d['nickname'], d['address'],
d['ed25519_master_key']),
d['circ'], d['dest_url'], d['scanner'],
msg=d['msg'], t=d['time'])
......@@ -335,7 +345,9 @@ class ResultErrorStream(ResultError):
def from_dict(d):
assert isinstance(d, dict)
return ResultErrorStream(
Result.Relay(d['fingerprint'], d['nickname'], d['address']),
Result.Relay(
d['fingerprint'], d['nickname'], d['address'],
d['ed25519_master_key']),
d['circ'], d['dest_url'], d['scanner'],
msg=d['msg'], t=d['time'])
......@@ -369,7 +381,9 @@ class ResultErrorAuth(ResultError):
def from_dict(d):
assert isinstance(d, dict)
return ResultErrorAuth(
Result.Relay(d['fingerprint'], d['nickname'], d['address']),
Result.Relay(
d['fingerprint'], d['nickname'], d['address'],
d['ed25519_master_key']),
d['circ'], d['dest_url'], d['scanner'],
msg=d['msg'], t=d['time'])
......@@ -401,7 +415,9 @@ class ResultSuccess(Result):
assert isinstance(d, dict)
return ResultSuccess(
d['rtts'], d['downloads'],
Result.Relay(d['fingerprint'], d['nickname'], d['address']),
Result.Relay(
d['fingerprint'], d['nickname'], d['address'],
d['ed25519_master_key']),
d['circ'], d['dest_url'], d['scanner'],
t=d['time'])
......
Supports Markdown
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