Ejemplo n.º 1
0
 /// <summary>
 /// Terminating middleware which creates a proxy over a specified endpoint.
 /// </summary>
 /// <param name="app">The ASP.NET <see cref="IApplicationBuilder"/>.</param>
 /// <param name="httpEndpointComputer">The HTTP endpoint to use.  This takes the form `(<see cref="HttpContext"/>, <see cref="IDictionary{String, Object}"/>) => <see cref="String"/>`.</param>
 /// <param name="wsEndpointComputer">The WS endpoint to use.  This takes the form `(<see cref="HttpContext"/>, <see cref="IDictionary{String, Object}"/>) => <see cref="String"/>`.</param>
 /// <param name="httpBuilderOptionsAction">The HTTP options builder action to use.  This takes the form `(<see cref="IHttpProxyOptionsBuilder"/>) => void`.</param>
 /// <param name="wsBuilderOptionsAction">The WS options builder action to use.  This takes the form `(<see cref="IWsProxyOptionsBuilder"/>) => void`.</param>
 public static void RunProxy(
     this IApplicationBuilder app,
     EndpointComputerToString httpEndpointComputer,
     EndpointComputerToString wsEndpointComputer,
     Action <IHttpProxyOptionsBuilder> httpBuilderOptionsAction = null,
     Action <IWsProxyOptionsBuilder> wsBuilderOptionsAction     = null)
 {
     app.RunProxy(builder => builder
                  .UseHttp(httpBuilder => httpBuilder
                           .WithEndpoint(httpEndpointComputer)
                           .WithOptions(httpBuilderOptionsAction)
                           )
                  .UseWs(wsBuilder => wsBuilder
                         .WithEndpoint(wsEndpointComputer)
                         .WithOptions(wsBuilderOptionsAction)
                         )
                  );
 }
Ejemplo n.º 2
0
 /// <inheritdoc/>
 public IHttpProxyBuilder WithEndpoint(EndpointComputerToString endpointComputer) => this.WithEndpoint((context, args) => new ValueTask <string>(endpointComputer(context, args)));
Ejemplo n.º 3
0
 /// <summary>
 /// Terminating middleware which creates a proxy over a specified endpoint.
 /// </summary>
 /// <param name="app">The ASP.NET <see cref="IApplicationBuilder"/>.</param>
 /// <param name="wsEndpointComputer">The WS endpoint to use.  This takes the form `(<see cref="HttpContext"/>, <see cref="IDictionary{String, Object}"/>) => <see cref="String"/>`.</param>
 /// <param name="wsBuilderOptionsAction">The WS options builder action to use.  This takes the form `(<see cref="IWsProxyOptionsBuilder"/>) => void`.</param>
 public static void RunWsProxy(this IApplicationBuilder app, EndpointComputerToString wsEndpointComputer, Action <IWsProxyOptionsBuilder> wsBuilderOptionsAction = null) =>
 app.RunWsProxy(builder => builder
                .WithEndpoint(wsEndpointComputer)
                .WithOptions(wsBuilderOptionsAction)
                );
Ejemplo n.º 4
0
 /// <summary>
 /// Terminating middleware which creates a proxy over a specified endpoint.
 /// </summary>
 /// <param name="app">The ASP.NET <see cref="IApplicationBuilder"/>.</param>
 /// <param name="httpEndpointComputer">The HTTP endpoint to use.  This takes the form `(<see cref="HttpContext"/>, <see cref="IDictionary{String, Object}"/>) => <see cref="String"/>`.</param>
 /// <param name="httpBuilderOptionsAction">The HTTP options builder action to use.  This takes the form `(<see cref="IHttpProxyOptionsBuilder"/>) => void`.</param>
 public static void RunHttpProxy(this IApplicationBuilder app, EndpointComputerToString httpEndpointComputer, Action <IHttpProxyOptionsBuilder> httpBuilderOptionsAction = null) =>
 app.RunHttpProxy(builder => builder
                  .WithEndpoint(httpEndpointComputer)
                  .WithOptions(httpBuilderOptionsAction)
                  );
Ejemplo n.º 5
0
 /// <inheritdoc/>
 public IProxyBuilder UseWs(EndpointComputerToString endpointComputer, Action <IWsProxyOptionsBuilder> builderAction = null) => this.UseWs(wsProxy => wsProxy.WithEndpoint(endpointComputer).WithOptions(builderAction));
Ejemplo n.º 6
0
 /// <inheritdoc/>
 public IProxyBuilder UseHttp(EndpointComputerToString endpointComputer, Action <IHttpProxyOptionsBuilder> builderAction = null) => this.UseHttp(httpProxy => httpProxy.WithEndpoint(endpointComputer).WithOptions(builderAction));