Fix proxy connection for Cryville.Common.Network.

This commit is contained in:
2022-10-27 11:28:10 +08:00
parent 6b6b7d9a48
commit 92e5ed1f9c
3 changed files with 36 additions and 42 deletions

View File

@@ -10,13 +10,11 @@ using System.Text;
namespace Cryville.Common.Network {
public class TlsTcpClient {
readonly TcpClient _tcpClient;
readonly TlsClientProtocol _protocol;
readonly TlsClient _tlsClient;
public Stream Stream { get; private set; }
public TlsTcpClient(string hostname, int port) {
_tcpClient = new TcpClient(hostname, port);
_protocol = new TlsClientProtocol(_tcpClient.GetStream());
public TlsTcpClient(TcpClient tcpClient, string hostname) {
_protocol = new TlsClientProtocol(tcpClient.GetStream());
_tlsClient = new InternalTlsClient(hostname, new BcTlsCrypto(new SecureRandom()));
}