mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 10:15:20 +00:00
interface: clean-up proxy username/pw handling
This commit is contained in:
parent
6700364ac8
commit
a4ffa0b22a
1 changed files with 4 additions and 9 deletions
|
@ -62,16 +62,11 @@ class Interface(PrintError):
|
|||
self.blockchain = None
|
||||
self.network = network
|
||||
if proxy:
|
||||
proxy['user'] = proxy.get('user', '')
|
||||
if proxy['user'] == '':
|
||||
proxy['user'] = 'sampleuser' # aiorpcx doesn't allow empty user
|
||||
proxy['password'] = proxy.get('password', '')
|
||||
if proxy['password'] == '':
|
||||
proxy['password'] = 'samplepassword'
|
||||
try:
|
||||
auth = aiorpcx.socks.SOCKSUserAuth(proxy['user'], proxy['password'])
|
||||
except KeyError:
|
||||
username, pw = proxy.get('user'), proxy.get('password')
|
||||
if not username or not pw:
|
||||
auth = None
|
||||
else:
|
||||
auth = aiorpcx.socks.SOCKSUserAuth(username, pw)
|
||||
if proxy['mode'] == "socks4":
|
||||
self.proxy = aiorpcx.socks.SOCKSProxy((proxy['host'], int(proxy['port'])), aiorpcx.socks.SOCKS4a, auth)
|
||||
elif proxy['mode'] == "socks5":
|
||||
|
|
Loading…
Add table
Reference in a new issue