@libp2p/gossipsub 15.0.17 → 15.0.19-8ddbb9e81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +1 -4
- package/dist/index.min.js.map +4 -4
- package/dist/src/gossipsub.d.ts +6 -6
- package/dist/src/gossipsub.js +19 -19
- package/dist/src/index.d.ts +6 -6
- package/dist/src/index.js +2 -2
- package/dist/src/message/index.d.ts +1 -1
- package/dist/src/message/index.js +1 -1
- package/dist/src/message-cache.d.ts +2 -2
- package/dist/src/metrics.d.ts +4 -4
- package/dist/src/metrics.js +1 -1
- package/dist/src/score/compute-score.d.ts +2 -2
- package/dist/src/score/index.d.ts +3 -3
- package/dist/src/score/index.js +3 -3
- package/dist/src/score/peer-score.d.ts +4 -4
- package/dist/src/score/peer-score.js +3 -3
- package/dist/src/score/scoreMetrics.d.ts +2 -2
- package/dist/src/tracer.d.ts +3 -3
- package/dist/src/tracer.js +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/utils/index.d.ts +3 -3
- package/dist/src/utils/index.js +3 -3
- package/package.json +27 -22
- package/src/gossipsub.ts +24 -24
- package/src/index.ts +7 -7
- package/src/message/index.ts +1 -1
- package/src/message-cache.ts +2 -2
- package/src/metrics.ts +4 -4
- package/src/score/compute-score.ts +2 -2
- package/src/score/index.ts +3 -3
- package/src/score/peer-score.ts +5 -5
- package/src/score/scoreMetrics.ts +2 -2
- package/src/tracer.ts +3 -3
- package/src/types.ts +1 -1
- package/src/utils/index.ts +3 -3
- package/dist/typedoc-urls.json +0 -195
package/dist/src/gossipsub.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TypedEventEmitter, serviceCapabilities, serviceDependencies } from '@libp2p/interface';
|
|
2
2
|
import { StrictNoSign, StrictSign, TopicValidatorResult } from './index.ts';
|
|
3
|
-
import { RPC } from './message/rpc.
|
|
4
|
-
import { PeerScore } from './score/index.
|
|
5
|
-
import { InboundStream, OutboundStream } from './stream.
|
|
6
|
-
import { IWantTracer } from './tracer.
|
|
3
|
+
import { RPC } from './message/rpc.ts';
|
|
4
|
+
import { PeerScore } from './score/index.ts';
|
|
5
|
+
import { InboundStream, OutboundStream } from './stream.ts';
|
|
6
|
+
import { IWantTracer } from './tracer.ts';
|
|
7
7
|
import type { GossipSubComponents, GossipSubEvents, GossipsubOpts, PublishResult, TopicValidatorFn } from './index.ts';
|
|
8
|
-
import type { PeerScoreParams, PeerScoreThresholds, PeerScoreStatsDump } from './score/index.
|
|
9
|
-
import type { TopicStr, MsgIdStr, PeerIdStr, PublishOpts } from './types.
|
|
8
|
+
import type { PeerScoreParams, PeerScoreThresholds, PeerScoreStatsDump } from './score/index.ts';
|
|
9
|
+
import type { TopicStr, MsgIdStr, PeerIdStr, PublishOpts } from './types.ts';
|
|
10
10
|
import type { PeerId, Logger, TypedEventTarget } from '@libp2p/interface';
|
|
11
11
|
interface GossipOptions extends GossipsubOpts {
|
|
12
12
|
scoreParams: PeerScoreParams;
|
package/dist/src/gossipsub.js
CHANGED
|
@@ -4,26 +4,26 @@ import { encode } from 'it-length-prefixed';
|
|
|
4
4
|
import { pipe } from 'it-pipe';
|
|
5
5
|
import { pushable } from 'it-pushable';
|
|
6
6
|
import * as Digest from 'multiformats/hashes/digest';
|
|
7
|
-
import * as constants from
|
|
8
|
-
import { ACCEPT_FROM_WHITELIST_DURATION_MS, ACCEPT_FROM_WHITELIST_MAX_MESSAGES, ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE, BACKOFF_SLACK } from
|
|
7
|
+
import * as constants from "./constants.js";
|
|
8
|
+
import { ACCEPT_FROM_WHITELIST_DURATION_MS, ACCEPT_FROM_WHITELIST_MAX_MESSAGES, ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE, BACKOFF_SLACK } from "./constants.js";
|
|
9
9
|
import { StrictNoSign, StrictSign, TopicValidatorResult } from "./index.js";
|
|
10
|
-
import { defaultDecodeRpcLimits } from
|
|
11
|
-
import { RPC } from
|
|
12
|
-
import { MessageCache } from
|
|
13
|
-
import { ChurnReason, getMetrics, IHaveIgnoreReason, InclusionReason, ScorePenalty } from
|
|
14
|
-
import { PeerScore, createPeerScoreParams, createPeerScoreThresholds } from
|
|
15
|
-
import { computeAllPeersScoreWeights } from
|
|
16
|
-
import { InboundStream, OutboundStream } from
|
|
17
|
-
import { IWantTracer } from
|
|
18
|
-
import { ValidateError, MessageStatus, RejectReason, rejectReasonFromAcceptance } from
|
|
19
|
-
import { buildRawMessage, validateToRawMessage } from
|
|
20
|
-
import { createGossipRpc, ensureControl } from
|
|
21
|
-
import { shuffle, messageIdToString } from
|
|
22
|
-
import { msgIdFnStrictNoSign, msgIdFnStrictSign } from
|
|
23
|
-
import { multiaddrToIPStr } from
|
|
24
|
-
import { getPublishConfigFromPeerId } from
|
|
25
|
-
import { removeFirstNItemsFromSet, removeItemsFromSet } from
|
|
26
|
-
import { SimpleTimeCache } from
|
|
10
|
+
import { defaultDecodeRpcLimits } from "./message/decodeRpc.js";
|
|
11
|
+
import { RPC } from "./message/rpc.js";
|
|
12
|
+
import { MessageCache } from "./message-cache.js";
|
|
13
|
+
import { ChurnReason, getMetrics, IHaveIgnoreReason, InclusionReason, ScorePenalty } from "./metrics.js";
|
|
14
|
+
import { PeerScore, createPeerScoreParams, createPeerScoreThresholds } from "./score/index.js";
|
|
15
|
+
import { computeAllPeersScoreWeights } from "./score/scoreMetrics.js";
|
|
16
|
+
import { InboundStream, OutboundStream } from "./stream.js";
|
|
17
|
+
import { IWantTracer } from "./tracer.js";
|
|
18
|
+
import { ValidateError, MessageStatus, RejectReason, rejectReasonFromAcceptance } from "./types.js";
|
|
19
|
+
import { buildRawMessage, validateToRawMessage } from "./utils/buildRawMessage.js";
|
|
20
|
+
import { createGossipRpc, ensureControl } from "./utils/create-gossip-rpc.js";
|
|
21
|
+
import { shuffle, messageIdToString } from "./utils/index.js";
|
|
22
|
+
import { msgIdFnStrictNoSign, msgIdFnStrictSign } from "./utils/msgIdFn.js";
|
|
23
|
+
import { multiaddrToIPStr } from "./utils/multiaddr.js";
|
|
24
|
+
import { getPublishConfigFromPeerId } from "./utils/publishConfig.js";
|
|
25
|
+
import { removeFirstNItemsFromSet, removeItemsFromSet } from "./utils/set.js";
|
|
26
|
+
import { SimpleTimeCache } from "./utils/time-cache.js";
|
|
27
27
|
var GossipStatusCode;
|
|
28
28
|
(function (GossipStatusCode) {
|
|
29
29
|
GossipStatusCode[GossipStatusCode["started"] = 0] = "started";
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { MessageCache } from './message-cache.
|
|
2
|
-
import type { GossipsubOptsSpec } from './config.
|
|
3
|
-
import type { DecodeRPCLimits } from './message/decodeRpc.
|
|
4
|
-
import type { MetricsRegister, TopicStrToLabel } from './metrics.
|
|
5
|
-
import type { PeerScoreParams, PeerScoreThresholds } from './score/index.
|
|
6
|
-
import type { MsgIdFn, MsgIdStr, FastMsgIdFn, AddrInfo, DataTransform, MsgIdToStrFn } from './types.
|
|
1
|
+
import { MessageCache } from './message-cache.ts';
|
|
2
|
+
import type { GossipsubOptsSpec } from './config.ts';
|
|
3
|
+
import type { DecodeRPCLimits } from './message/decodeRpc.ts';
|
|
4
|
+
import type { MetricsRegister, TopicStrToLabel } from './metrics.ts';
|
|
5
|
+
import type { PeerScoreParams, PeerScoreThresholds } from './score/index.ts';
|
|
6
|
+
import type { MsgIdFn, MsgIdStr, FastMsgIdFn, AddrInfo, DataTransform, MsgIdToStrFn } from './types.ts';
|
|
7
7
|
import type { PeerId, PeerStore, ComponentLogger, PrivateKey, PublicKey, TypedEventTarget, MessageStreamDirection } from '@libp2p/interface';
|
|
8
8
|
import type { ConnectionManager, Registrar } from '@libp2p/interface-internal';
|
|
9
9
|
/**
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as constants from
|
|
1
|
+
import * as constants from "./constants.js";
|
|
2
2
|
import { GossipSub as GossipSubClass } from "./gossipsub.js";
|
|
3
|
-
import { MessageCache } from
|
|
3
|
+
import { MessageCache } from "./message-cache.js";
|
|
4
4
|
/**
|
|
5
5
|
* On the producing side:
|
|
6
6
|
* - Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './rpc.
|
|
1
|
+
export * from './rpc.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./rpc.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RPC } from './message/rpc.
|
|
2
|
-
import type { MessageId, MsgIdStr, PeerIdStr, TopicStr, MsgIdToStrFn } from './types.
|
|
1
|
+
import type { RPC } from './message/rpc.ts';
|
|
2
|
+
import type { MessageId, MsgIdStr, PeerIdStr, TopicStr, MsgIdToStrFn } from './types.ts';
|
|
3
3
|
export type CacheEntry = MessageId & {
|
|
4
4
|
topic: TopicStr;
|
|
5
5
|
};
|
package/dist/src/metrics.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TopicValidatorResult } from './index.ts';
|
|
2
|
-
import { MessageStatus, RejectReason } from './types.
|
|
3
|
-
import type { RPC } from './message/rpc.
|
|
4
|
-
import type { PeerScoreThresholds } from './score/peer-score-thresholds.
|
|
5
|
-
import type { PeerIdStr, RejectReasonObj, TopicStr, ValidateError } from './types.
|
|
2
|
+
import { MessageStatus, RejectReason } from './types.ts';
|
|
3
|
+
import type { RPC } from './message/rpc.ts';
|
|
4
|
+
import type { PeerScoreThresholds } from './score/peer-score-thresholds.ts';
|
|
5
|
+
import type { PeerIdStr, RejectReasonObj, TopicStr, ValidateError } from './types.ts';
|
|
6
6
|
/** Topic label as provided in `topicStrToLabel` */
|
|
7
7
|
export type TopicLabel = string;
|
|
8
8
|
export type TopicStrToLabel = Map<TopicStr, TopicLabel>;
|
package/dist/src/metrics.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PeerScoreParams } from './peer-score-params.
|
|
2
|
-
import type { PeerStats } from './peer-stats.
|
|
1
|
+
import type { PeerScoreParams } from './peer-score-params.ts';
|
|
2
|
+
import type { PeerStats } from './peer-stats.ts';
|
|
3
3
|
export declare function computeScore(peer: string, pstats: PeerStats, params: PeerScoreParams, peerIPs: Map<string, Set<string>>): number;
|
|
4
4
|
//# sourceMappingURL=compute-score.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './peer-score-params.
|
|
2
|
-
export * from './peer-score-thresholds.
|
|
3
|
-
export * from './peer-score.
|
|
1
|
+
export * from './peer-score-params.ts';
|
|
2
|
+
export * from './peer-score-thresholds.ts';
|
|
3
|
+
export * from './peer-score.ts';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/score/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./peer-score-params.js";
|
|
2
|
+
export * from "./peer-score-thresholds.js";
|
|
3
|
+
export * from "./peer-score.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RejectReason } from '../types.js';
|
|
2
2
|
import { MapDef } from '../utils/set.js';
|
|
3
|
-
import { computeScore } from './compute-score.
|
|
4
|
-
import { MessageDeliveries } from './message-deliveries.
|
|
3
|
+
import { computeScore } from './compute-score.ts';
|
|
4
|
+
import { MessageDeliveries } from './message-deliveries.ts';
|
|
5
5
|
import type { MsgIdStr, PeerIdStr, TopicStr } from '../types.js';
|
|
6
|
-
import type { PeerScoreParams } from './peer-score-params.
|
|
7
|
-
import type { PeerStats } from './peer-stats.
|
|
6
|
+
import type { PeerScoreParams } from './peer-score-params.ts';
|
|
7
|
+
import type { PeerStats } from './peer-stats.ts';
|
|
8
8
|
import type { Metrics, ScorePenalty } from '../metrics.js';
|
|
9
9
|
import type { ComponentLogger } from '@libp2p/interface';
|
|
10
10
|
interface PeerScoreOpts {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RejectReason } from '../types.js';
|
|
2
2
|
import { MapDef } from '../utils/set.js';
|
|
3
|
-
import { computeScore } from
|
|
4
|
-
import { MessageDeliveries, DeliveryRecordStatus } from
|
|
5
|
-
import { validatePeerScoreParams } from
|
|
3
|
+
import { computeScore } from "./compute-score.js";
|
|
4
|
+
import { MessageDeliveries, DeliveryRecordStatus } from "./message-deliveries.js";
|
|
5
|
+
import { validatePeerScoreParams } from "./peer-score-params.js";
|
|
6
6
|
export class PeerScore {
|
|
7
7
|
params;
|
|
8
8
|
metrics;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PeerScoreParams } from './peer-score-params.
|
|
2
|
-
import type { PeerStats } from './peer-stats.
|
|
1
|
+
import type { PeerScoreParams } from './peer-score-params.ts';
|
|
2
|
+
import type { PeerStats } from './peer-stats.ts';
|
|
3
3
|
type TopicLabel = string;
|
|
4
4
|
type TopicStr = string;
|
|
5
5
|
type TopicStrToLabel = Map<TopicStr, TopicLabel>;
|
package/dist/src/tracer.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RejectReason } from './types.
|
|
2
|
-
import type { Metrics } from './metrics.
|
|
3
|
-
import type { MsgIdStr, MsgIdToStrFn, PeerIdStr } from './types.
|
|
1
|
+
import { RejectReason } from './types.ts';
|
|
2
|
+
import type { Metrics } from './metrics.ts';
|
|
3
|
+
import type { MsgIdStr, MsgIdToStrFn, PeerIdStr } from './types.ts';
|
|
4
4
|
/**
|
|
5
5
|
* IWantTracer is an internal tracer that tracks IWANT requests in order to penalize
|
|
6
6
|
* peers who don't follow up on IWANT requests after an IHAVE advertisement.
|
package/dist/src/tracer.js
CHANGED
package/dist/src/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TopicValidatorResult } from './index.ts';
|
|
2
2
|
import type { Message } from './index.ts';
|
|
3
|
-
import type { RPC } from './message/rpc.
|
|
3
|
+
import type { RPC } from './message/rpc.ts';
|
|
4
4
|
import type { PrivateKey, PeerId } from '@libp2p/interface';
|
|
5
5
|
import type { Multiaddr } from '@multiformats/multiaddr';
|
|
6
6
|
export type MsgIdStr = string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './shuffle.
|
|
2
|
-
export * from './messageIdToString.
|
|
3
|
-
export { getPublishConfigFromPeerId } from './publishConfig.
|
|
1
|
+
export * from './shuffle.ts';
|
|
2
|
+
export * from './messageIdToString.ts';
|
|
3
|
+
export { getPublishConfigFromPeerId } from './publishConfig.ts';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/utils/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export { getPublishConfigFromPeerId } from
|
|
1
|
+
export * from "./shuffle.js";
|
|
2
|
+
export * from "./messageIdToString.js";
|
|
3
|
+
export { getPublishConfigFromPeerId } from "./publishConfig.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/gossipsub",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.19-8ddbb9e81",
|
|
4
4
|
"description": "A typescript implementation of gossipsub",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -13,23 +13,28 @@
|
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
15
|
"types": "./dist/src/index.d.ts",
|
|
16
|
-
"import": "./dist/src/index.js"
|
|
17
|
-
|
|
18
|
-
"./metrics": {
|
|
19
|
-
"types": "./dist/src/metrics.d.ts",
|
|
20
|
-
"import": "./dist/src/metrics.js"
|
|
16
|
+
"import": "./dist/src/index.js",
|
|
17
|
+
"module-sync": "./dist/src/index.js"
|
|
21
18
|
},
|
|
22
19
|
"./message": {
|
|
23
20
|
"types": "./dist/src/message/index.d.ts",
|
|
24
|
-
"import": "./dist/src/message/index.js"
|
|
21
|
+
"import": "./dist/src/message/index.js",
|
|
22
|
+
"module-sync": "./dist/src/message/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./metrics": {
|
|
25
|
+
"types": "./dist/src/metrics.d.ts",
|
|
26
|
+
"import": "./dist/src/metrics.js",
|
|
27
|
+
"module-sync": "./dist/src/metrics.js"
|
|
25
28
|
},
|
|
26
29
|
"./score": {
|
|
27
30
|
"types": "./dist/src/score/index.d.ts",
|
|
28
|
-
"import": "./dist/src/score/index.js"
|
|
31
|
+
"import": "./dist/src/score/index.js",
|
|
32
|
+
"module-sync": "./dist/src/score/index.js"
|
|
29
33
|
},
|
|
30
34
|
"./types": {
|
|
31
35
|
"types": "./dist/src/types.d.ts",
|
|
32
|
-
"import": "./dist/src/types.js"
|
|
36
|
+
"import": "./dist/src/types.js",
|
|
37
|
+
"module-sync": "./dist/src/types.js"
|
|
33
38
|
}
|
|
34
39
|
},
|
|
35
40
|
"typesVersions": {
|
|
@@ -60,7 +65,7 @@
|
|
|
60
65
|
},
|
|
61
66
|
"repository": {
|
|
62
67
|
"type": "git",
|
|
63
|
-
"url": "git+https://github.com/
|
|
68
|
+
"url": "git+https://github.com/libp2p/js-libp2p.git"
|
|
64
69
|
},
|
|
65
70
|
"keywords": [
|
|
66
71
|
"libp2p",
|
|
@@ -70,15 +75,15 @@
|
|
|
70
75
|
"author": "Cayman Nava",
|
|
71
76
|
"license": "Apache-2.0",
|
|
72
77
|
"bugs": {
|
|
73
|
-
"url": "https://github.com/
|
|
78
|
+
"url": "https://github.com/libp2p/js-libp2p/issues"
|
|
74
79
|
},
|
|
75
|
-
"homepage": "https://github.com/
|
|
80
|
+
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/gossipsub#readme",
|
|
76
81
|
"dependencies": {
|
|
77
|
-
"@libp2p/crypto": "
|
|
78
|
-
"@libp2p/interface": "
|
|
79
|
-
"@libp2p/interface-internal": "
|
|
80
|
-
"@libp2p/peer-id": "
|
|
81
|
-
"@libp2p/utils": "
|
|
82
|
+
"@libp2p/crypto": "5.1.17-8ddbb9e81",
|
|
83
|
+
"@libp2p/interface": "3.2.2-8ddbb9e81",
|
|
84
|
+
"@libp2p/interface-internal": "3.1.2-8ddbb9e81",
|
|
85
|
+
"@libp2p/peer-id": "6.0.8-8ddbb9e81",
|
|
86
|
+
"@libp2p/utils": "7.0.17-8ddbb9e81",
|
|
82
87
|
"@multiformats/multiaddr": "^13.0.1",
|
|
83
88
|
"denque": "^2.1.0",
|
|
84
89
|
"it-length-prefixed": "^10.0.1",
|
|
@@ -92,11 +97,11 @@
|
|
|
92
97
|
"devDependencies": {
|
|
93
98
|
"@chainsafe/as-sha256": "^1.2.0",
|
|
94
99
|
"@dapplion/benchmark": "^1.0.0",
|
|
95
|
-
"@libp2p/floodsub": "
|
|
96
|
-
"@libp2p/logger": "
|
|
97
|
-
"@libp2p/peer-store": "
|
|
100
|
+
"@libp2p/floodsub": "11.0.18-8ddbb9e81",
|
|
101
|
+
"@libp2p/logger": "6.2.6-8ddbb9e81",
|
|
102
|
+
"@libp2p/peer-store": "12.0.17-8ddbb9e81",
|
|
98
103
|
"@types/node": "^22.18.1",
|
|
99
|
-
"@types/sinon": "^
|
|
104
|
+
"@types/sinon": "^21.0.1",
|
|
100
105
|
"abortable-iterator": "^5.1.0",
|
|
101
106
|
"aegir": "^47.0.21",
|
|
102
107
|
"datastore-core": "^11.0.1",
|
|
@@ -105,7 +110,7 @@
|
|
|
105
110
|
"mkdirp": "^3.0.1",
|
|
106
111
|
"p-defer": "^4.0.0",
|
|
107
112
|
"p-event": "^7.0.0",
|
|
108
|
-
"p-retry": "^
|
|
113
|
+
"p-retry": "^8.0.0",
|
|
109
114
|
"p-wait-for": "^6.0.0",
|
|
110
115
|
"protons": "^8.1.1",
|
|
111
116
|
"sinon": "^21.0.0",
|
package/src/gossipsub.ts
CHANGED
|
@@ -4,17 +4,17 @@ import { encode } from 'it-length-prefixed'
|
|
|
4
4
|
import { pipe } from 'it-pipe'
|
|
5
5
|
import { pushable } from 'it-pushable'
|
|
6
6
|
import * as Digest from 'multiformats/hashes/digest'
|
|
7
|
-
import * as constants from './constants.
|
|
7
|
+
import * as constants from './constants.ts'
|
|
8
8
|
import {
|
|
9
9
|
ACCEPT_FROM_WHITELIST_DURATION_MS,
|
|
10
10
|
ACCEPT_FROM_WHITELIST_MAX_MESSAGES,
|
|
11
11
|
ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE,
|
|
12
12
|
BACKOFF_SLACK
|
|
13
|
-
} from './constants.
|
|
13
|
+
} from './constants.ts'
|
|
14
14
|
import { StrictNoSign, StrictSign, TopicValidatorResult } from './index.ts'
|
|
15
|
-
import { defaultDecodeRpcLimits } from './message/decodeRpc.
|
|
16
|
-
import { RPC } from './message/rpc.
|
|
17
|
-
import { MessageCache } from './message-cache.
|
|
15
|
+
import { defaultDecodeRpcLimits } from './message/decodeRpc.ts'
|
|
16
|
+
import { RPC } from './message/rpc.ts'
|
|
17
|
+
import { MessageCache } from './message-cache.ts'
|
|
18
18
|
import {
|
|
19
19
|
ChurnReason,
|
|
20
20
|
getMetrics,
|
|
@@ -23,17 +23,17 @@ import {
|
|
|
23
23
|
|
|
24
24
|
ScorePenalty
|
|
25
25
|
|
|
26
|
-
} from './metrics.
|
|
26
|
+
} from './metrics.ts'
|
|
27
27
|
import {
|
|
28
28
|
PeerScore,
|
|
29
29
|
|
|
30
30
|
createPeerScoreParams,
|
|
31
31
|
createPeerScoreThresholds
|
|
32
32
|
|
|
33
|
-
} from './score/index.
|
|
34
|
-
import { computeAllPeersScoreWeights } from './score/scoreMetrics.
|
|
35
|
-
import { InboundStream, OutboundStream } from './stream.
|
|
36
|
-
import { IWantTracer } from './tracer.
|
|
33
|
+
} from './score/index.ts'
|
|
34
|
+
import { computeAllPeersScoreWeights } from './score/scoreMetrics.ts'
|
|
35
|
+
import { InboundStream, OutboundStream } from './stream.ts'
|
|
36
|
+
import { IWantTracer } from './tracer.ts'
|
|
37
37
|
import {
|
|
38
38
|
|
|
39
39
|
ValidateError,
|
|
@@ -43,21 +43,21 @@ import {
|
|
|
43
43
|
|
|
44
44
|
rejectReasonFromAcceptance
|
|
45
45
|
|
|
46
|
-
} from './types.
|
|
47
|
-
import { buildRawMessage, validateToRawMessage } from './utils/buildRawMessage.
|
|
48
|
-
import { createGossipRpc, ensureControl } from './utils/create-gossip-rpc.
|
|
49
|
-
import { shuffle, messageIdToString } from './utils/index.
|
|
50
|
-
import { msgIdFnStrictNoSign, msgIdFnStrictSign } from './utils/msgIdFn.
|
|
51
|
-
import { multiaddrToIPStr } from './utils/multiaddr.
|
|
52
|
-
import { getPublishConfigFromPeerId } from './utils/publishConfig.
|
|
53
|
-
import { removeFirstNItemsFromSet, removeItemsFromSet } from './utils/set.
|
|
54
|
-
import { SimpleTimeCache } from './utils/time-cache.
|
|
46
|
+
} from './types.ts'
|
|
47
|
+
import { buildRawMessage, validateToRawMessage } from './utils/buildRawMessage.ts'
|
|
48
|
+
import { createGossipRpc, ensureControl } from './utils/create-gossip-rpc.ts'
|
|
49
|
+
import { shuffle, messageIdToString } from './utils/index.ts'
|
|
50
|
+
import { msgIdFnStrictNoSign, msgIdFnStrictSign } from './utils/msgIdFn.ts'
|
|
51
|
+
import { multiaddrToIPStr } from './utils/multiaddr.ts'
|
|
52
|
+
import { getPublishConfigFromPeerId } from './utils/publishConfig.ts'
|
|
53
|
+
import { removeFirstNItemsFromSet, removeItemsFromSet } from './utils/set.ts'
|
|
54
|
+
import { SimpleTimeCache } from './utils/time-cache.ts'
|
|
55
55
|
import type { GossipSubComponents, GossipSubEvents, GossipsubMessage, GossipsubOpts, MeshPeer, Message, PublishResult, SubscriptionChangeData, TopicValidatorFn } from './index.ts'
|
|
56
|
-
import type { DecodeRPCLimits } from './message/decodeRpc.
|
|
57
|
-
import type { MessageCacheRecord } from './message-cache.
|
|
58
|
-
import type { Metrics, ToSendGroupCount } from './metrics.
|
|
59
|
-
import type { PeerScoreParams, PeerScoreThresholds, PeerScoreStatsDump } from './score/index.
|
|
60
|
-
import type { MsgIdFn, PublishConfig, TopicStr, MsgIdStr, PeerIdStr, RejectReasonObj, FastMsgIdFn, DataTransform, MsgIdToStrFn, MessageId, PublishOpts } from './types.
|
|
56
|
+
import type { DecodeRPCLimits } from './message/decodeRpc.ts'
|
|
57
|
+
import type { MessageCacheRecord } from './message-cache.ts'
|
|
58
|
+
import type { Metrics, ToSendGroupCount } from './metrics.ts'
|
|
59
|
+
import type { PeerScoreParams, PeerScoreThresholds, PeerScoreStatsDump } from './score/index.ts'
|
|
60
|
+
import type { MsgIdFn, PublishConfig, TopicStr, MsgIdStr, PeerIdStr, RejectReasonObj, FastMsgIdFn, DataTransform, MsgIdToStrFn, MessageId, PublishOpts } from './types.ts'
|
|
61
61
|
import type {
|
|
62
62
|
Connection, Stream, PeerId, Peer,
|
|
63
63
|
Logger,
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as constants from './constants.
|
|
1
|
+
import * as constants from './constants.ts'
|
|
2
2
|
import { GossipSub as GossipSubClass } from './gossipsub.ts'
|
|
3
|
-
import { MessageCache } from './message-cache.
|
|
4
|
-
import type { GossipsubOptsSpec } from './config.
|
|
5
|
-
import type { DecodeRPCLimits } from './message/decodeRpc.
|
|
6
|
-
import type { MetricsRegister, TopicStrToLabel } from './metrics.
|
|
7
|
-
import type { PeerScoreParams, PeerScoreThresholds } from './score/index.
|
|
8
|
-
import type { MsgIdFn, MsgIdStr, FastMsgIdFn, AddrInfo, DataTransform, MsgIdToStrFn } from './types.
|
|
3
|
+
import { MessageCache } from './message-cache.ts'
|
|
4
|
+
import type { GossipsubOptsSpec } from './config.ts'
|
|
5
|
+
import type { DecodeRPCLimits } from './message/decodeRpc.ts'
|
|
6
|
+
import type { MetricsRegister, TopicStrToLabel } from './metrics.ts'
|
|
7
|
+
import type { PeerScoreParams, PeerScoreThresholds } from './score/index.ts'
|
|
8
|
+
import type { MsgIdFn, MsgIdStr, FastMsgIdFn, AddrInfo, DataTransform, MsgIdToStrFn } from './types.ts'
|
|
9
9
|
import type {
|
|
10
10
|
PeerId, PeerStore,
|
|
11
11
|
ComponentLogger,
|
package/src/message/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './rpc.
|
|
1
|
+
export * from './rpc.ts'
|
package/src/message-cache.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RPC } from './message/rpc.
|
|
2
|
-
import type { MessageId, MsgIdStr, PeerIdStr, TopicStr, MsgIdToStrFn } from './types.
|
|
1
|
+
import type { RPC } from './message/rpc.ts'
|
|
2
|
+
import type { MessageId, MsgIdStr, PeerIdStr, TopicStr, MsgIdToStrFn } from './types.ts'
|
|
3
3
|
|
|
4
4
|
export type CacheEntry = MessageId & {
|
|
5
5
|
topic: TopicStr
|
package/src/metrics.ts
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
|
|
5
5
|
RejectReason
|
|
6
6
|
|
|
7
|
-
} from './types.
|
|
8
|
-
import type { RPC } from './message/rpc.
|
|
9
|
-
import type { PeerScoreThresholds } from './score/peer-score-thresholds.
|
|
10
|
-
import type { PeerIdStr, RejectReasonObj, TopicStr, ValidateError } from './types.
|
|
7
|
+
} from './types.ts'
|
|
8
|
+
import type { RPC } from './message/rpc.ts'
|
|
9
|
+
import type { PeerScoreThresholds } from './score/peer-score-thresholds.ts'
|
|
10
|
+
import type { PeerIdStr, RejectReasonObj, TopicStr, ValidateError } from './types.ts'
|
|
11
11
|
|
|
12
12
|
/** Topic label as provided in `topicStrToLabel` */
|
|
13
13
|
export type TopicLabel = string
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PeerScoreParams } from './peer-score-params.
|
|
2
|
-
import type { PeerStats } from './peer-stats.
|
|
1
|
+
import type { PeerScoreParams } from './peer-score-params.ts'
|
|
2
|
+
import type { PeerStats } from './peer-stats.ts'
|
|
3
3
|
|
|
4
4
|
export function computeScore (
|
|
5
5
|
peer: string,
|
package/src/score/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './peer-score-params.
|
|
2
|
-
export * from './peer-score-thresholds.
|
|
3
|
-
export * from './peer-score.
|
|
1
|
+
export * from './peer-score-params.ts'
|
|
2
|
+
export * from './peer-score-thresholds.ts'
|
|
3
|
+
export * from './peer-score.ts'
|
package/src/score/peer-score.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RejectReason } from '../types.js'
|
|
2
2
|
import { MapDef } from '../utils/set.js'
|
|
3
|
-
import { computeScore } from './compute-score.
|
|
4
|
-
import { MessageDeliveries, DeliveryRecordStatus } from './message-deliveries.
|
|
5
|
-
import { validatePeerScoreParams } from './peer-score-params.
|
|
3
|
+
import { computeScore } from './compute-score.ts'
|
|
4
|
+
import { MessageDeliveries, DeliveryRecordStatus } from './message-deliveries.ts'
|
|
5
|
+
import { validatePeerScoreParams } from './peer-score-params.ts'
|
|
6
6
|
import type { MsgIdStr, PeerIdStr, TopicStr, IPStr } from '../types.js'
|
|
7
|
-
import type { PeerScoreParams } from './peer-score-params.
|
|
8
|
-
import type { PeerStats, TopicStats } from './peer-stats.
|
|
7
|
+
import type { PeerScoreParams } from './peer-score-params.ts'
|
|
8
|
+
import type { PeerStats, TopicStats } from './peer-stats.ts'
|
|
9
9
|
import type { Metrics, ScorePenalty } from '../metrics.js'
|
|
10
10
|
import type { ComponentLogger, Logger } from '@libp2p/interface'
|
|
11
11
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PeerScoreParams } from './peer-score-params.
|
|
2
|
-
import type { PeerStats } from './peer-stats.
|
|
1
|
+
import type { PeerScoreParams } from './peer-score-params.ts'
|
|
2
|
+
import type { PeerStats } from './peer-stats.ts'
|
|
3
3
|
|
|
4
4
|
type TopicLabel = string
|
|
5
5
|
type TopicStr = string
|
package/src/tracer.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RejectReason } from './types.
|
|
2
|
-
import type { Metrics } from './metrics.
|
|
3
|
-
import type { MsgIdStr, MsgIdToStrFn, PeerIdStr } from './types.
|
|
1
|
+
import { RejectReason } from './types.ts'
|
|
2
|
+
import type { Metrics } from './metrics.ts'
|
|
3
|
+
import type { MsgIdStr, MsgIdToStrFn, PeerIdStr } from './types.ts'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* IWantTracer is an internal tracer that tracks IWANT requests in order to penalize
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TopicValidatorResult } from './index.ts'
|
|
2
2
|
import type { Message } from './index.ts'
|
|
3
|
-
import type { RPC } from './message/rpc.
|
|
3
|
+
import type { RPC } from './message/rpc.ts'
|
|
4
4
|
import type { PrivateKey, PeerId } from '@libp2p/interface'
|
|
5
5
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
6
6
|
|
package/src/utils/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './shuffle.
|
|
2
|
-
export * from './messageIdToString.
|
|
3
|
-
export { getPublishConfigFromPeerId } from './publishConfig.
|
|
1
|
+
export * from './shuffle.ts'
|
|
2
|
+
export * from './messageIdToString.ts'
|
|
3
|
+
export { getPublishConfigFromPeerId } from './publishConfig.ts'
|