git自动忽略证书
This commit is contained in:
parent
881ffa10fb
commit
66d8dce567
@ -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}]");
|
||||
|
||||
@ -84,6 +84,8 @@ namespace FastGithub.ReverseProxy
|
||||
{
|
||||
this.logger.LogWarning($"不支持自动安装证书{this.CaCerFilePath}:请根据你的系统平台手工安装和信任CA证书");
|
||||
}
|
||||
|
||||
GitUtil.SetSslverify(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
33
FastGithub.ReverseProxy/GitUtil.cs
Normal file
33
FastGithub.ReverseProxy/GitUtil.cs
Normal 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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user