Hook up NURL generation to the new Foolscap/HTTPS protocol switch.

This commit is contained in:
Itamar Turner-Trauring
2022-07-20 15:12:00 -04:00
parent 5e0c32708b
commit 11f4ebc0d9
4 changed files with 52 additions and 51 deletions

View File

@ -37,6 +37,7 @@ import allmydata
from allmydata.crypto import rsa, ed25519
from allmydata.crypto.util import remove_prefix
from allmydata.storage.server import StorageServer, FoolscapStorageServer
from allmydata.storage.http_server import build_nurl
from allmydata import storage_client
from allmydata.immutable.upload import Uploader
from allmydata.immutable.offloaded import Helper
@ -658,6 +659,12 @@ class _Client(node.Node, pollmixin.PollMixin):
if webport:
self.init_web(webport) # strports string
# TODO this may be the wrong location for now? but as temporary measure
# it allows us to get NURLs for testing in test_istorageserver.py Will
# eventually get fixed one way or another in
# https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3901
self.storage_nurls = []
def init_stats_provider(self):
self.stats_provider = StatsProvider(self)
self.stats_provider.setServiceParent(self)
@ -820,6 +827,15 @@ class _Client(node.Node, pollmixin.PollMixin):
furl = self.tub.registerReference(FoolscapStorageServer(ss), furlFile=furl_file)
(_, _, swissnum) = furl.rpartition("/")
self.tub.negotiationClass.add_storage_server(ss, swissnum.encode("ascii"))
for location_hint in self.tub.locationHints:
if location_hint.startswith("tcp:"):
_, hostname, port = location_hint.split(":")
port = int(port)
self.storage_nurls.append(
build_nurl(
hostname, port, swissnum, self.tub.myCertificate.original.to_cryptography()
)
)
announcement["anonymous-storage-FURL"] = furl