2 types derived from ListenOptions
Microsoft.AspNetCore.Server.Kestrel.Core (2)
56 instantiations of ListenOptions
InMemory.FunctionalTests (28)
Microsoft.AspNetCore.Server.Kestrel.Core (8)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (6)
Sockets.BindTests (2)
Sockets.FunctionalTests (12)
314 references to ListenOptions
Aspire.Dashboard (1)
Aspire.Dashboard.Tests (1)
Aspire.Hosting (1)
InMemory.FunctionalTests (65)
Microsoft.AspNetCore.Server.Kestrel.Core (187)
Internal\AddressBinder.cs (21)
19public static Task BindAsync(ListenOptions[] listenOptions, AddressBindContext context, Func<ListenOptions, ListenOptions> useHttps, CancellationToken cancellationToken)
35private static IStrategy CreateStrategy(ListenOptions[] listenOptions, string[] addresses, bool preferAddresses, Func<ListenOptions, ListenOptions> useHttps)
86internal static async Task BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
100internal static ListenOptions ParseAddress(string address, out bool https)
119ListenOptions? options = null;
177var httpDefault = ParseAddress(Constants.DefaultServerAddress, out _);
190public OverrideWithAddressesStrategy(IReadOnlyCollection<string> addresses, Func<ListenOptions, ListenOptions> useHttps)
211public OverrideWithEndpointsStrategy(IReadOnlyCollection<ListenOptions> endpoints, string[] originalAddresses)
230private readonly IReadOnlyCollection<ListenOptions> _endpoints;
232public EndpointsStrategy(IReadOnlyCollection<ListenOptions> endpoints)
239foreach (var endpoint in _endpoints)
249private readonly Func<ListenOptions, ListenOptions> _useHttps;
251public AddressesStrategy(IReadOnlyCollection<string> addresses, Func<ListenOptions, ListenOptions> useHttps)
261var options = ParseAddress(address, out var https);
KestrelConfigurationLoader.cs (17)
101public KestrelConfigurationLoader Endpoint(IPAddress address, int port, Action<ListenOptions> configure)
116public KestrelConfigurationLoader Endpoint(IPEndPoint endPoint, Action<ListenOptions> configure)
139public KestrelConfigurationLoader LocalhostEndpoint(int port, Action<ListenOptions> configure)
159public KestrelConfigurationLoader AnyIPEndpoint(int port, Action<ListenOptions> configure)
179public KestrelConfigurationLoader UnixSocketEndpoint(string socketPath, Action<ListenOptions> configure)
204public KestrelConfigurationLoader NamedPipeEndpoint(string pipeName, Action<ListenOptions> configure)
225public KestrelConfigurationLoader HandleEndpoint(ulong handle, Action<ListenOptions> configure)
239internal void ApplyEndpointDefaults(ListenOptions listenOptions)
335internal (List<ListenOptions>, List<ListenOptions>) Reload()
343var endpointsToStart = new List<ListenOptions>();
344var endpointsToReuse = new List<ListenOptions>();
363var listenOptions = AddressBinder.ParseAddress(endpoint.Url, out var https);
394var matchingBoundEndpoints = new List<ListenOptions>();
395foreach (var o in endpointsToStop)
457foreach (var endpointToStart in endpointsToStart)
481foreach (var endpointToStop in endpointsToStop)
KestrelServerOptions.cs (28)
74internal List<ListenOptions> CodeBackedListenOptions { get; } = new List<ListenOptions>();
75internal List<ListenOptions> ConfigurationBackedListenOptions { get; } = new List<ListenOptions>();
77internal ListenOptions[] GetListenOptions()
82return Array.Empty<ListenOptions>();
85var result = new ListenOptions[resultCount];
92internal List<ListenOptions> OptionsInUse { get; } = new List<ListenOptions>();
151[Obsolete($"This property is obsolete and will be removed in a future version. It no longer has any impact on runtime behavior. Use {nameof(Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions)}.{nameof(Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.DisableAltSvcHeader)} to configure \"Alt-Svc\" behavior.", error: true)]
194private Action<ListenOptions> EndpointDefaults { get; set; } = _ => { };
259public void ConfigureEndpointDefaults(Action<ListenOptions> configureOptions)
264internal void ApplyEndpointDefaults(ListenOptions listenOptions)
364writer.WritePropertyName(nameof(ListenOptions));
366foreach (var listenOptions in OptionsInUse)
485public void Listen(IPAddress address, int port, Action<ListenOptions> configure)
513public void Listen(IPEndPoint endPoint, Action<ListenOptions> configure)
522public void Listen(EndPoint endPoint, Action<ListenOptions> configure)
527var listenOptions = new ListenOptions(endPoint);
543public void ListenLocalhost(int port, Action<ListenOptions> configure)
561public void ListenAnyIP(int port, Action<ListenOptions> configure)
583public void ListenUnixSocket(string socketPath, Action<ListenOptions> configure)
593var listenOptions = new ListenOptions(socketPath);
611public void ListenHandle(ulong handle, Action<ListenOptions> configure)
615var listenOptions = new ListenOptions(handle);
633public void ListenNamedPipe(string pipeName, Action<ListenOptions> configure)
638var listenOptions = new ListenOptions(new NamedPipeEndPoint(pipeName));
ListenOptionsHttpsExtensions.cs (61)
17/// Extension methods for <see cref="ListenOptions"/> that configure Kestrel to use HTTPS for a given endpoint.
25/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
26/// <returns>The <see cref="ListenOptions"/>.</returns>
27public static ListenOptions UseHttps(this ListenOptions listenOptions) => listenOptions.UseHttps(_ => { });
32/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
35/// <returns>The <see cref="ListenOptions"/>.</returns>
36public static ListenOptions UseHttps(this ListenOptions listenOptions, string fileName)
45/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
49/// <returns>The <see cref="ListenOptions"/>.</returns>
50public static ListenOptions UseHttps(this ListenOptions listenOptions, string fileName, string? password)
59/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
63/// <returns>The <see cref="ListenOptions"/>.</returns>
64public static ListenOptions UseHttps(this ListenOptions listenOptions, string fileName, string? password,
74/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
77/// <returns>The <see cref="ListenOptions"/>.</returns>
78public static ListenOptions UseHttps(this ListenOptions listenOptions, StoreName storeName, string subject)
84/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
88/// <returns>The <see cref="ListenOptions"/>.</returns>
89public static ListenOptions UseHttps(this ListenOptions listenOptions, StoreName storeName, string subject, bool allowInvalid)
95/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
100/// <returns>The <see cref="ListenOptions"/>.</returns>
101public static ListenOptions UseHttps(this ListenOptions listenOptions, StoreName storeName, string subject, bool allowInvalid, StoreLocation location)
107/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
113/// <returns>The <see cref="ListenOptions"/>.</returns>
114public static ListenOptions UseHttps(this ListenOptions listenOptions, StoreName storeName, string subject, bool allowInvalid, StoreLocation location,
123/// <param name="listenOptions"> The <see cref="ListenOptions"/> to configure.</param>
125/// <returns>The <see cref="ListenOptions"/>.</returns>
126public static ListenOptions UseHttps(this ListenOptions listenOptions, X509Certificate2 serverCertificate)
139/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
142/// <returns>The <see cref="ListenOptions"/>.</returns>
143public static ListenOptions UseHttps(this ListenOptions listenOptions, X509Certificate2 serverCertificate,
159/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
161/// <returns>The <see cref="ListenOptions"/>.</returns>
162public static ListenOptions UseHttps(this ListenOptions listenOptions, Action<HttpsConnectionAdapterOptions> configureOptions)
189/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
191/// <returns>The <see cref="ListenOptions"/>.</returns>
192public static ListenOptions UseHttps(this ListenOptions listenOptions, HttpsConnectionAdapterOptions httpsOptions)
213/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
216/// <returns>The <see cref="ListenOptions"/>.</returns>
217public static ListenOptions UseHttps(this ListenOptions listenOptions, ServerOptionsSelectionCallback serverOptionsSelectionCallback, object state)
226/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
230/// <returns>The <see cref="ListenOptions"/>.</returns>
231public static ListenOptions UseHttps(this ListenOptions listenOptions, ServerOptionsSelectionCallback serverOptionsSelectionCallback, object state, TimeSpan handshakeTimeout)
245/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
247/// <returns>The <see cref="ListenOptions"/>.</returns>
248public static ListenOptions UseHttps(this ListenOptions listenOptions, TlsHandshakeCallbackOptions callbackOptions)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (22)
AddressBinderTests.cs (13)
18private readonly Func<ListenOptions, ListenOptions> _noopUseHttps = l => l;
57var listenOptions = AddressBinder.ParseAddress($"http://{host}", out var https);
68var listenOptions = AddressBinder.ParseAddress("http://localhost", out var https);
86var listenOptions = AddressBinder.ParseAddress(address, out var https);
104var listenOptions = AddressBinder.ParseAddress("http://pipe:8080", out var https);
114var listenOptions = AddressBinder.ParseAddress(address, out var https);
125var listenOptions = AddressBinder.ParseAddress(address, out var https);
136var listenOptions = AddressBinder.ParseAddress(address, out var https);
147var listenOptions = AddressBinder.ParseAddress("http://unix:/tmp/kestrel-test.sock", out var https);
158var listenOptions = AddressBinder.ParseAddress(@"http://unix:/c:/foo/bar/pipe.socket", out var https);
172var listenOptions = AddressBinder.ParseAddress(address, out var https);
324var endpoints = new List<ListenOptions>();
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (2)
Microsoft.AspNetCore.Server.Kestrel.Tests (12)
Sockets.BindTests (4)
Sockets.FunctionalTests (19)