Enable uvloop with SOCKS5 proxy for improved performance#6
Merged
Conversation
Co-authored-by: xrh0905 <29017419+xrh0905@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve performance when using SOCKS5 outgoing proxy
Enable uvloop with SOCKS5 proxy for improved performance
Dec 9, 2025
There was a problem hiding this comment.
Pull request overview
This PR enables uvloop performance optimization for users running MTProto proxy with SOCKS5 outgoing proxy configuration. Previously, uvloop was incorrectly disabled when SOCKS5 was configured due to a mistaken incompatibility assumption.
Key Changes
- Removed the SOCKS5 check that prevented uvloop initialization in
try_setup_uvloop() - Updated warning messages and documentation to reflect that SOCKS5 is only incompatible with advertising, not uvloop
- Enables significant performance improvements for SOCKS5 proxy users without requiring code changes
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| mtprotoproxy.py | Removed SOCKS5 compatibility check from try_setup_uvloop() function (lines 2474-2481) and updated warning message to remove incorrect uvloop incompatibility claim (line 329) |
| README.md | Updated documentation to remove claims that uvloop is unavailable with SOCKS5 proxy configuration (lines 82, 136) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
uvloop was incorrectly disabled when SOCKS5 proxy was configured. Testing confirms PySocks and uvloop are fully compatible.
Changes
Impact
Users running with SOCKS5 outgoing proxy now get uvloop's event loop performance, enabling significantly higher concurrent connection capacity without code changes.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/usr/bin/python3 python3(dns block)ipv4.icanhazip.com/usr/bin/python3 python3 mtprotoproxy.py /tmp/test_socks5_config.py(dns block)ipv6.icanhazip.com/usr/bin/python3 python3 mtprotoproxy.py /tmp/test_socks5_config.py(dns block)v4.ident.me/usr/bin/python3 python3 mtprotoproxy.py /tmp/test_socks5_config.py(dns block)v6.ident.me/usr/bin/python3 python3 mtprotoproxy.py /tmp/test_socks5_config.py(dns block)www.google.com/usr/bin/python3 python3 mtprotoproxy.py /tmp/test_socks5_config.py(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.