Skip to content

Commit e90dc34

Browse files
committed
修复异常IP问题
升级.net8
1 parent a2aa48d commit e90dc34

File tree

19 files changed

+1162
-57
lines changed

19 files changed

+1162
-57
lines changed

.vs/LuoCoreFastGithub/config/applicationhost.config

Lines changed: 1021 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
8-
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
7+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
8+
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.0" />
99
</ItemGroup>
1010

1111
</Project>

LuoCoreFastGithub.DomainResolve/IPAddressService.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,19 @@ private async Task<AddressElapsed> GetAddressElapsedAsync(IPEndPoint endPoint, C
103103
{
104104
using var timeoutTokenSource = new CancellationTokenSource(this.connectTimeout);
105105
using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutTokenSource.Token);
106-
using var socket = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
107-
await socket.ConnectAsync(endPoint, linkedTokenSource.Token);
108-
109-
addressElapsed = new AddressElapsed(endPoint.Address, stopWatch.Elapsed);
110-
return this.addressElapsedCache.Set(endPoint, addressElapsed, this.normalElapsedExpiration);
106+
if (Enum.IsDefined(typeof(AddressFamily), endPoint.AddressFamily))
107+
{
108+
using var socket = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
109+
await socket.ConnectAsync(endPoint, linkedTokenSource.Token);
110+
addressElapsed = new AddressElapsed(endPoint.Address, stopWatch.Elapsed);
111+
return this.addressElapsedCache.Set(endPoint, addressElapsed, this.normalElapsedExpiration);
112+
}
113+
else
114+
{
115+
return addressElapsed;
116+
}
117+
118+
111119
}
112120
catch (Exception ex)
113121
{
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageReference Include="PInvoke.AdvApi32" Version="0.7.124" />
8-
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
9-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
107
<PackageReference Include="DNS" Version="7.0.0" />
8+
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.49-beta">
9+
<PrivateAssets>all</PrivateAssets>
10+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
11+
</PackageReference>
12+
<PackageReference Include="PInvoke.AdvApi32" Version="0.7.124" />
13+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
14+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
1115
<PackageReference Include="Tommy" Version="3.1.2" />
1216
<ProjectReference Include="..\LuoCoreFastGithub.Configuration\LuoCoreFastGithub.Configuration.csproj" />
1317
</ItemGroup>
1418

19+
1520
<ItemGroup>
16-
<None Include="../@dnscrypt-proxy/*" Link="dnscrypt-proxy/%(Filename)%(Extension)">
21+
<None Include="..\%40dnscrypt-proxy\*" Link="dnscrypt-proxy\%(Filename)%(Extension)">
1722
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1823
</None>
19-
<None Include="../@dnscrypt-proxy/$(RuntimeIdentifier)/*" Link="dnscrypt-proxy/%(Filename)%(Extension)">
24+
<None Include="..\%40dnscrypt-proxy\$(RuntimeIdentifier)\*" Link="dnscrypt-proxy\%(Filename)%(Extension)">
25+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
26+
</None>
27+
<None Include="..\%40dnscrypt-proxy\$(RuntimeIdentifier)\win-x64\dnscrypt-proxy.exe" Link="dnscrypt-proxy\%(Filename)%(Extension)">
2028
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2129
</None>
2230
</ItemGroup>
2331

32+
33+
2434
</Project>

LuoCoreFastGithub.FlowAnalyze/LuoCoreFastGithub.FlowAnalyze.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66
<ItemGroup>
77
<FrameworkReference Include="Microsoft.AspNetCore.App" />

LuoCoreFastGithub.Http/LuoCoreFastGithub.Http.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66
<ItemGroup>
77
<ProjectReference Include="..\LuoCoreFastGithub.DomainResolve\LuoCoreFastGithub.DomainResolve.csproj" />

LuoCoreFastGithub.HttpServer/HttpMiddlewares/HttpProxyPacMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
3737
{
3838
var proxyPac = this.CreateProxyPac(context.Request.Host);
3939
context.Response.ContentType = "application/x-ns-proxy-autoconfig";
40-
context.Response.Headers.Add("Content-Disposition", $"attachment;filename=proxy.pac");
40+
context.Response.Headers.Append("Content-Disposition", $"attachment;filename=proxy.pac");
4141
await context.Response.WriteAsync(proxyPac);
4242
}
4343
else

LuoCoreFastGithub.HttpServer/LuoCoreFastGithub.HttpServer.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
66
</PropertyGroup>
77

88
<ItemGroup>
99
<FrameworkReference Include="Microsoft.AspNetCore.App" />
10-
<PackageReference Include="Yarp.ReverseProxy" Version="1.1.1" />
10+
<PackageReference Include="Yarp.ReverseProxy" Version="2.1.0" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

LuoCoreFastGithub.PacketIntercept/LuoCoreFastGithub.PacketIntercept.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
<PropertyGroup>
6-
<TargetFramework>net7.0</TargetFramework>
6+
<TargetFramework>net8.0</TargetFramework>
77
<!--<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>-->
99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

LuoCoreFastGithub.UI/LuoCoreFastGithub.UI.csproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
<UseWindowsForms>true</UseWindowsForms>
66
<OutputType>WinExe</OutputType>
77
<LangVersion>8.0</LangVersion>
8-
<TargetFramework>net7.0-windows</TargetFramework>
8+
<TargetFramework>net8.0-windows</TargetFramework>
99
<ApplicationIcon>app.ico</ApplicationIcon>
1010
<ApplicationManifest>app.manifest</ApplicationManifest>
11-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1211
<AutoGenerateBindingRedirects>False</AutoGenerateBindingRedirects>
1312
<StartupObject></StartupObject>
1413
<BaseOutputPath>D:\CodeRepository\Git\LuoCoreFastGithub\Resources</BaseOutputPath>
@@ -18,6 +17,13 @@
1817
<Resource Include="Resource\*.*" />
1918
</ItemGroup>
2019

20+
<ItemGroup>
21+
<Compile Remove="bin\**" />
22+
<EmbeddedResource Remove="bin\**" />
23+
<None Remove="bin\**" />
24+
<Page Remove="bin\**" />
25+
</ItemGroup>
26+
2127
<ItemGroup>
2228
<PackageReference Include="LiveCharts.Wpf.Core" Version="0.9.8" />
2329
<PackageReference Include="Newtonsoft.Json" Version="13.0.3">

0 commit comments

Comments
 (0)