1234567891011121314151617181920212223 |
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.DependencyInjection.Extensions;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace TEAMModelOS.SDK
- {
- public static class IPSearcherExtensions
- {
- public static IServiceCollection AddIPSearcher(this IServiceCollection services, string path, string name = "Default")
- {
- if (services == null) throw new ArgumentNullException(nameof(services));
- if (path == null) throw new ArgumentNullException(nameof(path));
- services.TryAddSingleton(new IPSearcher(Path.Combine(path, "ip2region.db")));
- return services;
- }
-
- }
- }
|