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