Skip to content
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

Add port settings for proxy settings #348

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions aiomqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ def __init__( # noqa: PLR0913
*,
proxy_type: int,
proxy_addr: str,
proxy_port: int,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since proxy_port is an optional parameter to the underlying paho-mqtt client, it should be:

proxy_port: Optional[int] = None

and since the default proxy port changes based on proxy type, it needs to only be included in the proxy_args only if specified.

self.proxy_args = {
.
.
.
}
if proxy_port is not None:
    self.proxy_args['proxy_port'] = proxy_port

proxy_rdns: bool | None = True,
proxy_username: str | None = None,
proxy_password: str | None = None,
) -> None:
self.proxy_args = {
"proxy_type": proxy_type,
"proxy_addr": proxy_addr,
"proxy_port": proxy_port,
"proxy_rdns": proxy_rdns,
"proxy_username": proxy_username,
"proxy_password": proxy_password,
Expand Down