Open nmeum opened 6 years ago
I didn't touch the test suite yet thus it obviously fails because it tries to initialize a David::Server
instead of a David::Server::CoAP
. So this needs to be fixed as well.
The commits I pushed a few minutes ago made the necessary changes to the test suite and also include a commit which ensures that the entire gem still works without tinydtls.
These commits add support for DTLS to david. Meaning we can now use CoAP over DTLS.
DTLS itself was implemented using the tinydtls rubygem which was also written by myself. The gem is currently far from finished but works good enough to integrate it into david. The gem itself is simply a wrapper for the tinydtls C library but currently requires a few patches to that library. I am working with the tinydtls maintainer to change that.
Regarding the integration into david, I followed the multi protocol server structure used by the celluloid HTTP server (reel).
Design decisions are further documented in the commit messages but basically this introduces two new
David::Server
classes: One for CoAP and one for CoAPs. Other celluloid actors (e.g. the garbage collector) had to be adjusted to perform their operations on both of these new server objects.Currently dual stack is supported meaning CoAP and CoAPs can be used at the same time. The CoAPs server is entirely optional though and disabled by default.
A few thing still need be done regarding the integration into david. I will point those out using inline comments. Besides I need to test this further, so for I have only done tests using the provided
config.ru
file.CC: @obgm