mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-23 20:56:02 +00:00
Pass SocksClientStream to SslStream constructor for ManagedProxySocket
This doesn't seem to work as expected yet.
This commit is contained in:
parent
eaf23843d4
commit
f88c612273
1 changed files with 15 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Sockets.Bsd;
|
using Ryujinx.HLE.HOS.Services.Sockets.Bsd;
|
||||||
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl;
|
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl;
|
||||||
using Ryujinx.HLE.HOS.Services.Ssl.Types;
|
using Ryujinx.HLE.HOS.Services.Ssl.Types;
|
||||||
|
using RyuSocks;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
@ -111,12 +112,25 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
|
||||||
{
|
{
|
||||||
return hostName;
|
return hostName;
|
||||||
}
|
}
|
||||||
|
// Thrown by ManagedProxySocket when accessing RemoteEndPoint before connecting to a remote.
|
||||||
|
catch (NullReferenceException)
|
||||||
|
{
|
||||||
|
return hostName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultCode Handshake(string hostName)
|
public ResultCode Handshake(string hostName)
|
||||||
{
|
{
|
||||||
StartSslOperation();
|
StartSslOperation();
|
||||||
_stream = new SslStream(new NetworkStream(((ManagedSocket)Socket).Socket, false), false, null, null);
|
|
||||||
|
Stream socketStream = Socket switch
|
||||||
|
{
|
||||||
|
ManagedSocket managedSocket => new NetworkStream(managedSocket.Socket, false),
|
||||||
|
ManagedProxySocket proxySocket => new SocksClientStream(proxySocket.ProxyClient, false),
|
||||||
|
_ => throw new NotSupportedException($"{typeof(Socket)} is not supported.")
|
||||||
|
};
|
||||||
|
|
||||||
|
_stream = new SslStream(socketStream, false, null, null);
|
||||||
hostName = RetrieveHostName(hostName);
|
hostName = RetrieveHostName(hostName);
|
||||||
_stream.AuthenticateAsClient(hostName, null, TranslateSslVersion(_sslVersion), false);
|
_stream.AuthenticateAsClient(hostName, null, TranslateSslVersion(_sslVersion), false);
|
||||||
EndSslOperation();
|
EndSslOperation();
|
||||||
|
|
Loading…
Reference in a new issue