Пример #1
0
 public ProxyScraperService(
     ILogger<ProxyScraperService> logger, 
     IServiceScopeFactory scopeFactory,
     IProxyPool proxyPool)
 {
     _logger = logger;
     _scopeFactory = scopeFactory;
     _proxyPool = proxyPool;
     _providers = new List<ProviderConfig>
     {
         new ProviderConfig(
             new PatternScraperProvider("https://www.ipaddress.com/proxy-list/"), 
             TimeSpan.FromHours(6)),
         
         new ProviderConfig(
             new PatternScraperProvider("https://www.sslproxies.org/"), 
             TimeSpan.FromHours(1)),
         
         new ProviderConfig(
             new PatternScraperProvider("https://hugeproxies.com/home/"), 
             TimeSpan.FromHours(1)),
         
         new ProviderConfig(
             new PatternScraperProvider("https://api.proxyscrape.com/?request=getproxies&proxytype=http"), 
             TimeSpan.FromHours(1)),
     };
 }
Пример #2
0
 public ProxyService(
     IProxyPool pool, ILogger <ProxyService> logger, IServiceProvider serviceProvider,
     IOptions <SpiderOptions> options)
 {
     _proxySupplier = serviceProvider.GetService(typeof(IProxySupplier)) as IProxySupplier;
     _pool          = pool;
     _logger        = logger;
     _options       = options.Value;
 }
Пример #3
0
 public ProxyCheckerService(
     ILogger <ProxyCheckerService> logger,
     IServiceScopeFactory scopeFactory,
     IProxyPool proxyPool)
 {
     _logger          = logger;
     _scopeFactory    = scopeFactory;
     _proxyPool       = proxyPool;
     _concurrencyLock = new SemaphoreSlim(MaxConcurrency);
 }
Пример #4
0
 public DependenceServices(IServiceProvider serviceProvider,
                           IScheduler scheduler,
                           IMessageQueue messageQueue,
                           IStatisticsClient statisticsClient,
                           IHostApplicationLifetime applicationLifetime,
                           IProxyPool proxyPool)
 {
     ServiceProvider     = serviceProvider;
     Scheduler           = scheduler;
     MessageQueue        = messageQueue;
     StatisticsClient    = statisticsClient;
     ProxyPool           = proxyPool;
     ApplicationLifetime = applicationLifetime;
     IsDistributed       = !(messageQueue is MessageQueue.MessageQueue);
 }
Пример #5
0
 private static IUnityContainer initContainer(IProxyPool<ITestService<int>> proxyPool)
 {
     return (new UnityContainer()).RegisterWcfClientFor(proxyPool);
 }
Пример #6
0
 public ReturnProxyTask(IProxyPool pool, HttpProxy httpProxy)
 {
     _pool      = pool;
     _httpProxy = httpProxy;
 }