From d1906a4bcb82a10f92a2c17b56e55e46659a6247 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 3 Jul 2021 12:53:45 +0000 Subject: [PATCH] rpc.py: SOCKS proxy: use remote DNS, support Tor onion addresses --- mmgen/rpc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mmgen/rpc.py b/mmgen/rpc.py index fbf8c2c0..8c5971b4 100755 --- a/mmgen/rpc.py +++ b/mmgen/rpc.py @@ -107,8 +107,8 @@ class RPCBackends: self.session.auth = getattr(requests.auth,auth)(*caller.auth) if self.proxy: self.session.proxies.update({ - 'http': f'socks5://{self.proxy}', - 'https': f'socks5://{self.proxy}' + 'http': f'socks5h://{self.proxy}', + 'https': f'socks5h://{self.proxy}' }) async def run(self,payload,timeout,wallet): @@ -182,7 +182,7 @@ class RPCBackends: dmsg_rpc('\n RPC PAYLOAD data (curl) ==>\n{}\n',payload) exec_cmd = [ 'curl', - '--proxy', f'socks5://{self.proxy}' if self.proxy else '', + '--proxy', f'socks5h://{self.proxy}' if self.proxy else '', '--connect-timeout', str(timeout or self.timeout), '--write-out', '%{http_code}', '--data-binary', data @@ -674,6 +674,8 @@ class MoneroRPCClient(RPCClient): from .obj import IPPort self.proxy = IPPort(proxy) test_connection = False + if host.endswith('.onion'): + network_proto = 'http' super().__init__(host,port,test_connection) if self.auth_type: self.auth = auth_data(user,passwd)