-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support connections through SOCKS5 proxies #153
base: master
Are you sure you want to change the base?
Conversation
Implement support for SOCKS5 proxies. Implement a new proxy wrapper that handles SOCKS5 connection, authentication and requesting connections to the actual Kafka broker endpoints. The proxy can be configured via a new keyword argument `socks5_proxy` to consumers, producers or admin client. The value is URL with optional username and password. E.g. `socks5://user:[email protected]:10800` The implementation is done in state machine that makes progress on repeated calls to connect_ex. The rationale with this bit strange design is to minimize amount of changes on the actual BrokerConnection object.
if self.config["socks5_proxy"] is not None: | ||
self._socks5_proxy = Socks5Wrapper(self.config["socks5_proxy"], self.afi) | ||
self._sock = self._socks5_proxy.socket(self._sock_afi, socket.SOCK_STREAM) | ||
else: | ||
self._sock = socket.socket(self._sock_afi, socket.SOCK_STREAM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the cleanest way to go about including this functionality, but a feature added is better than a feature removed...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see some tests for this ultimately before merging this.
Implement support for SOCKS5 proxies. Implement a new proxy wrapper that handles SOCKS5 connection, authentication and requesting connections to the actual Kafka broker endpoints.
The proxy can be configured via a new keyword argument
socks5_proxy
to consumers, producers or admin client. The value is URL with optional username and password. E.g.socks5://user:[email protected]:10800
The implementation is done in state machine that makes progress on repeated calls to connect_ex. The rationale with this bit strange design is to minimize amount of changes on the actual BrokerConnection object.
This change is