問題,僅在中轉服務端載入證書,客戶端不需要使用證書,方便證書過期了,僅在服務端載入即可。
解決方案:
ForwardDispatcher.cs
DispatchAsync中處理
using (var stream1 = await tcs.Task.WaitAsync(TimeSpan.FromSeconds(10)))
using (var stream2 = new NetworkStream(_socket, true) { ReadTimeout = 1000 * 60 * 10 })
using (SslStream stream = new SslStream(stream2))
{
stream.AuthenticateAsServer(Get(),false,false);//證書的處理
await Task.WhenAny(stream1.CopyToAsync(stream), stream.CopyToAsync(stream1));
}