Description
Hey, @brendanburns, as previously discussed in tintoy/dotnet-kube-client#6 I'm happy to contribute my WebSocket functionality (which includes support for custom verification of the server certificate).
But I figured it'd be worth discussing here first :)
The big gotcha (currently) is that it has a dependency on netcoreapp2.1
because in previous versions of corefx WebSockets used WinHTTP on Windows (which didn't honour a subset of the certificate options on ClientWebSocketOptions
) and something else on OSX / Linux (which didn't honour a different subset of the certificate options). In 2.1, the WebSockets implementation is entirely implemented in managed code and fully supports customisation of SSL certificate usage / validation.
As it stands, here's how I implemented it:
https://github.com/tintoy/dotnet-kube-client/blob/develop/src/KubeClient.Extensions.WebSockets/K8sWebSocketOptions.cs#L13
https://github.com/tintoy/dotnet-kube-client/blob/develop/src/KubeClient.Extensions.WebSockets/K8sWebSocket.cs#L31
I borrowed some of the original ClientWebSocket
code from .NET Core 2.0 and modified it to work with 2.1-preview1
(but from 2.1-preview2
onwards, the ManagedWebSocket
types will be publicly available and much of this code can be eliminated).
The latest code from corefx is a fair bit simpler because the required managed types are available internally: