-from base64 import b32encode
import os.path, re
+from base64 import b32decode, b32encode
import twisted
from twisted.python import log
self.tub = Tub(certFile=certfile)
self.tub.setOption("logLocalFailures", True)
self.tub.setOption("logRemoteFailures", True)
- # I think self.nodeid is kind of whacked. Shouldn't it equal the
- # fingerprint portion of our furl?
- self.nodeid = b32encode(self.tub.tubID).lower()
+ self.nodeid = b32decode(self.tub.tubID.upper()) # binary format
f = open(os.path.join(self.basedir, self.NODEIDFILE), "w")
f.write(b32encode(self.nodeid).lower() + "\n")
f.close()
- self.short_nodeid = self.tub.tubID[:4] # ready for printing
+ self.short_nodeid = b32encode(self.nodeid).lower()[:8] # ready for printing
assert self.PORTNUMFILE, "Your node.Node subclass must provide PORTNUMFILE"
self._portnumfile = os.path.join(self.basedir, self.PORTNUMFILE)
try:
+from base64 import b32decode, b32encode
import os
from cStringIO import StringIO
from twisted.trial import unittest
"I didn't see the right 'connected peers' message "
"in: %s" % page
)
- expected = "My nodeid: <span>%s</span>" % idlib.b2a(self.clients[0].nodeid)
+ expected = "My nodeid: <span>%s</span>" % (b32encode(self.clients[0].nodeid).lower(),)
self.failUnless(expected in page,
"I didn't see the right 'My nodeid' message "
"in: %s" % page)
+from base64 import b32decode, b32encode
import os.path
from twisted.application import service, strports
from twisted.web import static, resource, server, html, http
(v['allmydata'], v['zfec'], v['foolscap'], v['twisted'])
def data_my_nodeid(self, ctx, data):
- return idlib.b2a(IClient(ctx).nodeid)
+ return b32encode(IClient(ctx).nodeid).lower()
def data_introducer_furl(self, ctx, data):
return IClient(ctx).introducer_furl
def data_connected_to_introducer(self, ctx, data):
d = []
client = IClient(ctx)
for nodeid in sorted(client.get_all_peerids()):
- row = (idlib.b2a(nodeid),)
+ row = (b32encode(nodeid).lower(),)
d.append(row)
return d