@libp2p/circuit-relay-v2 4.2.0 → 4.2.2
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/index.d.ts +2 -2
- package/dist/src/index.js +2 -2
- package/dist/src/server/index.js +2 -2
- package/dist/src/transport/index.d.ts +1 -1
- package/dist/src/transport/index.js +4 -4
- package/dist/src/transport/listener.d.ts +1 -1
- package/dist/src/utils.d.ts +2 -2
- package/dist/src/utils.js +1 -1
- package/package.json +11 -10
- package/src/index.ts +3 -3
- package/src/server/index.ts +2 -2
- package/src/transport/index.ts +4 -4
- package/src/transport/listener.ts +1 -1
- package/src/utils.ts +3 -3
package/dist/src/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
import { TypedEventEmitter } from 'main-event';
|
|
42
|
-
import type { Limit } from './pb/index.
|
|
42
|
+
import type { Limit } from './pb/index.ts';
|
|
43
43
|
import type { ComponentLogger, ConnectionGater, Libp2pEvents, Metrics, PeerId, PeerStore, PrivateKey, TopologyFilter, Transport, TypedEventTarget, Upgrader } from '@libp2p/interface';
|
|
44
44
|
import type { AddressManager, ConnectionManager, RandomWalk, Registrar, TransportManager } from '@libp2p/interface-internal';
|
|
45
45
|
import type { PeerMap } from '@libp2p/peer-collections';
|
|
@@ -73,7 +73,7 @@ export interface CircuitRelayServiceEvents {
|
|
|
73
73
|
export interface CircuitRelayService extends TypedEventEmitter<CircuitRelayServiceEvents> {
|
|
74
74
|
reservations: PeerMap<RelayReservation>;
|
|
75
75
|
}
|
|
76
|
-
export { RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from './constants.
|
|
76
|
+
export { RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from './constants.ts';
|
|
77
77
|
export interface ServerReservationStoreInit {
|
|
78
78
|
/**
|
|
79
79
|
* maximum number of reservations allowed
|
package/dist/src/index.js
CHANGED
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
import { TypedEventEmitter } from 'main-event';
|
|
42
|
-
import { CircuitRelayServer } from
|
|
42
|
+
import { CircuitRelayServer } from "./server/index.js";
|
|
43
43
|
import { CircuitRelayTransport } from "./transport/index.js";
|
|
44
|
-
export { RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from
|
|
44
|
+
export { RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from "./constants.js";
|
|
45
45
|
export function circuitRelayServer(init = {}) {
|
|
46
46
|
return (components) => {
|
|
47
47
|
return new CircuitRelayServer(components, init);
|
package/dist/src/server/index.js
CHANGED
|
@@ -9,8 +9,8 @@ import * as Digest from 'multiformats/hashes/digest';
|
|
|
9
9
|
import { DEFAULT_HOP_TIMEOUT, MAX_CONNECTIONS, RELAY_SOURCE_TAG, RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from '../constants.js';
|
|
10
10
|
import { HopMessage, Status, StopMessage } from '../pb/index.js';
|
|
11
11
|
import { createLimitedRelay } from '../utils.js';
|
|
12
|
-
import { ReservationStore } from
|
|
13
|
-
import { ReservationVoucherRecord } from
|
|
12
|
+
import { ReservationStore } from "./reservation-store.js";
|
|
13
|
+
import { ReservationVoucherRecord } from "./reservation-voucher.js";
|
|
14
14
|
const defaults = {
|
|
15
15
|
maxOutboundStopStreams: MAX_CONNECTIONS
|
|
16
16
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { serviceCapabilities, serviceDependencies, transportSymbol } from '@libp2p/interface';
|
|
2
|
-
import { ReservationStore } from './reservation-store.
|
|
2
|
+
import { ReservationStore } from './reservation-store.ts';
|
|
3
3
|
import type { CircuitRelayTransportComponents, CircuitRelayTransportInit } from '../index.ts';
|
|
4
4
|
import type { Transport, CreateListenerOptions, Listener, Connection, Stream, DialTransportOptions, OpenConnectionProgressEvents, NewStreamProgressEvents } from '@libp2p/interface';
|
|
5
5
|
import type { Multiaddr } from '@multiformats/multiaddr';
|
|
@@ -10,10 +10,10 @@ import { CustomProgressEvent } from 'progress-events';
|
|
|
10
10
|
import { DEFAULT_DISCOVERY_FILTER_ERROR_RATE, DEFAULT_DISCOVERY_FILTER_SIZE, MAX_CONNECTIONS, RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from '../constants.js';
|
|
11
11
|
import { StopMessage, HopMessage, Status } from '../pb/index.js';
|
|
12
12
|
import { CircuitListen, CircuitSearch, LimitTracker } from '../utils.js';
|
|
13
|
-
import { RelayDiscovery } from
|
|
14
|
-
import { createListener } from
|
|
15
|
-
import { ReservationStore } from
|
|
16
|
-
import { streamToMaConnection } from
|
|
13
|
+
import { RelayDiscovery } from "./discovery.js";
|
|
14
|
+
import { createListener } from "./listener.js";
|
|
15
|
+
import { ReservationStore } from "./reservation-store.js";
|
|
16
|
+
import { streamToMaConnection } from "./stream-to-conn.js";
|
|
17
17
|
const isValidStop = (request) => {
|
|
18
18
|
if (request.peer == null) {
|
|
19
19
|
return false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReservationStore } from './reservation-store.
|
|
1
|
+
import type { ReservationStore } from './reservation-store.ts';
|
|
2
2
|
import type { ComponentLogger, Listener, PeerId } from '@libp2p/interface';
|
|
3
3
|
import type { AddressManager, ConnectionManager } from '@libp2p/interface-internal';
|
|
4
4
|
export interface CircuitRelayTransportListenerComponents {
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CID } from 'multiformats/cid';
|
|
2
|
-
import type { RelayReservation } from './index.
|
|
3
|
-
import type { Limit } from './pb/index.
|
|
2
|
+
import type { RelayReservation } from './index.ts';
|
|
3
|
+
import type { Limit } from './pb/index.ts';
|
|
4
4
|
import type { ConnectionLimits, LoggerOptions, Stream } from '@libp2p/interface';
|
|
5
5
|
import type { Uint8ArrayList } from 'uint8arraylist';
|
|
6
6
|
export declare function createLimitedRelay(src: Stream, dst: Stream, abortSignal: AbortSignal, reservation: RelayReservation, options: LoggerOptions): void;
|
package/dist/src/utils.js
CHANGED
|
@@ -6,7 +6,7 @@ import { fmt, code, and } from '@multiformats/multiaddr-matcher/utils';
|
|
|
6
6
|
import { anySignal } from 'any-signal';
|
|
7
7
|
import { CID } from 'multiformats/cid';
|
|
8
8
|
import { sha256 } from 'multiformats/hashes/sha2';
|
|
9
|
-
import { DurationLimitError, TransferLimitError } from
|
|
9
|
+
import { DurationLimitError, TransferLimitError } from "./errors.js";
|
|
10
10
|
function countStreamBytes(source, limit, options) {
|
|
11
11
|
const limitBytes = limit.remaining;
|
|
12
12
|
const abortIfStreamByteLimitExceeded = (evt) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/circuit-relay-v2",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.2",
|
|
4
4
|
"description": "Implementation of Circuit Relay v2",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/transport-circuit-relay-v2#readme",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
28
|
"types": "./dist/src/index.d.ts",
|
|
29
|
-
"import": "./dist/src/index.js"
|
|
29
|
+
"import": "./dist/src/index.js",
|
|
30
|
+
"module-sync": "./dist/src/index.js"
|
|
30
31
|
}
|
|
31
32
|
},
|
|
32
33
|
"scripts": {
|
|
@@ -45,13 +46,13 @@
|
|
|
45
46
|
"doc-check": "aegir doc-check"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
|
-
"@libp2p/crypto": "^5.1.
|
|
49
|
-
"@libp2p/interface": "^3.2.
|
|
50
|
-
"@libp2p/interface-internal": "^3.1.
|
|
51
|
-
"@libp2p/peer-collections": "^7.0.
|
|
52
|
-
"@libp2p/peer-id": "^6.0.
|
|
53
|
-
"@libp2p/peer-record": "^9.0.
|
|
54
|
-
"@libp2p/utils": "^7.0.
|
|
49
|
+
"@libp2p/crypto": "^5.1.17",
|
|
50
|
+
"@libp2p/interface": "^3.2.2",
|
|
51
|
+
"@libp2p/interface-internal": "^3.1.2",
|
|
52
|
+
"@libp2p/peer-collections": "^7.0.17",
|
|
53
|
+
"@libp2p/peer-id": "^6.0.8",
|
|
54
|
+
"@libp2p/peer-record": "^9.0.9",
|
|
55
|
+
"@libp2p/utils": "^7.0.17",
|
|
55
56
|
"@multiformats/multiaddr": "^13.0.1",
|
|
56
57
|
"@multiformats/multiaddr-matcher": "^3.0.1",
|
|
57
58
|
"any-signal": "^4.1.1",
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
"uint8arrays": "^5.1.0"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
|
-
"@libp2p/logger": "^6.2.
|
|
69
|
+
"@libp2p/logger": "^6.2.6",
|
|
69
70
|
"aegir": "^47.0.22",
|
|
70
71
|
"delay": "^7.0.0",
|
|
71
72
|
"it-all": "^3.0.9",
|
package/src/index.ts
CHANGED
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
42
|
import { TypedEventEmitter } from 'main-event'
|
|
43
|
-
import { CircuitRelayServer } from './server/index.
|
|
43
|
+
import { CircuitRelayServer } from './server/index.ts'
|
|
44
44
|
import { CircuitRelayTransport } from './transport/index.ts'
|
|
45
|
-
import type { Limit } from './pb/index.
|
|
45
|
+
import type { Limit } from './pb/index.ts'
|
|
46
46
|
import type { ComponentLogger, ConnectionGater, Libp2pEvents, Metrics, PeerId, PeerStore, PrivateKey, TopologyFilter, Transport, TypedEventTarget, Upgrader } from '@libp2p/interface'
|
|
47
47
|
import type { AddressManager, ConnectionManager, RandomWalk, Registrar, TransportManager } from '@libp2p/interface-internal'
|
|
48
48
|
import type { PeerMap } from '@libp2p/peer-collections'
|
|
@@ -87,7 +87,7 @@ export interface CircuitRelayService extends TypedEventEmitter<CircuitRelayServi
|
|
|
87
87
|
export {
|
|
88
88
|
RELAY_V2_HOP_CODEC,
|
|
89
89
|
RELAY_V2_STOP_CODEC
|
|
90
|
-
} from './constants.
|
|
90
|
+
} from './constants.ts'
|
|
91
91
|
|
|
92
92
|
export interface ServerReservationStoreInit {
|
|
93
93
|
/**
|
package/src/server/index.ts
CHANGED
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
} from '../constants.js'
|
|
16
16
|
import { HopMessage, Status, StopMessage } from '../pb/index.js'
|
|
17
17
|
import { createLimitedRelay } from '../utils.js'
|
|
18
|
-
import { ReservationStore } from './reservation-store.
|
|
19
|
-
import { ReservationVoucherRecord } from './reservation-voucher.
|
|
18
|
+
import { ReservationStore } from './reservation-store.ts'
|
|
19
|
+
import { ReservationVoucherRecord } from './reservation-voucher.ts'
|
|
20
20
|
import type { CircuitRelayServerComponents, CircuitRelayServerInit, CircuitRelayService, RelayReservation } from '../index.js'
|
|
21
21
|
import type { Reservation } from '../pb/index.js'
|
|
22
22
|
import type { Logger, Connection, Stream, PeerId, Startable, AbortOptions } from '@libp2p/interface'
|
package/src/transport/index.ts
CHANGED
|
@@ -10,10 +10,10 @@ import { CustomProgressEvent } from 'progress-events'
|
|
|
10
10
|
import { DEFAULT_DISCOVERY_FILTER_ERROR_RATE, DEFAULT_DISCOVERY_FILTER_SIZE, MAX_CONNECTIONS, RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from '../constants.js'
|
|
11
11
|
import { StopMessage, HopMessage, Status } from '../pb/index.js'
|
|
12
12
|
import { CircuitListen, CircuitSearch, LimitTracker } from '../utils.js'
|
|
13
|
-
import { RelayDiscovery } from './discovery.
|
|
14
|
-
import { createListener } from './listener.
|
|
15
|
-
import { ReservationStore } from './reservation-store.
|
|
16
|
-
import { streamToMaConnection } from './stream-to-conn.
|
|
13
|
+
import { RelayDiscovery } from './discovery.ts'
|
|
14
|
+
import { createListener } from './listener.ts'
|
|
15
|
+
import { ReservationStore } from './reservation-store.ts'
|
|
16
|
+
import { streamToMaConnection } from './stream-to-conn.ts'
|
|
17
17
|
import type { CircuitRelayTransportComponents, CircuitRelayTransportInit } from '../index.ts'
|
|
18
18
|
import type { Transport, CreateListenerOptions, Listener, Logger, Connection, Stream, DialTransportOptions, OpenConnectionProgressEvents, NewStreamProgressEvents } from '@libp2p/interface'
|
|
19
19
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
@@ -3,7 +3,7 @@ import { multiaddr } from '@multiformats/multiaddr'
|
|
|
3
3
|
import { TypedEventEmitter, setMaxListeners } from 'main-event'
|
|
4
4
|
import { DEFAULT_RESERVATION_COMPLETION_TIMEOUT } from '../constants.js'
|
|
5
5
|
import { CircuitListen, CircuitSearch } from '../utils.js'
|
|
6
|
-
import type { RelayReservation, ReservationStore } from './reservation-store.
|
|
6
|
+
import type { RelayReservation, ReservationStore } from './reservation-store.ts'
|
|
7
7
|
import type { ComponentLogger, Logger, Listener, ListenerEvents, PeerId } from '@libp2p/interface'
|
|
8
8
|
import type { AddressManager, ConnectionManager } from '@libp2p/interface-internal'
|
|
9
9
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
package/src/utils.ts
CHANGED
|
@@ -6,9 +6,9 @@ import { fmt, code, and } from '@multiformats/multiaddr-matcher/utils'
|
|
|
6
6
|
import { anySignal } from 'any-signal'
|
|
7
7
|
import { CID } from 'multiformats/cid'
|
|
8
8
|
import { sha256 } from 'multiformats/hashes/sha2'
|
|
9
|
-
import { DurationLimitError, TransferLimitError } from './errors.
|
|
10
|
-
import type { RelayReservation } from './index.
|
|
11
|
-
import type { Limit } from './pb/index.
|
|
9
|
+
import { DurationLimitError, TransferLimitError } from './errors.ts'
|
|
10
|
+
import type { RelayReservation } from './index.ts'
|
|
11
|
+
import type { Limit } from './pb/index.ts'
|
|
12
12
|
import type { ConnectionLimits, LoggerOptions, Stream, MessageStream, StreamMessageEvent } from '@libp2p/interface'
|
|
13
13
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
14
14
|
|