class Arachni::OptionGroups::Dispatcher

Holds options for {RPC::Server::Dispatcher} servers.

@author Tasos “Zapotek” Laskos <tasos.laskos@arachni-scanner.com>

Constants

GRID_MODES

@return [Array<Symbol>] Supported {#grid_mode grid modes}.

Attributes

external_address[RW]

@return [String]

External (hostname or IP) address for the {RPC::Server::Dispatcher}
to advertise.
grid_mode[RW]

@return [nil, Symbol]

Grid mode to use for multi-{RPC::Server::Instance} scans with
interconnected {RPC::Server::Dispatcher}s, available modes are:

* `nil` -- No grid.
* `:balance` -- Default load balancing across available Dispatchers.
* `:aggregate` -- Default load balancing **with** line aggregation.
    Will only request Instances from Grid members with different
    {OptionGroups::Dispatcher#node_pipe_id Pipe-IDs}.
instance_port_range[RW]

@return [Array<Integer>]

Range of ports to use when spawning instances, first entry should be
the lowest port number, last the max port number.
neighbour[RW]

@return [String]

The URL of a neighbouring {RPC::Server::Dispatcher}, applicable when
{RPC::Server::Dispatcher} are connected to each other to form a Grid.

@see RPC::Server::Dispatcher::Node

node_cost[RW]

@return [Float]

Cost of using this Dispatcher node.
node_nickname[RW]

@return [String]

Dispatcher node nickname.
node_ping_interval[RW]

@return [Float]

How soon to check for {OptionGroups::Dispatcher#neighbour} node status.
node_pipe_id[RW]

@return [String]

A string identifying the bandwidth pipe used by this Dispatcher node.
node_weight[RW]

@return [Float]

Weight used to calculate the score of this Dispatcher node.
pool_size[RW]

@return [Integer]

Amount of {RPC::Server::Instance}s to keep in the
{RPC::Server::Dispatcher} pool.
url[RW]

@return [String]

URL of a {RPC::Server::Dispatcher} (used by the {UI::CLI::RPC} client
interface).

Public Instance Methods

grid=( bool ) click to toggle source

@param [Bool] bool

`true` to use the Grid, `false` otherwise. Serves as a shorthand to
setting {OptionGroups::Dispatcher#grid_mode} to `:balance`.
# File lib/arachni/option_groups/dispatcher.rb, line 92
def grid=( bool )
    @grid_mode = bool ? :balance : nil
end
grid?() click to toggle source

@return [Bool]

`true` if the Grid should be used, `false` otherwise.
# File lib/arachni/option_groups/dispatcher.rb, line 85
def grid?
    !!@grid_mode
end
grid_aggregate?() click to toggle source

@return [Bool]

`true` if the grid mode is in line-aggregation mode, `false` otherwise.
# File lib/arachni/option_groups/dispatcher.rb, line 121
def grid_aggregate?
    @grid_mode == :aggregate
end
grid_balance?() click to toggle source

@return [Bool]

`true` if the grid mode is in load-balancing mode, `false` otherwise.
# File lib/arachni/option_groups/dispatcher.rb, line 127
def grid_balance?
    @grid_mode == :balance
end
grid_mode=( mode ) click to toggle source

@param [String, Symbol] mode

Grid mode to use for multi-{RPC::Server::Instance} scans with
interconnected {RPC::Server::Dispatcher}s, available modes are:

* `nil` -- No grid.
* `:balance` -- Default load balancing across available Dispatchers.
* `:aggregate` -- Default load balancing **with** line aggregation.
    Will only request Instances from Grid members with different
    {OptionGroups::Dispatcher#node_pipe_id Pipe-IDs}.

@raise [ArgumentError]

On invalid mode.
# File lib/arachni/option_groups/dispatcher.rb, line 108
def grid_mode=( mode )
    return @grid_mode = nil if !mode

    mode = mode.to_sym
    if !GRID_MODES.include?( mode )
        fail ArgumentError, "Unknown grid mode: #{mode}"
    end

    @grid_mode = mode
end