-
Notifications
You must be signed in to change notification settings - Fork 53
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
broker: Fix parsing of listener configuration #72
base: main
Are you sure you want to change the base?
Conversation
Noted omission in the tests is anything involving SSL: this is because to do so, I'd need to create a dummy CA and certificates for test purposes. |
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 really like the direction this is taking, thanks!
tests/test_broker.py
Outdated
assert lc.address == "::" | ||
assert lc.port == 1883 | ||
|
||
|
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.
a test with an adress but no port is missing.
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.
Fair point, I'll add one.
tests/test_broker.py
Outdated
""" | ||
Test we can decode a raw port number in 'bind' | ||
""" | ||
lc = ListenerConfig(ListenerType.TCP, bind="1883") |
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 assume this is an error. As a bind without a colon would be the ip not adress? I thought.
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 considered the IP address as being optional but the port number mandatory. If the address is omitted, it follows the standard Python network library convention of meaning "bind to all interfaces" (like ::
would, but IPv6 and IPv4).
I included it as a short-hand for having to write [::]:1883
or 0.0.0.0:1883
. :1883
syntax is kept though as I figured there may be people that still rely on that syntax as a "bind all" in existing configurations.
Former as per suggestion Yakifo#72 (comment) Latter because I'm not sure how the `asyncio.create_server` and similar libraries react to being given a host name. (Maybe it does a reverse DNS look-up, maybe not… do users really want to trust that reverse DNS gets the right IP?)
That error confuses me… line 15 is blank? …and
So no idea where it's getting that from. Update… Github Actions didn't tell me this was after a merge… |
Former as per suggestion Yakifo#72 (comment) Latter because I'm not sure how the `asyncio.create_server` and similar libraries react to being given a host name. (Maybe it does a reverse DNS look-up, maybe not… do users really want to trust that reverse DNS gets the right IP?)
12fd70a
to
e29d6a7
Compare
Food for thought related to this: in my application I'm using
I'm wondering if that Anyway, probably this is in the scope of a second related pull-request. |
I've made a ticket out of your post here: #73 so we can discuss the architecture there |
The former emits the stack trace, which greatly helps in identifying _WHERE_ an exception is raised, not just WHAT the exception is.
6819ff6
to
65cb7cf
Compare
I'm revisiting old issues… and spotted this one. Things have moved ahead a lot in the I've shelved the other changes, maybe if there's interest we can cherry-pick them back in. This change set defines a function that abstracts the splitting of IP/port, handling IP addresses (v4 and v6), host names, and blank interface names; and decodes the port number to an integer. |
bind
address to both support IPv6 interfaceaddresses and to ensure the address is syntactically valid.