|
|
@@ -2,6 +2,7 @@
|
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
|
|
|
|
using System.Net;
|
|
|
+using System.Net.Sockets;
|
|
|
using Microsoft.AspNetCore.Connections;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
using Microsoft.Extensions.Options;
|
|
|
@@ -11,7 +12,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets;
|
|
|
/// <summary>
|
|
|
/// A factory for socket based connections.
|
|
|
/// </summary>
|
|
|
-public sealed class SocketTransportFactory : IConnectionListenerFactory
|
|
|
+public sealed class SocketTransportFactory : IConnectionListenerFactory, IConnectionListenerFactorySelector
|
|
|
{
|
|
|
private readonly SocketTransportOptions _options;
|
|
|
private readonly ILoggerFactory _logger;
|
|
|
@@ -40,4 +41,16 @@ public sealed class SocketTransportFactory : IConnectionListenerFactory
|
|
|
transport.Bind();
|
|
|
return new ValueTask<IConnectionListener>(transport);
|
|
|
}
|
|
|
+
|
|
|
+ /// <inheritdoc />
|
|
|
+ public bool CanBind(EndPoint endpoint)
|
|
|
+ {
|
|
|
+ return endpoint switch
|
|
|
+ {
|
|
|
+ IPEndPoint _ => true,
|
|
|
+ UnixDomainSocketEndPoint _ => true,
|
|
|
+ FileHandleEndPoint _ => true,
|
|
|
+ _ => false
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|