123456789101112131415161718192021 |
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.DependencyInjection.Extensions;
- using System;
- using System.Collections.Generic;
- 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}/ip2region.db"));
- return services;
- }
- }
- }
|