| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using CoreWCF.Channels; |
| | | 6 | | using Microsoft.AspNetCore.Hosting; |
| | | 7 | | using Microsoft.AspNetCore.Server.Kestrel.Core; |
| | | 8 | | using Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets; |
| | | 9 | | using Microsoft.Extensions.DependencyInjection; |
| | | 10 | | using Microsoft.Extensions.DependencyInjection.Extensions; |
| | | 11 | | using Microsoft.Extensions.Hosting; |
| | | 12 | | using Microsoft.Extensions.Logging; |
| | | 13 | | using Microsoft.Extensions.Options; |
| | | 14 | | |
| | | 15 | | namespace CoreWCF.Configuration |
| | | 16 | | { |
| | | 17 | | public static class UnixDomainSocketHostBuilderExtensions |
| | | 18 | | { |
| | | 19 | | |
| | | 20 | | public static IHostBuilder UseUnixDomainSocket(this IHostBuilder hostBuilder, Action<UnixDomainSocketOptions> op |
| | | 21 | | { |
| | 3 | 22 | | hostBuilder.ConfigureUnixDomainSocket(options); |
| | 3 | 23 | | return hostBuilder; |
| | | 24 | | } |
| | | 25 | | |
| | | 26 | | internal static IHostBuilder ConfigureUnixDomainSocket(this IHostBuilder hostBuilder, Action<UnixDomainSocketOpt |
| | | 27 | | { |
| | 3 | 28 | | return hostBuilder.ConfigureServices((builderContext, services) => { |
| | 3 | 29 | | services.AddNetFramingServices(); |
| | 3 | 30 | | services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, UnixDomainSocketHostedService>()); |
| | 3 | 31 | | services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<UnixDomainSocketOptions>, UnixDo |
| | 3 | 32 | | services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<KestrelServerOptions>, UnixDomai |
| | 3 | 33 | | services.TryAddSingleton<SocketTransportFactory>(); |
| | 3 | 34 | | services.Configure(options); |
| | 6 | 35 | | }); |
| | | 36 | | } |
| | | 37 | | |
| | | 38 | | } |
| | | 39 | | |
| | | 40 | | } |
| | | 41 | | |