kadence/hibernate~ HibernatePlugin

Represents a bandwidth meter which will trigger hibernation

Constructor

new HibernatePlugin(node, optionsopt)

Parameters:
NameTypeAttributesDescription
nodeKademliaNode
optionsobject<optional>
Properties
NameTypeAttributesDefaultDescription
limitstring<optional>
5gb

The accounting max bandwidth

intervalstring<optional>
1d

The accounting reset interval

rejectArray.<string><optional>

List of methods to reject during hibernation

Members

hibernating

Properties
NameTypeDescription
hibernatingboolean

Indicates if our limits are reached

Methods

detect(request, response, next)

Check if hibernating when messages received

Parameters:
NameTypeDescription
requestAbstractNode~request
responseAbstractNode~response
nextAbstractNode~next

meter(type) → {stream.Transform}

Return a meter stream that increments the given accounting property

Parameters:
NameTypeDescription
typestring

['inbound', 'outbound', 'unknown']

Returns:
Type: 
stream.Transform

start()

Starts the accounting reset timeout