git自动忽略证书

This commit is contained in:
xljiulang 2021-08-19 20:14:38 +08:00
parent 881ffa10fb
commit 66d8dce567
3 changed files with 37 additions and 1 deletions

View File

@ -27,6 +27,7 @@ namespace FastGithub.DomainResolve
private readonly TimeSpan connectTimeout = TimeSpan.FromSeconds(2d);
private readonly TimeSpan pureResolveCacheTimeSpan = TimeSpan.FromMinutes(5d);
private readonly TimeSpan fastResolveCacheTimeSpan = TimeSpan.FromMinutes(1d);
private readonly TimeSpan loopbackResolveCacheTimeSpan = TimeSpan.FromSeconds(5d);
private readonly ConcurrentDictionary<DnsEndPoint, SemaphoreSlim> semaphoreSlims = new();
/// <summary>
@ -95,7 +96,7 @@ namespace FastGithub.DomainResolve
// 往往是被污染的dns
if (address.Equals(IPAddress.Loopback) == false)
{
expiration = TimeSpan.FromSeconds(2d);
expiration = this.loopbackResolveCacheTimeSpan;
}
this.logger.LogInformation($"[{endPoint.Host}->{address}]");

View File

@ -84,6 +84,8 @@ namespace FastGithub.ReverseProxy
{
this.logger.LogWarning($"不支持自动安装证书{this.CaCerFilePath}请根据你的系统平台手工安装和信任CA证书");
}
GitUtil.SetSslverify(false);
}
/// <summary>

View File

@ -0,0 +1,33 @@
using System;
using System.Diagnostics;
namespace FastGithub.ReverseProxy
{
/// <summary>
/// git工具
/// </summary>
static class GitUtil
{
/// <summary>
/// 设置ssl验证
/// </summary>
/// <param name="value">是否验证</param>
public static void SetSslverify(bool value)
{
try
{
Process.Start(new ProcessStartInfo
{
FileName = "git",
Arguments = $"config --global http.sslverify {value.ToString().ToLower()}",
UseShellExecute = true,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
});
}
catch (Exception)
{
}
}
}
}