Show / Hide Table of Contents

    Class SimpleDosDefender

    Class that represents a simple DoS defender that will block addresses but not unblock them (until the application is restarted, since state is not persisted). This is helpful only with high connection attempt counts.

    Inheritance
    System.Object
    SimpleDosDefender
    Implements
    IDoSDefender
    Microsoft.Extensions.Hosting.IHostedService
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Fibula.Security
    Assembly: Fibula.Security.dll
    Syntax
    public class SimpleDosDefender : IDoSDefender, IHostedService

    Constructors

    | Improve this Doc View Source

    SimpleDosDefender(IOptions<SimpleDosDefenderOptions>)

    Initializes a new instance of the SimpleDosDefender class.

    Declaration
    public SimpleDosDefender(IOptions<SimpleDosDefenderOptions> options)
    Parameters
    Type Name Description
    Microsoft.Extensions.Options.IOptions<SimpleDosDefenderOptions> options

    The options for this defender.

    Properties

    | Improve this Doc View Source

    Options

    Gets the options set for this defender.

    Declaration
    public SimpleDosDefenderOptions Options { get; }
    Property Value
    Type Description
    SimpleDosDefenderOptions

    Methods

    | Improve this Doc View Source

    BlockAddress(String)

    Blocks a given address.

    Declaration
    public void BlockAddress(string addressStr)
    Parameters
    Type Name Description
    System.String addressStr

    The address to block.

    | Improve this Doc View Source

    IsBlocked(String)

    Checks if a given address is blocked.

    Declaration
    public bool IsBlocked(string addressStr)
    Parameters
    Type Name Description
    System.String addressStr

    The address to check for.

    Returns
    Type Description
    System.Boolean

    True if the address is blocked, false otherwise.

    | Improve this Doc View Source

    LogConnectionAttempt(String)

    Logs a connection attempt.

    Declaration
    public void LogConnectionAttempt(string addressStr)
    Parameters
    Type Name Description
    System.String addressStr

    The address from which the connection attempt took place.

    | Improve this Doc View Source

    StartAsync(CancellationToken)

    Starts the defender service.

    Declaration
    public Task StartAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken

    A token to observe for cancellation.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the result of the asynchronous operation.

    | Improve this Doc View Source

    StopAsync(CancellationToken)

    Stops the defender service.

    Declaration
    public Task StopAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken

    A token to observe for cancellation.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Implements

    IDoSDefender
    Microsoft.Extensions.Hosting.IHostedService

    Extension Methods

    ObjectExtensions.YieldSingleItem<T>(T)
    ObjectExtensions.GetPropertyValue(Object, String)
    Validate.ThrowIfNull(Object, String)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2018-2020 | The Fibula Project
    Generated using DocFX | Jose L. Nuñez de Caceres et al.