Exemple #1
0
        public DefaultProxyValidator(IOptions <ProxyOptions> options, IHttpClientFactory httpClientFactory,
                                     ILogger <DefaultProxyValidator> logger)
        {
            _httpClientFactory = httpClientFactory;
            _logger            = logger;
            _options           = options.Value;

            _options.ProxyTestUrl.NotNullOrWhiteSpace(nameof(_options.ProxyTestUrl));

            if (!Uri.TryCreate(_options.ProxyTestUrl, UriKind.RelativeOrAbsolute, out _))
            {
                throw new ArgumentException($"{nameof(_options.ProxyTestUrl)} is not a valid uri");
            }
        }
 public KuaidailiProxySupplier(IOptions <ProxyOptions> options, IHttpClientFactory httpClientFactory)
 {
     _httpClientFactory = httpClientFactory;
     _options           = options.Value;
     _options.ProxySupplierUrl.NotNullOrWhiteSpace(nameof(_options.ProxySupplierUrl));
 }