require caller to provide relay, no more default

Applications should feel free to pass wormhole.const.RENDEZVOUS_RELAY
here, but I figure it should be clear that you're using a public service
that's hosted *somewhere* external.
This commit is contained in:
Brian Warner 2015-03-22 11:53:48 -07:00
parent fd3e4f3508
commit 7c5cb058a2

View File

@ -5,7 +5,7 @@ from spake2 import SPAKE2_A, SPAKE2_B
from nacl.secret import SecretBox from nacl.secret import SecretBox
from nacl.exceptions import CryptoError from nacl.exceptions import CryptoError
from nacl import utils from nacl import utils
from .. import codes, const from .. import codes
from ..util.hkdf import HKDF from ..util.hkdf import HKDF
SECOND = 1 SECOND = 1
@ -167,10 +167,10 @@ class Common:
return HKDF(self.key, length, CTXinfo=purpose) return HKDF(self.key, length, CTXinfo=purpose)
class Initiator(Common): class Initiator(Common):
def __init__(self, appid, data, relay=None): def __init__(self, appid, data, relay):
self.appid = appid self.appid = appid
self.data = data self.data = data
self.relay = relay or const.RENDEZVOUS_RELAY self.relay = relay
assert self.relay.endswith("/") assert self.relay.endswith("/")
self.started = time.time() self.started = time.time()
self.wait = 0.5*SECOND self.wait = 0.5*SECOND
@ -207,10 +207,10 @@ class Initiator(Common):
class Receiver(Common): class Receiver(Common):
def __init__(self, appid, data, relay=None): def __init__(self, appid, data, relay):
self.appid = appid self.appid = appid
self.data = data self.data = data
self.relay = relay or const.RENDEZVOUS_RELAY self.relay = relay
assert self.relay.endswith("/") assert self.relay.endswith("/")
self.started = time.time() self.started = time.time()
self.wait = 0.5*SECOND self.wait = 0.5*SECOND