doc: 更新头文件
This commit is contained in:
parent
ad84da7d3c
commit
14d2332483
|
|
@ -19,8 +19,7 @@ indent_size = 2
|
|||
end_of_line = lf
|
||||
|
||||
[*.cs]
|
||||
dotnet_analyzer_diagnostic.category-Style.severity = none
|
||||
csharp_style_namespace_declarations = file_scoped:silent
|
||||
|
||||
[*.cs]
|
||||
file_header_template = Copyright 2023 The Ip2Region Authors. All rights reserved.\nUse of this source code is governed by a Apache2.0-style\nlicense that can be found in the LICENSE file.\n@Author Alan <lzh.shap@gmail.com>\n@Date 2023/07/25\nUpdated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
file_header_template = Copyright 2025 The Ip2Region Authors. All rights reserved.\nUse of this source code is governed by a Apache2.0-style\nlicense that can be found in the LICENSE file.\n@Author Alan <lzh.shap@gmail.com>\n@Date 2023/07/25\nUpdated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2023 The Ip2Region Authors. All rights reserved.
|
||||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using BenchmarkDotNet.Running;
|
||||
using IP2Region.Net.BenchMark;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using IP2Region.Net.Abstractions;
|
||||
using IP2Region.Net.XDB;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using Xunit;
|
||||
|
||||
namespace IP2Region.Net.Test;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using Xunit;
|
||||
|
||||
namespace IP2Region.Net.Test;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
// Copyright 2023 The Ip2Region Authors. All rights reserved.
|
||||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using System.Net;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
// Copyright 2023 The Ip2Region Authors. All rights reserved.
|
||||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using IP2Region.Net.Abstractions;
|
||||
using IP2Region.Net.XDB;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
// Copyright 2023 The Ip2Region Authors. All rights reserved.
|
||||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using System.Buffers;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
// Copyright 2023 The Ip2Region Authors. All rights reserved.
|
||||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using IP2Region.Net.Internal.Abstractions;
|
||||
using IP2Region.Net.XDB;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
// Copyright 2023 The Ip2Region Authors. All rights reserved.
|
||||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using IP2Region.Net.Internal.Abstractions;
|
||||
|
||||
|
|
@ -10,7 +11,7 @@ namespace IP2Region.Net.Internal;
|
|||
|
||||
class ContentCacheStrategy : AbstractCacheStrategy
|
||||
{
|
||||
ReadOnlyMemory<byte> _cacheData = default;
|
||||
readonly ReadOnlyMemory<byte> _cacheData = default;
|
||||
|
||||
public ContentCacheStrategy(string xdbPath) : base(xdbPath)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
// Copyright 2023 The Ip2Region Authors. All rights reserved.
|
||||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using IP2Region.Net.Internal.Abstractions;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
// Copyright 2023 The Ip2Region Authors. All rights reserved.
|
||||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using IP2Region.Net.Internal.Abstractions;
|
||||
|
||||
|
|
@ -10,12 +11,12 @@ namespace IP2Region.Net.Internal;
|
|||
|
||||
internal class VectorIndexCacheStrategy : AbstractCacheStrategy
|
||||
{
|
||||
ReadOnlyMemory<byte> _vectorCahe = default;
|
||||
readonly ReadOnlyMemory<byte> _vectorCache = default;
|
||||
|
||||
public VectorIndexCacheStrategy(string xdbPath) : base(xdbPath)
|
||||
{
|
||||
_vectorCahe = base.GetData(256, 256 * 256 * 8);
|
||||
_vectorCache = base.GetData(256, 256 * 256 * 8);
|
||||
}
|
||||
|
||||
public override ReadOnlyMemory<byte> GetVectorIndexStartPos(int offset) => _vectorCahe.Slice(offset, 8);
|
||||
public override ReadOnlyMemory<byte> GetVectorIndexStartPos(int offset) => _vectorCache.Slice(offset, 8);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
namespace IP2Region.Net.XDB;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
// Copyright 2023 The Ip2Region Authors. All rights reserved.
|
||||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan Lee <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/23
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using IP2Region.Net.Abstractions;
|
||||
using IP2Region.Net.Internal;
|
||||
|
|
@ -57,7 +58,7 @@ public class Searcher : ISearcher
|
|||
public string? Search(uint ipAddress)
|
||||
{
|
||||
var bytes = BitConverter.GetBytes(ipAddress);
|
||||
bytes.Reverse();
|
||||
Array.Reverse(bytes);
|
||||
return SearchCore(bytes);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
using System.Buffers;
|
||||
using System.Buffers.Binary;
|
||||
using System.Net;
|
||||
|
|
@ -35,7 +42,7 @@ public static class Util
|
|||
|
||||
if (!File.Exists(dbPath))
|
||||
{
|
||||
throw new FileNotFoundException("xdb file not fould.", dbPath);
|
||||
throw new FileNotFoundException("xdb file not found.", dbPath);
|
||||
}
|
||||
|
||||
using var reader = File.OpenRead(dbPath);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
// Copyright 2025 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
|
||||
|
||||
namespace IP2Region.Net.XDB;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue