// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Hosting
{
public static class WebHostBuilderLibuvExtensions
{
///
/// Specify Libuv as the transport to be used by Kestrel.
///
///
/// The Microsoft.AspNetCore.Hosting.IWebHostBuilder to configure.
///
///
/// The Microsoft.AspNetCore.Hosting.IWebHostBuilder.
///
public static IWebHostBuilder UseLibuv(this IWebHostBuilder hostBuilder)
{
return hostBuilder.ConfigureServices(services =>
{
services.AddSingleton();
});
}
///
/// Specify Libuv as the transport to be used by Kestrel.
///
///
/// The Microsoft.AspNetCore.Hosting.IWebHostBuilder to configure.
///
///
/// A callback to configure Libuv options.
///
///
/// The Microsoft.AspNetCore.Hosting.IWebHostBuilder.
///
public static IWebHostBuilder UseLibuv(this IWebHostBuilder hostBuilder, Action configureOptions)
{
return hostBuilder.UseLibuv().ConfigureServices(services =>
{
services.Configure(configureOptions);
});
}
}
}