using dodohold.core;
using IP2Region.Net.Abstractions;
using IP2Region.Net.XDB;


namespace molilian.core
{
    public partial class IP2RegionPlus
    {

        static ISearcher _searcher;
        static object _locker = new object();
        public static string? Search(string ip)
        {
            try
            {
                if (_searcher == null)
                {
                    lock (_locker)
                    {
                        string xdb = AppContext.BaseDirectory + "data/ip2region.xdb";
                        _searcher = new Searcher(CachePolicy.Content, xdb);
                    }

                }
                return _searcher.Search(ip);
            }
            catch (Exception)
            {
            }
            return null;
        }


    }

}
