tor can now be attached
This commit is contained in:
		
							parent
							
								
									ea47ae456b
								
							
						
					
					
						commit
						cd671feb92
					
				
					 2 changed files with 11 additions and 3 deletions
				
			
		|  | @ -23,8 +23,8 @@ def create_onion_service(port=80): | |||
|     controller = get_controller() | ||||
|     hs = controller.create_ephemeral_hidden_service( | ||||
|         {80: port}, | ||||
|         key_type='NEW', | ||||
|         key_content='ED25519-V3', | ||||
|         key_type = 'NEW', | ||||
|         key_content = 'ED25519-V3', | ||||
|         await_publication=True, | ||||
|         detached=True) | ||||
|     return (hs.service_id, hs.private_key) | ||||
|  |  | |||
|  | @ -114,7 +114,10 @@ def daemon(): | |||
| 
 | ||||
|         if use_existing_tor: | ||||
|             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: | ||||
|                 tor_file.write(net.myID) | ||||
|         else: | ||||
|  | @ -141,6 +144,11 @@ def daemon(): | |||
| 
 | ||||
|     if not offline_mode and not use_existing_tor: | ||||
|         net.killTor() | ||||
|     else: | ||||
|         try: | ||||
|             os.remove(filepaths.tor_hs_address_file) | ||||
|         except FileNotFoundError: | ||||
|             pass | ||||
| 
 | ||||
|     better_sleep(5) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue