-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
Proxy and ip decoder #334
Proxy and ip decoder #334
Conversation
…nd ip setting at nextBatch
…still errored, why ?)
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.
Thanks and good work! I've left a few note.
Indeed, it will be a good feature to add.
…decodeProtocol (by default) if broker.trustProxy & before client.connackSent; update tests and doc
Good work! A couple of things:
|
Concerning the CI, i noticed that test failures happened with node v12.13.1 and the same happens locally on my computer and they also appear on the master branch. For the split, you think of one chunk containing the proxy protocol and the other containing the mqtt packet ? Before the parsing ? |
I mean if the proxy protocol header is split into 2 chunks. Are there some guarantees this cannot happen? |
Quote from : https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt Still it might depend on the proxy configuration i suppose. There are no guarantee that this cannot happen, so the connection to aedes should be dropped or delayed until the proxy header is complete ? |
Given on that text, I think this is ok and I was worrying for nothing. |
…for failing tests
Hey,
I'm using this project very often and i noticed that having a nice ipAddress property might be useful for me and other users ( to use in preConnect hook for example ).
Since it's important to have a correct information, i thought it would be interesting to add a trustProxy property to the broker. Then if aedes is placed behind load balancer / proxy, we could use http headers (x-real-ip / x-forwarded-for ) in case of websocket connection or proxy protocol in case of tcp socket.
So i implemented proxy-protocol-js to test incoming client's buffer and to try retrieving source ip address.
I've been adding an example and some tests.
Please let me know if this feature is useful and not out of the scope of aedes.