nning / david

CoAP server with Rack interface.
MIT License
37 stars 11 forks source link

[WIP] Support for DTLS #16

Open nmeum opened 6 years ago

nmeum commented 6 years ago

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

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.5%) to 92.446% when pulling 62dfe6d627476d33e3c4577f1f85d2b8ea73ccdb on ruby-dtls:dtls-support into b596345aa50dc61ffedd36b7afa0054d710b627c on nning:master.

nmeum commented 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.

nmeum commented 6 years ago

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.