Closed thomas725 closed 4 months ago
is that available through the forward struct?
Nope. IP+port is not there. In MQTT, subscribers don't know information about the publishers ( & vice versa ).
If you wish, you can either:
thanks for the reply. I'm only using MQTT to integrate some old "legacy" devices I can't (or don't want to) modify anymore into my current smart home setup, so I can't modify the topics / payload.
For now I'll live with the fact that I can't tell the source of those metrics, and if it bugs me more than now sometime in the future I'll maybe try to implement a more naive mqtt server myself that just processes the topic update packages directly instead of having this internal subscribe logic that doesn't pass through the ip+port source of the update package as I'm having with your library.
But big thanks for the reply and for maintaining this library :)
Incase you want to modify rumqttd to do so, here you are getting the addr
( which will be socket address ), for now we just log it. You can get IP from there.
you can pass it to remote
fn ( and then to router, via modifying connect packet or directly ).
But this won't still be there in Forwards
ig, you might need to modify all incoming packets to have that info ( depends on your use case ).
I'd like to get the source ip (+port) of who sent an mqtt topic change, is that available through the forward struct? Or is there some other way I'd need to subscribe to updates than this: https://gitlab.com/thomas351/rust-influxdb-udp-logger/-/blob/main/src/mqtt_relay.rs#L45
This is no bug report, just a question how to use your library, I hope it's okey to post this as an issue entry here. If there's some other preferred channel for asking questions please point me to it.
I'm debating with myself weather I should ditch the library usage and just open a TCP listener for the 1883 MQTT port myself, but I have no idea of how complex the protocol is (and am not too keen to find out ;)) - though that would save me a few MB of binary size and would make it trivial to get source ip & port.