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)
323 references to ListenOptions
Aspire.Dashboard (1)
Aspire.Dashboard.Tests (1)
Aspire.Hosting (1)
InMemory.FunctionalTests (69)
Microsoft.AspNetCore.Server.Kestrel.Core (191)
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 (65)
21/// Extension methods for <see cref="ListenOptions"/> that configure Kestrel to use HTTPS for a given endpoint.
29/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
30/// <returns>The <see cref="ListenOptions"/>.</returns>
31public static ListenOptions UseHttps(this ListenOptions listenOptions) => listenOptions.UseHttps(_ => { });
36/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
39/// <returns>The <see cref="ListenOptions"/>.</returns>
40public static ListenOptions UseHttps(this ListenOptions listenOptions, string fileName)
49/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
53/// <returns>The <see cref="ListenOptions"/>.</returns>
54public static ListenOptions UseHttps(this ListenOptions listenOptions, string fileName, string? password)
63/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
67/// <returns>The <see cref="ListenOptions"/>.</returns>
68public static ListenOptions UseHttps(this ListenOptions listenOptions, string fileName, string? password,
78/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
81/// <returns>The <see cref="ListenOptions"/>.</returns>
82public static ListenOptions UseHttps(this ListenOptions listenOptions, StoreName storeName, string subject)
88/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
92/// <returns>The <see cref="ListenOptions"/>.</returns>
93public static ListenOptions UseHttps(this ListenOptions listenOptions, StoreName storeName, string subject, bool allowInvalid)
99/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
104/// <returns>The <see cref="ListenOptions"/>.</returns>
105public static ListenOptions UseHttps(this ListenOptions listenOptions, StoreName storeName, string subject, bool allowInvalid, StoreLocation location)
111/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
117/// <returns>The <see cref="ListenOptions"/>.</returns>
118public static ListenOptions UseHttps(this ListenOptions listenOptions, StoreName storeName, string subject, bool allowInvalid, StoreLocation location,
127/// <param name="listenOptions"> The <see cref="ListenOptions"/> to configure.</param>
129/// <returns>The <see cref="ListenOptions"/>.</returns>
130public static ListenOptions UseHttps(this ListenOptions listenOptions, X509Certificate2 serverCertificate)
143/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
146/// <returns>The <see cref="ListenOptions"/>.</returns>
147public static ListenOptions UseHttps(this ListenOptions listenOptions, X509Certificate2 serverCertificate,
163/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
165/// <returns>The <see cref="ListenOptions"/>.</returns>
166public static ListenOptions UseHttps(this ListenOptions listenOptions, Action<HttpsConnectionAdapterOptions> configureOptions)
193/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
195/// <returns>The <see cref="ListenOptions"/>.</returns>
196public static ListenOptions UseHttps(this ListenOptions listenOptions, HttpsConnectionAdapterOptions httpsOptions)
217/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
220/// <returns>The <see cref="ListenOptions"/>.</returns>
221public static ListenOptions UseHttps(this ListenOptions listenOptions, ServerOptionsSelectionCallback serverOptionsSelectionCallback, object state)
230/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
234/// <returns>The <see cref="ListenOptions"/>.</returns>
235public static ListenOptions UseHttps(this ListenOptions listenOptions, ServerOptionsSelectionCallback serverOptionsSelectionCallback, object state, TimeSpan handshakeTimeout)
249/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
251/// <returns>The <see cref="ListenOptions"/>.</returns>
252public static ListenOptions UseHttps(this ListenOptions listenOptions, TlsHandshakeCallbackOptions callbackOptions)
289/// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
303/// <returns>The <see cref="ListenOptions"/>.</returns>
304public static ListenOptions UseTlsClientHelloListener(this ListenOptions listenOptions, Action<ConnectionContext, ReadOnlySequence<byte>> tlsClientHelloBytesCallback, TimeSpan? timeout = null)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (23)
AddressBinderTests.cs (14)
19private readonly Func<ListenOptions, ListenOptions> _noopUseHttps = l => l;
58var listenOptions = AddressBinder.ParseAddress($"http://{host}", out var https);
82var listenOptions = AddressBinder.ParseAddress($"http://*:80", out var https);
99var listenOptions = AddressBinder.ParseAddress("http://localhost", out var https);
117var listenOptions = AddressBinder.ParseAddress(address, out var https);
135var listenOptions = AddressBinder.ParseAddress("http://pipe:8080", out var https);
145var listenOptions = AddressBinder.ParseAddress(address, out var https);
156var listenOptions = AddressBinder.ParseAddress(address, out var https);
167var listenOptions = AddressBinder.ParseAddress(address, out var https);
178var listenOptions = AddressBinder.ParseAddress("http://unix:/tmp/kestrel-test.sock", out var https);
189var listenOptions = AddressBinder.ParseAddress(@"http://unix:/c:/foo/bar/pipe.socket", out var https);
203var listenOptions = AddressBinder.ParseAddress(address, out var https);
355var endpoints = new List<ListenOptions>();
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (2)
Microsoft.AspNetCore.Server.Kestrel.Tests (12)
Sockets.BindTests (4)
Sockets.FunctionalTests (19)