Closed hasheddan closed 1 year ago
Patch coverage: 83.48%
and project coverage change: +0.21%
:tada:
Comparison is base (
a1d270f
) 76.75% compared to head (ed08ac1
) 76.97%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Pretty cool! I like the docker stuff! Is it possible to start a server only with the docker image? And to try some handshakes with clients using other implementations?
Pretty cool! I like the docker stuff! Is it possible to start a server only with the docker image? And to try some handshakes with clients using other implementations?
Right now we only use Docker for the E2E CI tests, and they start a specific subset of tests using a build tag. However, you can look at examples/listen
for how to start a server using this library to handle DTLS. Since it's Go the resulting binary can be copied into a tiny base image.
So, very crudely, it could be along the lines of:
# Start by building the application.
FROM golang:1.20 as build
WORKDIR /go/src/app
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 go build examples/listen/verify -o /go/bin/verify
# Now copy it into our base image.
FROM gcr.io/distroless/static-debian11
COPY --from=build /go/bin/verify /
CMD ["/verify"]
The only thing you'd really have to do is adapt the accept loop.
So, very crudely, it could be along the lines of:
That results on "my machine" in:
package examples/listen/verify is not in GOROOT (/usr/local/go/src/examples/listen/verify)
malformed import path "-o": leading dash
stat /go/bin/verify: directory not found
I'm no GO user, so I'll just wait for others results.
@boaks apologies for the delay here! I have put together a test server and image that can be found at https://github.com/hasheddan/dtls-interop/tree/pion/dtls/cid/pion/cid_server. I will continue building this out with more functionality as I test against DTLS implementations. There are instructions for building and running the container image, and I have also pushed a preliminary version to DockerHub at hasheddan/dtls-interop-pion-cid-server.
The test server is setup to work out of the box with the example californium DTLS client. I tested by running the following and then executing the californium DTLS client.
docker run --rm --net host hasheddan/dtls-interop-pion-cid-server
The resulting packet capture can be found here. Please let me know if there is anything else I can do to help assist in your testing!
Very nice! I've tested it with an mbedtls client successfully.
The resulting packet capture can be found here.
Just to mention, as in my WikiPage for Captures: if the capture is compressed, it can be uploaded to a git comment just by drag&drop.
Please let me know if there is anything else I can do to help assist in your testing!
Thanks. For now, I only test the basic interoperability. That looks pretty good.
Description
Implements DTLS 1.2 Connection ID support as defined in https://datatracker.ietf.org/doc/html/rfc9146.
Remaining work:
cbc
andccm
suites to support Connection IDsNotes for early reviewers:
Currently, if you want an endpoint to be able to update its remote address, you need to implement a custom
Listener
that uses connection ID's rather than remote address to determine whatPacketServer
to route packets to. This functionality is dependent onpion/transport/udp
, and I demonstrated what an example could look like in https://github.com/pion/transport/pull/252. However, as mentioned on that PR, the intention is to move the functionality to live here inpion/dtls
, and I am in progress of doing so. We could feasibly make that a separate PR given that this one is "feature complete" in that it can successfully negotiate and use connection IDs as both a client and server (as demonstrated by the new e2e tests). Either way, the UDP connection package needs to be added in this PR or a subsequent one.Another area of interest is automated testing against other libraries. The current OpenSSL tests cannot be expanded for this use-case as it does not support connection IDs. I have performed manual validation by expanding the DTLS client example in mbedTLS as demonstrated here: https://github.com/Mbed-TLS/mbedtls/compare/development...hasheddan:mbedtls:feat/cid-example. I would like to expand the e2e testing suite in this repository to include mbedTLS with connection IDs enabled, though we will need to build our own client, which could also be deferred to a subsequent PR.
An area that I do not anticipate expanding scope of this PR to cover quite yet is saving connection state. For my particular use-case is is vital that we able to persist connection state across server restarts. Note that this is different from saving sessions as connection IDs must actually be renegotiated upon session resumption, whereas ideally with connection IDs enabled a server could continue receiving from an endpoint after restart by recovering all state. I would like to ensure this functionality is enabled prior to cutting a
v3
release as I believe it could result in breaking changes.Lastly, I am in progress of increasing unit test coverage across the board, though it is not anticipated that this will result in any functional changes to what is currently implemented as it is already being validated through existing unit tests (testing with connection IDs not enabled), as well as e2e test.
Testing Locally
If reviewers would like to experiment with enabling connection IDs locally, you can use the following commands to only run the
CID
e2e tests.Using the host's network namespace allows you to capture on the loopback interface in wireshark. Using the
dtls
filter will help eliminate other noise. Your output should look something like the following:Reference issue
Fixes #256 Fixes #367