commit c93d137c5edbbdd16f5f960c6bf50a48703261b6
parent c40468a8d3d8111f1ef11d26200add4c26c16e12
Author: SomberNight <somber.night@protonmail.com>
Date: Thu, 13 Sep 2018 01:20:20 +0200
interface: minor clean-up split out _set_proxy from init
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/electrum/interface.py b/electrum/interface.py
@@ -139,6 +139,7 @@ class Interface(PrintError):
self.cert_path = os.path.join(self.config_path, 'certs', self.host)
self.blockchain = None
self.network = network
+ self._set_proxy(proxy)
self.tip_header = None
self.tip = 0
@@ -147,6 +148,10 @@ class Interface(PrintError):
self.fut = asyncio.get_event_loop().create_task(self.run())
self.group = SilentTaskGroup()
+ def diagnostic_name(self):
+ return self.host
+
+ def _set_proxy(self, proxy: dict):
if proxy:
username, pw = proxy.get('user'), proxy.get('password')
if not username or not pw:
@@ -158,13 +163,10 @@ class Interface(PrintError):
elif proxy['mode'] == "socks5":
self.proxy = aiorpcx.socks.SOCKSProxy((proxy['host'], int(proxy['port'])), aiorpcx.socks.SOCKS5, auth)
else:
- raise NotImplementedError # http proxy not available with aiorpcx
+ raise NotImplementedError # http proxy not available with aiorpcx
else:
self.proxy = None
- def diagnostic_name(self):
- return self.host
-
async def is_server_ca_signed(self, sslc):
try:
await self.open_session(sslc, exit_early=True)