Skip to content

QuantumGate::Access::Manager::AddIPSubnetLimit

Karel Donk edited this page Dec 11, 2019 · 2 revisions

Adds an IP subnet limit to the instance. An IP subnet limit can be used to set a limit on the number of connections that are allowed from a certain IP subnet. This can be used, for example, to prevent an attacker from flooding a peer with connections from a subnet that they control.

Signature

  1. Result<> AddIPSubnetLimit(const IPAddress::Family af,
                              const String& cidr_lbits_str,
                              const Size max_con) noexcept;
  2. Result<> AddIPSubnetLimit(const IPAddress::Family af,
                              const UInt8 cidr_lbits,
                              const Size max_con) noexcept;

Parameters

Name Description
af The address family for which to add the subnet limit. See QuantumGate::IPAddress::Family for more details.
cidr_lbits The CIDR leading bits to use for the subnet, e.g. 24.
cidr_lbits_str The CIDR leading bits to use for the subnet, e.g. /24.
max_con The maximum number of allowed connections.

Return values

Returns a QuantumGate::Result object equal to one of the following QuantumGate::ResultCodes:

Value Description
QuantumGate::ResultCode::Succeeded The operation succeeded.
QuantumGate::ResultCode::Failed The operation failed.
QuantumGate::ResultCode::InvalidArgument The operation failed because an invalid argument was passed through.
Clone this wiki locally