libp2p
    Preparing search index...

    Interface PeerScoreParams

    interface PeerScoreParams {
        appSpecificWeight: number;
        behaviourPenaltyDecay: number;
        behaviourPenaltyThreshold: number;
        behaviourPenaltyWeight: number;
        decayInterval: number;
        decayToZero: number;
        IPColocationFactorThreshold: number;
        IPColocationFactorWeight: number;
        IPColocationFactorWhitelist: Set<string>;
        retainScore: number;
        topics: Record<string, TopicScoreParams>;
        topicScoreCap: number;
        appSpecificScore(p: string): number;
    }
    Index

    Properties

    appSpecificWeight: number
    behaviourPenaltyDecay: number
    behaviourPenaltyThreshold: number
    behaviourPenaltyWeight: number

    P7: behavioural pattern penalties. This parameter has an associated counter which tracks misbehaviour as detected by the router. The router currently applies penalties for the following behaviors:

    • attempting to re-graft before the prune backoff time has elapsed.
    • not following up in IWANT requests for messages advertised with IHAVE.

    The value of the parameter is the square of the counter, which decays with BehaviourPenaltyDecay. The weight of the parameter MUST be negative (or zero to disable).

    decayInterval: number

    the decay interval for parameter counters.

    decayToZero: number

    counter value below which it is considered 0.

    IPColocationFactorThreshold: number
    IPColocationFactorWeight: number

    P6: IP-colocation factor. The parameter has an associated counter which counts the number of peers with the same IP. If the number of peers in the same IP exceeds IPColocationFactorThreshold, then the value is the square of the difference, ie (PeersInSameIP - IPColocationThreshold)^2. If the number of peers in the same IP is less than the threshold, then the value is 0. The weight of the parameter MUST be negative, unless you want to disable for testing. Note: In order to simulate many IPs in a managable manner when testing, you can set the weight to 0 thus disabling the IP colocation penalty.

    IPColocationFactorWhitelist: Set<string>
    retainScore: number

    time to remember counters for a disconnected peer.

    topics: Record<string, TopicScoreParams>

    Score parameters per topic.

    topicScoreCap: number

    Aggregate topic score cap; this limits the total contribution of topics towards a positive score. It must be positive (or 0 for no cap).

    Methods