Resolve the conflict between socks proxy and i2p

by preventing their simultaneous use.
This commit is contained in:
Lee Miller 2023-06-06 00:22:37 +03:00
parent b26cf7322d
commit 7b62a7b14a
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63
1 changed files with 7 additions and 1 deletions

View File

@ -84,7 +84,8 @@ def parse_arguments(): # pylint: disable=too-many-branches,too-many-statements
if args.no_ip:
shared.ip_enabled = False
if args.trusted_peer:
if len(args.trusted_peer) > 50:
if len(args.trusted_peer
) > 50 and not args.trusted_peer.endswith('onion'):
# I2P
shared.trusted_peer = (args.trusted_peer.encode(), 'i2p')
else:
@ -259,6 +260,11 @@ def main():
shared.data_directory, exc_info=True)
if shared.socks_proxy:
if shared.i2p_enabled:
logging.error(
'Unfortunately you cannot use both I2P and SOCKS proxy.')
return
# FIXME: the Connection() code would be too complex
# without this monkeypatching
def create_connection(