Beispiel #1
0
        public ProxyConfigManager(
            ILogger <ProxyConfigManager> logger,
            IProxyConfigProvider provider,
            IClusterManager clusterManager,
            IRouteManager routeManager,
            IEnumerable <IProxyConfigFilter> filters,
            IConfigValidator configValidator,
            ProxyEndpointFactory proxyEndpointFactory,
            ITransformBuilder transformBuilder,
            IProxyHttpClientFactory httpClientFactory,
            IActiveHealthCheckMonitor activeHealthCheckMonitor)
        {
            _logger                   = logger ?? throw new ArgumentNullException(nameof(logger));
            _provider                 = provider ?? throw new ArgumentNullException(nameof(provider));
            _clusterManager           = clusterManager ?? throw new ArgumentNullException(nameof(clusterManager));
            _routeManager             = routeManager ?? throw new ArgumentNullException(nameof(routeManager));
            _filters                  = filters ?? throw new ArgumentNullException(nameof(filters));
            _configValidator          = configValidator ?? throw new ArgumentNullException(nameof(configValidator));
            _proxyEndpointFactory     = proxyEndpointFactory ?? throw new ArgumentNullException(nameof(proxyEndpointFactory));
            _transformBuilder         = transformBuilder ?? throw new ArgumentNullException(nameof(transformBuilder));
            _httpClientFactory        = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
            _activeHealthCheckMonitor = activeHealthCheckMonitor ?? throw new ArgumentNullException(nameof(activeHealthCheckMonitor));

            _conventions   = new List <Action <EndpointBuilder> >();
            DefaultBuilder = new ReverseProxyConventionBuilder(_conventions);

            _changeToken = new CancellationChangeToken(_cancellationTokenSource.Token);
        }
Beispiel #2
0
    private (RouteEndpoint routeEndpoint, RouteModel routeConfig) CreateEndpoint(ProxyEndpointFactory factory, RouteState routeState, RouteConfig routeConfig, ClusterState clusterState)
    {
        routeState.ClusterRevision = clusterState.Revision;
        var routeModel = new RouteModel(routeConfig, clusterState, HttpTransformer.Default);

        var endpoint = factory.CreateEndpoint(routeModel, Array.Empty <Action <EndpointBuilder> >());

        var routeEndpoint = Assert.IsType <RouteEndpoint>(endpoint);

        return(routeEndpoint, routeModel);
    }
        private (RouteEndpoint routeEndpoint, RouteConfig routeConfig) CreateEndpoint(ProxyEndpointFactory factory, RouteInfo routeInfo, ProxyRoute proxyRoute, ClusterInfo clusterInfo)
        {
            var routeConfig = new RouteConfig(routeInfo, proxyRoute, clusterInfo, HttpTransformer.Default);

            var endpoint = factory.CreateEndpoint(routeConfig, Array.Empty <Action <EndpointBuilder> >());

            var routeEndpoint = Assert.IsType <RouteEndpoint>(endpoint);

            return(routeEndpoint, routeConfig);
        }