< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Hosting.Options.ListenerOptions
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Hosting/Options/ListenerOptions.cs
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 59
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 08/26/2025 - 01:25:22 Line coverage: 100% (12/12) Total lines: 40 Tag: Kestrun/Kestrun@07f821172e5dc3657f1be7e6818f18d6721cf38a09/09/2025 - 21:56:59 Line coverage: 100% (13/13) Total lines: 54 Tag: Kestrun/Kestrun@739093f321f10605cc4d1029da7300e3bb4dcba910/13/2025 - 16:52:37 Line coverage: 100% (14/14) Branch coverage: 100% (2/2) Total lines: 59 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e 10/13/2025 - 16:52:37 Line coverage: 100% (14/14) Branch coverage: 100% (2/2) Total lines: 59 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_IPAddress()100%11100%
get_Port()100%11100%
get_UseHttps()100%11100%
get_Protocols()100%11100%
get_UseConnectionLogging()100%11100%
get_X509Certificate()100%11100%
get_DisableAltSvcHeader()100%11100%
.ctor()100%11100%
ToString()100%22100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Hosting/Options/ListenerOptions.cs

#LineLine coverage
 1using System.Net;
 2using System.Security.Cryptography.X509Certificates;
 3using Microsoft.AspNetCore.Server.Kestrel.Core;
 4
 5namespace Kestrun.Hosting.Options;
 6
 7/// <summary>
 8/// Configuration for an individual Kestrel listener.
 9/// </summary>
 10public class ListenerOptions
 11{
 12    /// <summary>The IP address to bind to.</summary>
 14013    public IPAddress IPAddress { get; set; }
 14
 15    /// <summary>The port to listen on.</summary>
 9516    public int Port { get; set; }
 17
 18    /// <summary>Whether HTTPS should be used.</summary>
 12919    public bool UseHttps { get; set; }
 20
 21    /// <summary>HTTP protocols supported by the listener.</summary>
 12322    public HttpProtocols Protocols { get; set; }
 23
 24    /// <summary>Enable verbose connection logging.</summary>
 12025    public bool UseConnectionLogging { get; set; }
 26
 27    /// <summary>Optional TLS certificate.</summary>
 4328    public X509Certificate2? X509Certificate { get; internal set; }
 29
 30    /// <summary>
 31    /// Gets or sets a value that controls whether the "Alt-Svc" header is included with response headers.
 32    /// The "Alt-Svc" header is used by clients to upgrade HTTP/1.1 and HTTP/2 connections to HTTP/3.
 33    /// <para>
 34    /// The "Alt-Svc" header is automatically included with a response if <see cref="Protocols"/> has either
 35    /// HTTP/1.1 or HTTP/2 enabled, and HTTP/3 is enabled. If an "Alt-Svc" header value has already been set
 36    /// by the app then it isn't changed.
 37    /// </para>
 38    /// </summary>
 39    /// <remarks>
 40    /// Defaults to false.
 41    /// </remarks>
 3342    public bool DisableAltSvcHeader { get; set; }
 43
 44    /// <summary>
 45    /// Initializes a new instance of the <see cref="ListenerOptions"/> class with default values.
 46    /// </summary>
 4947    public ListenerOptions()
 48    {
 4949        IPAddress = IPAddress.Any;
 4950        UseHttps = false;
 4951        Protocols = HttpProtocols.Http1;
 4952        UseConnectionLogging = false;
 4953    }
 54    /// <summary>
 55    /// Returns a string representation of the listener in the format "http(s)://{IPAddress}:{Port}".
 56    /// </summary>
 57    /// <returns>A string representation of the listener.</returns>
 658    public override string ToString() => $"{(UseHttps ? "https" : "http")}://{IPAddress}:{Port}";
 59}