mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-28 05:03:02 +00:00
Add IP cert support (#8833)
This commit is contained in:
parent
9c82df5b49
commit
aea7078e95
2 changed files with 3 additions and 17 deletions
|
|
@ -215,7 +215,7 @@ public class CertPemManager
|
||||||
using var client = new TcpClient();
|
using var client = new TcpClient();
|
||||||
await client.ConnectAsync(domain, port > 0 ? port : 443, cts.Token);
|
await client.ConnectAsync(domain, port > 0 ? port : 443, cts.Token);
|
||||||
|
|
||||||
using var ssl = new SslStream(client.GetStream(), false, ValidateServerCertificate);
|
await using var ssl = new SslStream(client.GetStream(), false, ValidateServerCertificate);
|
||||||
|
|
||||||
var sslOptions = new SslClientAuthenticationOptions
|
var sslOptions = new SslClientAuthenticationOptions
|
||||||
{
|
{
|
||||||
|
|
@ -262,7 +262,7 @@ public class CertPemManager
|
||||||
using var client = new TcpClient();
|
using var client = new TcpClient();
|
||||||
await client.ConnectAsync(domain, port > 0 ? port : 443, cts.Token);
|
await client.ConnectAsync(domain, port > 0 ? port : 443, cts.Token);
|
||||||
|
|
||||||
using var ssl = new SslStream(client.GetStream(), false, ValidateServerCertificate);
|
await using var ssl = new SslStream(client.GetStream(), false, ValidateServerCertificate);
|
||||||
|
|
||||||
var sslOptions = new SslClientAuthenticationOptions
|
var sslOptions = new SslClientAuthenticationOptions
|
||||||
{
|
{
|
||||||
|
|
@ -280,11 +280,7 @@ public class CertPemManager
|
||||||
var chain = new X509Chain();
|
var chain = new X509Chain();
|
||||||
chain.Build(certChain);
|
chain.Build(certChain);
|
||||||
|
|
||||||
foreach (var element in chain.ChainElements)
|
pemList.AddRange(chain.ChainElements.Select(element => ExportCertToPem(element.Certificate)));
|
||||||
{
|
|
||||||
var pem = ExportCertToPem(element.Certificate);
|
|
||||||
pemList.Add(pem);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (pemList, null);
|
return (pemList, null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -247,11 +247,6 @@ public class AddServerViewModel : MyReactiveObject
|
||||||
{
|
{
|
||||||
serverName = SelectedSource.Address;
|
serverName = SelectedSource.Address;
|
||||||
}
|
}
|
||||||
if (!Utils.IsDomain(serverName))
|
|
||||||
{
|
|
||||||
UpdateCertTip(ResUI.ServerNameMustBeValidDomain);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (SelectedSource.Port > 0)
|
if (SelectedSource.Port > 0)
|
||||||
{
|
{
|
||||||
domain += $":{SelectedSource.Port}";
|
domain += $":{SelectedSource.Port}";
|
||||||
|
|
@ -277,11 +272,6 @@ public class AddServerViewModel : MyReactiveObject
|
||||||
{
|
{
|
||||||
serverName = SelectedSource.Address;
|
serverName = SelectedSource.Address;
|
||||||
}
|
}
|
||||||
if (!Utils.IsDomain(serverName))
|
|
||||||
{
|
|
||||||
UpdateCertTip(ResUI.ServerNameMustBeValidDomain);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (SelectedSource.Port > 0)
|
if (SelectedSource.Port > 0)
|
||||||
{
|
{
|
||||||
domain += $":{SelectedSource.Port}";
|
domain += $":{SelectedSource.Port}";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue