Gracefully avoid sending the client_auth_v3 argument to Stem's create_ephemeral_hidden_service() if the version of Stem we're on does not yet support it

This commit is contained in:
Miguel Jacq 2021-05-06 14:35:11 +10:00
parent 80cc1f43e8
commit e4465435fa

View file

@ -663,14 +663,23 @@ class Onion(object):
client_auth_v3_pub_key = None client_auth_v3_pub_key = None
try: try:
res = self.c.create_ephemeral_hidden_service( if not self.supports_stealth:
{80: port}, res = self.c.create_ephemeral_hidden_service(
await_publication=await_publication, {80: port},
basic_auth=None, await_publication=await_publication,
key_type=key_type, basic_auth=None,
key_content=key_content, key_type=key_type,
client_auth_v3=client_auth_v3_pub_key, key_content=key_content,
) )
else:
res = self.c.create_ephemeral_hidden_service(
{80: port},
await_publication=await_publication,
basic_auth=None,
key_type=key_type,
key_content=key_content,
client_auth_v3=client_auth_v3_pub_key,
)
except ProtocolError as e: except ProtocolError as e:
print("Tor error: {}".format(e.args[0])) print("Tor error: {}".format(e.args[0]))