Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Export PeerPoolConfig interface internally on P2P library
Browse files Browse the repository at this point in the history
  • Loading branch information
diego-G committed Sep 12, 2019
1 parent 6850c3b commit fe25501
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions elements/lisk-p2p/src/peer_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,6 @@ import {
} from './peer';
import { constructPeerIdFromPeerInfo, getUniquePeersbyIp } from './utils';

interface PeerPoolConfig {
readonly ackTimeout?: number;
readonly connectTimeout?: number;
readonly wsMaxPayload?: number;
readonly maxPeerInfoSize: number;
readonly peerSelectionForSend: P2PPeerSelectionForSendFunction;
readonly peerSelectionForRequest: P2PPeerSelectionForRequestFunction;
readonly peerSelectionForConnection: P2PPeerSelectionForConnectionFunction;
readonly sendPeerLimit: number;
readonly peerBanTime: number;
readonly maxOutboundConnections: number;
readonly maxInboundConnections: number;
readonly maxPeerDiscoveryResponseLength: number;
readonly outboundShuffleInterval: number;
readonly netgroupProtectionRatio: number;
readonly latencyProtectionRatio: number;
readonly productivityProtectionRatio: number;
readonly longevityProtectionRatio: number;
readonly wsMaxMessageRate: number;
readonly wsMaxMessageRatePenalty: number;
readonly rateCalculationInterval: number;
readonly secret: number;
readonly peerLists: PeerLists;
}

interface FilterPeersOptions {
readonly category: PROTECTION_CATEGORY;
readonly percentage: number;
Expand Down Expand Up @@ -128,6 +103,31 @@ enum PROTECTION_CATEGORY {
CONNECT_TIME = 'connectTime',
}

export interface PeerPoolConfig {
readonly ackTimeout?: number;
readonly connectTimeout?: number;
readonly wsMaxPayload?: number;
readonly maxPeerInfoSize: number;
readonly peerSelectionForSend: P2PPeerSelectionForSendFunction;
readonly peerSelectionForRequest: P2PPeerSelectionForRequestFunction;
readonly peerSelectionForConnection: P2PPeerSelectionForConnectionFunction;
readonly sendPeerLimit: number;
readonly peerBanTime: number;
readonly maxOutboundConnections: number;
readonly maxInboundConnections: number;
readonly maxPeerDiscoveryResponseLength: number;
readonly outboundShuffleInterval: number;
readonly netgroupProtectionRatio: number;
readonly latencyProtectionRatio: number;
readonly productivityProtectionRatio: number;
readonly longevityProtectionRatio: number;
readonly wsMaxMessageRate: number;
readonly wsMaxMessageRatePenalty: number;
readonly rateCalculationInterval: number;
readonly secret: number;
readonly peerLists: PeerLists;
}

export class PeerPool extends EventEmitter {
private readonly _peerMap: Map<string, Peer>;
private readonly _peerPoolConfig: PeerPoolConfig;
Expand Down

0 comments on commit fe25501

Please sign in to comment.