Fix TlsTcpClient. Update console scene.
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Collections;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Cryville.Common.Network {
|
namespace Cryville.Common.Network {
|
||||||
public class TlsTcpClient {
|
public class TlsTcpClient {
|
||||||
@@ -16,7 +17,7 @@ namespace Cryville.Common.Network {
|
|||||||
public TlsTcpClient(string hostname, int port) {
|
public TlsTcpClient(string hostname, int port) {
|
||||||
_tcpClient = new TcpClient(hostname, port);
|
_tcpClient = new TcpClient(hostname, port);
|
||||||
_protocol = new TlsClientProtocol(_tcpClient.GetStream());
|
_protocol = new TlsClientProtocol(_tcpClient.GetStream());
|
||||||
_tlsClient = new InternalTlsClient(new BcTlsCrypto(new SecureRandom()));
|
_tlsClient = new InternalTlsClient(hostname, new BcTlsCrypto(new SecureRandom()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Connect() {
|
public void Connect() {
|
||||||
@@ -29,7 +30,11 @@ namespace Cryville.Common.Network {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class InternalTlsClient : DefaultTlsClient {
|
private class InternalTlsClient : DefaultTlsClient {
|
||||||
public InternalTlsClient(TlsCrypto crypto) : base(crypto) { }
|
string _host;
|
||||||
|
|
||||||
|
public InternalTlsClient(string host, TlsCrypto crypto) : base(crypto) {
|
||||||
|
_host = host;
|
||||||
|
}
|
||||||
|
|
||||||
protected override ProtocolVersion[] GetSupportedVersions() {
|
protected override ProtocolVersion[] GetSupportedVersions() {
|
||||||
return ProtocolVersion.TLSv13.DownTo(ProtocolVersion.TLSv12);
|
return ProtocolVersion.TLSv13.DownTo(ProtocolVersion.TLSv12);
|
||||||
@@ -37,8 +42,7 @@ namespace Cryville.Common.Network {
|
|||||||
|
|
||||||
protected override IList GetProtocolNames() {
|
protected override IList GetProtocolNames() {
|
||||||
IList list = new ArrayList {
|
IList list = new ArrayList {
|
||||||
ProtocolName.Http_1_1,
|
ProtocolName.Http_1_1
|
||||||
ProtocolName.Http_2_Tls
|
|
||||||
};
|
};
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -62,6 +66,10 @@ namespace Cryville.Common.Network {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override IList GetSniServerNames() {
|
||||||
|
return new ArrayList { new ServerName(0, Encoding.ASCII.GetBytes(_host)) };
|
||||||
|
}
|
||||||
|
|
||||||
public override TlsAuthentication GetAuthentication() {
|
public override TlsAuthentication GetAuthentication() {
|
||||||
return new NullTlsAuthentication();
|
return new NullTlsAuthentication();
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,10 @@ namespace Cryville.Crtr {
|
|||||||
worker.Activate();
|
worker.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnApplicationQuit() {
|
||||||
|
Game.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
public void Submit() {
|
public void Submit() {
|
||||||
worker.Issue(InputBox.text);
|
worker.Issue(InputBox.text);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user