-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Extract a DTLSConn interface to wrap dtls.Conn
#3343
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
base: master
Are you sure you want to change the base?
Extract a DTLSConn interface to wrap dtls.Conn
#3343
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3343 +/- ##
==========================================
- Coverage 84.98% 84.94% -0.04%
==========================================
Files 80 80
Lines 9510 9541 +31
==========================================
+ Hits 8082 8105 +23
- Misses 1004 1013 +9
+ Partials 424 423 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
LGTM! What do you think about not exporting this? Do you want this for tests/prototyping WARP in this repo or outside also? |
|
I need it to be exported so I can use it from TC, but happy to mark it as experimental if you're worried about committing to the specific interface shape |
|
I can’t make it experimental unfortunately. If we API break (even if no one uses code) some automation downstream forces me to bump or revert. I’m just trying to save myself heart ache! If you need this API public works for me. I thought this was just going to be for tests/internal use. Would a go.mod replace work for your use case? If you want an alternative dtls implementation this is what I did for project that had to use OS crypto |
|
Hmm. The dtls.Conn class has a wider interface, so that's not ideal. I could refactor that class slightly, but would that be a breaking change on its own? Or maybe I could just add a method and that would be OK (as I'd just replace the methods pion/webrtc needs?) |
|
FWIW, I think this sort of indirection is nice in general, it gives the developer a lot of flexibility, so I still think the interface is the best path forward. It's tricky though if you have to get the interface right on the first try... |
|
You just need to implement the methods pion/webrtc needs. You can have your own pion/dtls stub that uses openssl and just a relative path in mod replace. If it’s not possible totally in support of merging. It’s just this has to stay forever, and no one is going to use it after DTLS 1.3 is done. |
|
OK. Let me do a tiny PR against dtls that adds a new method for key extraction, and then I can try the go.mod swap. |
Description
This PR allows for runtime replacement of the
dtls.Connimplementation from pion/dtls with a test or injected implementation. It defines a newDTLSConninterface, along with a factory function for creating aDTLSConnwhich can be specified inSettingEngine.By default, a
DTLSConnbased ondtls.Connis created, and for the most part, theDTLSConnmethods are straight thunks todtls.Conn. The one exception is the key extractor method, which callsConnectionState()and then returns aKeyingMaterialExporter, which is the only data that pion/webrtc needs fromConnectionState().lint passes, tests pass