plgd-dev / go-coap

Implementation of CoAP Server & Client in Go
https://coap.technology
Apache License 2.0
447 stars 116 forks source link

Incoming interface #493

Closed HRogge closed 11 months ago

HRogge commented 1 year ago

When building lowlevel network services with multiple interfaces, its often useful or even necessary to know the specific interface from which a Message was received from. This change uses the already existing packagecon in connUDP to get the interface from the operation system and stores it in the Message.

HRogge commented 1 year ago

I like the solution in https://github.com/plgd-dev/go-coap/tree/jkralik/feature/udp-propagate-interface

HRogge commented 1 year ago

@jkralik I tried to see if your feature branch provides what I need, but I got a compiler error net/dtlslistener.go:124

HRogge commented 1 year ago

want me to change this change to return the ControlMessage instead of interface index?

Danielius1922 commented 1 year ago

want me to change this change to return the ControlMessage instead of interface index?

Sorry @HRogge we are working on a release and some urgent bugs, hopefully everything will get sorted by the end of the week, we will check your work once we're finished with that. Thank you for your patience.

jkralik commented 1 year ago

want me to change this change to return the ControlMessage instead of interface index?

@HRogge Absolutely, the control message is more general than the interface. Could you please enhance the content at https://github.com/plgd-dev/go-coap/tree/jkralik/feature/udp-propagate-interface and prepare it for merging 🙏 ?

HRogge commented 1 year ago

want me to change this change to return the ControlMessage instead of interface index?

@HRogge Absolutely, the control message is more general than the interface. Could you please enhance the content at https://github.com/plgd-dev/go-coap/tree/jkralik/feature/udp-propagate-interface and prepare it for merging 🙏 ?

This branch works for me, I successfully get the interface index from the message. No enhancement necessary from my point of view.

There is something strange going on with the dependency on pion/transport/v2 (or v3)... but this might be a local problem of my installation. go-coap go.mod says "import pion/transport/v2", but my application which is using go-coap indirectly imports "pion/transport/v3", which results in a compilation error in net/dtlslistener.go

HRogge commented 1 year ago

Difficulties with pion-transport dependency go away when I merge the current master into https://github.com/plgd-dev/go-coap/tree/jkralik/feature/udp-propagate-interface

I still successfully get the incoming interface value in my application.

HRogge commented 11 months ago

@jkralik any timeline when/if you want to merge jkralik/feature/udp-propagate-interface? I don't know at which part the branch is lacking, the feature that I tried to introduce with this PR is already present and working in your branch.

jkralik commented 11 months ago

Closing the PR because the feature has been implemented by #510