tor can now be attached
parent
ea47ae456b
commit
cd671feb92
|
@ -23,8 +23,8 @@ def create_onion_service(port=80):
|
||||||
controller = get_controller()
|
controller = get_controller()
|
||||||
hs = controller.create_ephemeral_hidden_service(
|
hs = controller.create_ephemeral_hidden_service(
|
||||||
{80: port},
|
{80: port},
|
||||||
key_type='NEW',
|
key_type = 'NEW',
|
||||||
key_content='ED25519-V3',
|
key_content = 'ED25519-V3',
|
||||||
await_publication=True,
|
await_publication=True,
|
||||||
detached=True)
|
detached=True)
|
||||||
return (hs.service_id, hs.private_key)
|
return (hs.service_id, hs.private_key)
|
||||||
|
|
|
@ -114,7 +114,10 @@ def daemon():
|
||||||
|
|
||||||
if use_existing_tor:
|
if use_existing_tor:
|
||||||
net.socksPort = config.get('tor.existing_socks_port')
|
net.socksPort = config.get('tor.existing_socks_port')
|
||||||
net.myID = create_onion_service(port=get_open_port())
|
net.myID = create_onion_service(
|
||||||
|
port=net.apiServerIP + ':' + str(net.hsPort))[0]
|
||||||
|
if not net.myID.endswith('.onion'):
|
||||||
|
net.myID += '.onion'
|
||||||
with open(filepaths.tor_hs_address_file, 'w') as tor_file:
|
with open(filepaths.tor_hs_address_file, 'w') as tor_file:
|
||||||
tor_file.write(net.myID)
|
tor_file.write(net.myID)
|
||||||
else:
|
else:
|
||||||
|
@ -141,6 +144,11 @@ def daemon():
|
||||||
|
|
||||||
if not offline_mode and not use_existing_tor:
|
if not offline_mode and not use_existing_tor:
|
||||||
net.killTor()
|
net.killTor()
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
os.remove(filepaths.tor_hs_address_file)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
better_sleep(5)
|
better_sleep(5)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue