mirror of
https://github.com/Tribufu/TribufuDotNet
synced 2026-08-10 13:21:06 +00:00
Migrate to new tribufu project structure (#2)
* Migrate to new tribufu project structure * Update .gitignore * Remove old api files * Update Directory.Build.props * Rename solution
This commit is contained in:
parent
be25ee8fe3
commit
7e8e192dc3
115 changed files with 41 additions and 262 deletions
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Tribufu.AspNetCore.Extensions
|
||||
{
|
||||
public static class HttpContextExtensions
|
||||
{
|
||||
public static string GetIpAddress(this HttpContext context)
|
||||
{
|
||||
var headers = context.Request.Headers;
|
||||
if (headers.TryGetValue("CF-Connecting-IP", out var cfConnectingIp))
|
||||
{
|
||||
return cfConnectingIp.FirstOrDefault() ?? "127.0.0.1";
|
||||
}
|
||||
|
||||
if (headers.TryGetValue("X-Forwarded-For", out var xForwardedFor))
|
||||
{
|
||||
var forwardedIps = xForwardedFor.ToString().Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (forwardedIps.Length > 0)
|
||||
{
|
||||
return forwardedIps[0].Trim();
|
||||
}
|
||||
}
|
||||
|
||||
return context.Connection.RemoteIpAddress?.ToString() ?? "127.0.0.1";
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Source/Tribufu.AspNetCore/README.md
Normal file
1
Source/Tribufu.AspNetCore/README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Tribufu AspNetCore
|
||||
28
Source/Tribufu.AspNetCore/Tribufu.AspNetCore.csproj
Normal file
28
Source/Tribufu.AspNetCore/Tribufu.AspNetCore.csproj
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<PackageId>Tribufu.AspNetCore</PackageId>
|
||||
<Description>Tribufu AspNetCore</Description>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<IsPublishable>false</IsPublishable>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFrameworks>net8.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Tribufu.Configuration\Tribufu.Configuration.csproj" />
|
||||
<ProjectReference Include="..\Tribufu.Logging\Tribufu.Logging.csproj" />
|
||||
<ProjectReference Include="..\Tribufu.Platform\Tribufu.Platform.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue