@libp2p/autonat
Advanced tools
Comparing version 2.0.13 to 2.0.14-023ea575c
@@ -11,2 +11,3 @@ import { serviceCapabilities, serviceDependencies } from '@libp2p/interface'; | ||
private readonly maxOutboundStreams; | ||
private readonly maxMessageSize; | ||
private started; | ||
@@ -13,0 +14,0 @@ private readonly log; |
@@ -13,3 +13,3 @@ import { serviceCapabilities, serviceDependencies, setMaxListeners } from '@libp2p/interface'; | ||
import * as Digest from 'multiformats/hashes/digest'; | ||
import { DEFAULT_CONNECTION_THRESHOLD, MAX_INBOUND_STREAMS, MAX_OUTBOUND_STREAMS, PROTOCOL_NAME, PROTOCOL_PREFIX, PROTOCOL_VERSION, TIMEOUT } from './constants.js'; | ||
import { DEFAULT_CONNECTION_THRESHOLD, MAX_INBOUND_STREAMS, MAX_MESSAGE_SIZE, MAX_OUTBOUND_STREAMS, PROTOCOL_NAME, PROTOCOL_PREFIX, PROTOCOL_VERSION, TIMEOUT } from './constants.js'; | ||
import { Message } from './pb/index.js'; | ||
@@ -27,2 +27,3 @@ // if more than 3 peers manage to dial us on what we believe to be our external | ||
maxOutboundStreams; | ||
maxMessageSize; | ||
started; | ||
@@ -44,2 +45,3 @@ log; | ||
this.connectionThreshold = init.connectionThreshold ?? DEFAULT_CONNECTION_THRESHOLD; | ||
this.maxMessageSize = init.maxMessageSize ?? MAX_MESSAGE_SIZE; | ||
this.dialResults = new Map(); | ||
@@ -147,3 +149,5 @@ this.findPeers = repeatingTask(this.findRandomPeers.bind(this), 60_000); | ||
setMaxListeners(Infinity, signal); | ||
const messages = pbStream(data.stream).pb(Message); | ||
const messages = pbStream(data.stream, { | ||
maxDataLength: this.maxMessageSize | ||
}).pb(Message); | ||
try { | ||
@@ -150,0 +154,0 @@ const request = await messages.read({ |
@@ -14,5 +14,6 @@ /** | ||
export declare const TIMEOUT = 30000; | ||
export declare const MAX_INBOUND_STREAMS = 1; | ||
export declare const MAX_OUTBOUND_STREAMS = 1; | ||
export declare const MAX_INBOUND_STREAMS = 2; | ||
export declare const MAX_OUTBOUND_STREAMS = 20; | ||
export declare const DEFAULT_CONNECTION_THRESHOLD = 80; | ||
export declare const MAX_MESSAGE_SIZE = 8192; | ||
//# sourceMappingURL=constants.d.ts.map |
@@ -14,5 +14,6 @@ /** | ||
export const TIMEOUT = 30000; | ||
export const MAX_INBOUND_STREAMS = 1; | ||
export const MAX_OUTBOUND_STREAMS = 1; | ||
export const MAX_INBOUND_STREAMS = 2; | ||
export const MAX_OUTBOUND_STREAMS = 20; | ||
export const DEFAULT_CONNECTION_THRESHOLD = 80; | ||
export const MAX_MESSAGE_SIZE = 8192; | ||
//# sourceMappingURL=constants.js.map |
@@ -69,2 +69,9 @@ /** | ||
connectionThreshold?: number; | ||
/** | ||
* How large incoming autonat messages are allowed to be in bytes. If messages | ||
* larger than this are received the stream will be reset. | ||
* | ||
* @default 8192 | ||
*/ | ||
maxMessageSize?: number; | ||
} | ||
@@ -71,0 +78,0 @@ export interface AutoNATComponents { |
{ | ||
"name": "@libp2p/autonat", | ||
"version": "2.0.13", | ||
"version": "2.0.14-023ea575c", | ||
"description": "Implementation of Autonat Protocol", | ||
@@ -55,7 +55,7 @@ "license": "Apache-2.0 OR MIT", | ||
"dependencies": { | ||
"@libp2p/interface": "^2.3.0", | ||
"@libp2p/interface-internal": "^2.2.0", | ||
"@libp2p/peer-collections": "^6.0.13", | ||
"@libp2p/peer-id": "^5.0.9", | ||
"@libp2p/utils": "^6.3.0", | ||
"@libp2p/interface": "2.3.0-023ea575c", | ||
"@libp2p/interface-internal": "2.2.1-023ea575c", | ||
"@libp2p/peer-collections": "6.0.13-023ea575c", | ||
"@libp2p/peer-id": "5.0.9-023ea575c", | ||
"@libp2p/utils": "6.3.0-023ea575c", | ||
"@multiformats/multiaddr": "^12.3.3", | ||
@@ -69,4 +69,4 @@ "any-signal": "^4.1.1", | ||
"devDependencies": { | ||
"@libp2p/crypto": "^5.0.8", | ||
"@libp2p/logger": "^5.1.5", | ||
"@libp2p/crypto": "5.0.8-023ea575c", | ||
"@libp2p/logger": "5.1.5-023ea575c", | ||
"aegir": "^45.0.5", | ||
@@ -73,0 +73,0 @@ "it-all": "^3.0.6", |
@@ -13,6 +13,3 @@ import { serviceCapabilities, serviceDependencies, setMaxListeners } from '@libp2p/interface' | ||
import * as Digest from 'multiformats/hashes/digest' | ||
import { | ||
DEFAULT_CONNECTION_THRESHOLD, | ||
MAX_INBOUND_STREAMS, MAX_OUTBOUND_STREAMS, PROTOCOL_NAME, PROTOCOL_PREFIX, PROTOCOL_VERSION, TIMEOUT | ||
} from './constants.js' | ||
import { DEFAULT_CONNECTION_THRESHOLD, MAX_INBOUND_STREAMS, MAX_MESSAGE_SIZE, MAX_OUTBOUND_STREAMS, PROTOCOL_NAME, PROTOCOL_PREFIX, PROTOCOL_VERSION, TIMEOUT } from './constants.js' | ||
import { Message } from './pb/index.js' | ||
@@ -93,2 +90,3 @@ import type { AutoNATComponents, AutoNATServiceInit } from './index.js' | ||
private readonly maxOutboundStreams: number | ||
private readonly maxMessageSize: number | ||
private started: boolean | ||
@@ -111,2 +109,3 @@ private readonly log: Logger | ||
this.connectionThreshold = init.connectionThreshold ?? DEFAULT_CONNECTION_THRESHOLD | ||
this.maxMessageSize = init.maxMessageSize ?? MAX_MESSAGE_SIZE | ||
this.dialResults = new Map() | ||
@@ -235,3 +234,5 @@ this.findPeers = repeatingTask(this.findRandomPeers.bind(this), 60_000) | ||
const messages = pbStream(data.stream).pb(Message) | ||
const messages = pbStream(data.stream, { | ||
maxDataLength: this.maxMessageSize | ||
}).pb(Message) | ||
@@ -238,0 +239,0 @@ try { |
@@ -16,4 +16,5 @@ /** | ||
export const TIMEOUT = 30000 | ||
export const MAX_INBOUND_STREAMS = 1 | ||
export const MAX_OUTBOUND_STREAMS = 1 | ||
export const MAX_INBOUND_STREAMS = 2 | ||
export const MAX_OUTBOUND_STREAMS = 20 | ||
export const DEFAULT_CONNECTION_THRESHOLD = 80 | ||
export const MAX_MESSAGE_SIZE = 8192 |
@@ -78,2 +78,10 @@ /** | ||
connectionThreshold?: number | ||
/** | ||
* How large incoming autonat messages are allowed to be in bytes. If messages | ||
* larger than this are received the stream will be reset. | ||
* | ||
* @default 8192 | ||
*/ | ||
maxMessageSize?: number | ||
} | ||
@@ -80,0 +88,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
269994
2727
24
1
+ Added@libp2p/crypto@5.0.8-023ea575c(transitive)
+ Added@libp2p/interface@2.3.0-023ea575c(transitive)
+ Added@libp2p/interface-internal@2.2.1-023ea575c(transitive)
+ Added@libp2p/logger@5.1.5-023ea575c(transitive)
+ Added@libp2p/peer-collections@6.0.13-023ea575c(transitive)
+ Added@libp2p/peer-id@5.0.9-023ea575c(transitive)
+ Added@libp2p/utils@6.3.0-023ea575c(transitive)
+ Added@types/murmurhash3js-revisited@3.0.3(transitive)
+ Addedmurmurhash3js-revisited@3.0.0(transitive)
- Removed@libp2p/crypto@5.0.12(transitive)
- Removed@libp2p/interface@2.6.0(transitive)
- Removed@libp2p/interface-internal@2.3.4(transitive)
- Removed@libp2p/logger@5.1.9(transitive)
- Removed@libp2p/peer-collections@6.0.20(transitive)
- Removed@libp2p/peer-id@5.0.13(transitive)
- Removed@libp2p/utils@6.5.4(transitive)