Browse Source

ip地址库更新

懒得勤快 6 years ago
parent
commit
0c0fe611b4

BIN
src/Masuit.MyBlogs.Core/App_Data/ip2region.db


+ 2 - 2
src/Masuit.MyBlogs.Core/Common/CommonHelper.cs

@@ -166,10 +166,10 @@ namespace Masuit.MyBlogs.Core.Common
 
         public static string GetIPLocation(this IPAddress ip) => GetIPLocation(ip.MapToIPv4().ToString());
 
+        private static readonly DbSearcher Searcher = new DbSearcher(Path.Combine(AppContext.BaseDirectory + "App_Data", "ip2region.db"));
         public static string GetIPLocation(this string ip)
         {
-            using var searcher = new DbSearcher(Path.Combine(AppContext.BaseDirectory + "App_Data", "ip2region.db"));
-            return searcher.MemorySearch(ip).Region;
+            return Searcher.MemorySearch(ip).Region;
         }
 
         /// <summary>