mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
interface: minor clean-up split out _set_proxy from init
This commit is contained in:
parent
c40468a8d3
commit
c93d137c5e
1 changed files with 6 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue