icerpc / icerpc-csharp

A C# RPC framework built for QUIC, with bidirectional streaming, first-class async/await, and Protobuf support.
https://docs.icerpc.dev
Apache License 2.0
101 stars 13 forks source link

QUIC transport template option added to `IceRpc-Slice-Server` and `IceRpc-Slice-Client` #3955

Closed ReeceHumphreys closed 5 months ago

ReeceHumphreys commented 5 months ago

Closes #3954

This PR adds a new --transport flag to the IceRpc-Slice-Server and IceRpc-Slice-Client templates. By default this flag is set to slic but you can set it to quic. When set to quic it will modify the output of the template to produce a QUIC version of the template. For ease of review I have also attached the output from running:

dotnet new icerpc-slice-server -o slic-server
dotnet new icerpc-slice-client -o slic-client
dotnet new icerpc-slice-server -o quic-server --transport quic
dotnet new icerpc-slice-client -o quic-client --transport quic  

The only part that is kinda lame right now is I could not find a way to get the template to copy in the certs from the top level certs/ directory. As such, we now have a duplicate of the server.p12 and cacert.der inside the template folder which is kinda lame. @pepone do you know of any solution for this?

ReeceHumphreys commented 5 months ago

Regarding the certificates, seems that you can include them in the NuGet package for the templates:

I tried doing this morning and was running into issues manually installing the templates using dotnet new install path/to/the/template/I/want as the cert now exists in the NuGet but not permanently in the folder. I think we should just leave it as is for now and can always refine it a bit more in the future!

@bernardnormier brought up the idea of adding more options in the future like an SSL option for TCP!

pepone commented 5 months ago

I tried doing this morning and was running into issues manually installing the templates using dotnet new install path/to/the/template/I/want

Another option would be to look into add a built step to copy them, instead of keeping the copies in git.

ReeceHumphreys commented 5 months ago

The updates look good, with a few considerations:

  • Have we considered providing the same feature with the Protobuf templates?
  • It wouldn't hurt to include a README file with the templates, clarifying that the provided certificates are for testing purposes.

Definitely! The main goal of this PR was to demonstrate how it could be done and to do it for slice client and server so I can refactor my blog to use these new templates. I'll open issues for these improvements.