@libp2p/circuit-relay-v2 4.2.5 → 4.2.6
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 -1
- package/dist/index.min.js.map +4 -4
- package/dist/src/server/index.d.ts +3 -3
- package/dist/src/server/index.js +3 -3
- package/dist/src/server/reservation-store.d.ts +3 -3
- package/dist/src/server/reservation-store.js +2 -2
- package/dist/src/server/reservation-voucher.js +1 -1
- package/dist/src/transport/discovery.js +1 -1
- package/dist/src/transport/index.js +3 -3
- package/dist/src/transport/listener.js +2 -2
- package/dist/src/transport/reservation-store.d.ts +1 -1
- package/dist/src/transport/reservation-store.js +4 -4
- package/package.json +14 -14
- package/src/server/index.ts +5 -5
- package/src/server/reservation-store.ts +4 -4
- package/src/server/reservation-voucher.ts +1 -1
- package/src/transport/discovery.ts +1 -1
- package/src/transport/index.ts +3 -3
- package/src/transport/listener.ts +2 -2
- package/src/transport/reservation-store.ts +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TypedEventEmitter } from 'main-event';
|
|
2
|
-
import { HopMessage, StopMessage } from '../pb/index.
|
|
3
|
-
import type { CircuitRelayServerComponents, CircuitRelayServerInit, CircuitRelayService, RelayReservation } from '../index.
|
|
4
|
-
import type { Reservation } from '../pb/index.
|
|
2
|
+
import { HopMessage, StopMessage } from '../pb/index.ts';
|
|
3
|
+
import type { CircuitRelayServerComponents, CircuitRelayServerInit, CircuitRelayService, RelayReservation } from '../index.ts';
|
|
4
|
+
import type { Reservation } from '../pb/index.ts';
|
|
5
5
|
import type { Connection, Stream, PeerId, Startable, AbortOptions } from '@libp2p/interface';
|
|
6
6
|
import type { PeerMap } from '@libp2p/peer-collections';
|
|
7
7
|
import type { ProtobufStream } from '@libp2p/utils';
|
package/dist/src/server/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import { multiaddr } from '@multiformats/multiaddr';
|
|
|
6
6
|
import { Circuit } from '@multiformats/multiaddr-matcher';
|
|
7
7
|
import { TypedEventEmitter, setMaxListeners } from 'main-event';
|
|
8
8
|
import * as Digest from 'multiformats/hashes/digest';
|
|
9
|
-
import { DEFAULT_HOP_TIMEOUT, MAX_CONNECTIONS, RELAY_SOURCE_TAG, RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from
|
|
10
|
-
import { HopMessage, Status, StopMessage } from
|
|
11
|
-
import { createLimitedRelay } from
|
|
9
|
+
import { DEFAULT_HOP_TIMEOUT, MAX_CONNECTIONS, RELAY_SOURCE_TAG, RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from "../constants.js";
|
|
10
|
+
import { HopMessage, Status, StopMessage } from "../pb/index.js";
|
|
11
|
+
import { createLimitedRelay } from "../utils.js";
|
|
12
12
|
import { ReservationStore } from "./reservation-store.js";
|
|
13
13
|
import { ReservationVoucherRecord } from "./reservation-voucher.js";
|
|
14
14
|
const defaults = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Status } from '../pb/index.
|
|
2
|
-
import type { RelayReservation, ServerReservationStoreInit } from '../index.
|
|
3
|
-
import type { Limit } from '../pb/index.
|
|
1
|
+
import { Status } from '../pb/index.ts';
|
|
2
|
+
import type { RelayReservation, ServerReservationStoreInit } from '../index.ts';
|
|
3
|
+
import type { Limit } from '../pb/index.ts';
|
|
4
4
|
import type { ComponentLogger, Metrics, PeerId } from '@libp2p/interface';
|
|
5
5
|
import type { PeerMap } from '@libp2p/peer-collections';
|
|
6
6
|
import type { Multiaddr } from '@multiformats/multiaddr';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { trackedPeerMap } from '@libp2p/peer-collections';
|
|
2
2
|
import { retimeableSignal } from 'retimeable-signal';
|
|
3
|
-
import { DEFAULT_DATA_LIMIT, DEFAULT_DURATION_LIMIT, DEFAULT_MAX_RESERVATION_STORE_SIZE, DEFAULT_MAX_RESERVATION_TTL } from
|
|
4
|
-
import { Status } from
|
|
3
|
+
import { DEFAULT_DATA_LIMIT, DEFAULT_DURATION_LIMIT, DEFAULT_MAX_RESERVATION_STORE_SIZE, DEFAULT_MAX_RESERVATION_TTL } from "../constants.js";
|
|
4
|
+
import { Status } from "../pb/index.js";
|
|
5
5
|
export class ReservationStore {
|
|
6
6
|
reservations;
|
|
7
7
|
maxReservations;
|
|
@@ -2,7 +2,7 @@ import { PeerQueue } from '@libp2p/utils';
|
|
|
2
2
|
import { anySignal } from 'any-signal';
|
|
3
3
|
import { TypedEventEmitter, setMaxListeners } from 'main-event';
|
|
4
4
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
|
|
5
|
-
import { RELAY_V2_HOP_CODEC } from
|
|
5
|
+
import { RELAY_V2_HOP_CODEC } from "../constants.js";
|
|
6
6
|
/**
|
|
7
7
|
* ReservationManager automatically makes a circuit v2 reservation on any connected
|
|
8
8
|
* peers that support the circuit v2 HOP protocol.
|
|
@@ -7,9 +7,9 @@ import { Circuit } from '@multiformats/multiaddr-matcher';
|
|
|
7
7
|
import { setMaxListeners } from 'main-event';
|
|
8
8
|
import * as Digest from 'multiformats/hashes/digest';
|
|
9
9
|
import { CustomProgressEvent } from 'progress-events';
|
|
10
|
-
import { DEFAULT_DISCOVERY_FILTER_ERROR_RATE, DEFAULT_DISCOVERY_FILTER_SIZE, MAX_CONNECTIONS, RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from
|
|
11
|
-
import { StopMessage, HopMessage, Status } from
|
|
12
|
-
import { CircuitListen, CircuitSearch, LimitTracker } from
|
|
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
|
+
import { StopMessage, HopMessage, Status } from "../pb/index.js";
|
|
12
|
+
import { CircuitListen, CircuitSearch, LimitTracker } from "../utils.js";
|
|
13
13
|
import { RelayDiscovery } from "./discovery.js";
|
|
14
14
|
import { createListener } from "./listener.js";
|
|
15
15
|
import { ReservationStore } from "./reservation-store.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ListenError } from '@libp2p/interface';
|
|
2
2
|
import { multiaddr } from '@multiformats/multiaddr';
|
|
3
3
|
import { TypedEventEmitter, setMaxListeners } from 'main-event';
|
|
4
|
-
import { DEFAULT_RESERVATION_COMPLETION_TIMEOUT } from
|
|
5
|
-
import { CircuitListen, CircuitSearch } from
|
|
4
|
+
import { DEFAULT_RESERVATION_COMPLETION_TIMEOUT } from "../constants.js";
|
|
5
|
+
import { CircuitListen, CircuitSearch } from "../utils.js";
|
|
6
6
|
class CircuitRelayTransportListener extends TypedEventEmitter {
|
|
7
7
|
connectionManager;
|
|
8
8
|
addressManager;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypedEventEmitter } from 'main-event';
|
|
2
2
|
import type { TransportReservationStoreComponents, TransportReservationStoreInit } from '../index.ts';
|
|
3
|
-
import type { Reservation } from '../pb/index.
|
|
3
|
+
import type { Reservation } from '../pb/index.ts';
|
|
4
4
|
import type { PeerId, Startable } from '@libp2p/interface';
|
|
5
5
|
export type RelayType = 'discovered' | 'configured';
|
|
6
6
|
export interface DiscoveredRelayEntry {
|
|
@@ -5,10 +5,10 @@ import { CODE_P2P, multiaddr } from '@multiformats/multiaddr';
|
|
|
5
5
|
import { Circuit } from '@multiformats/multiaddr-matcher';
|
|
6
6
|
import { TypedEventEmitter, setMaxListeners } from 'main-event';
|
|
7
7
|
import { nanoid } from 'nanoid';
|
|
8
|
-
import { DEFAULT_MAX_RESERVATION_QUEUE_LENGTH, DEFAULT_RESERVATION_COMPLETION_TIMEOUT, DEFAULT_RESERVATION_CONCURRENCY, KEEP_ALIVE_TAG, RELAY_V2_HOP_CODEC } from
|
|
9
|
-
import { DoubleRelayError, HadEnoughRelaysError, RelayQueueFullError } from
|
|
10
|
-
import { HopMessage, Status } from
|
|
11
|
-
import { getExpirationMilliseconds } from
|
|
8
|
+
import { DEFAULT_MAX_RESERVATION_QUEUE_LENGTH, DEFAULT_RESERVATION_COMPLETION_TIMEOUT, DEFAULT_RESERVATION_CONCURRENCY, KEEP_ALIVE_TAG, RELAY_V2_HOP_CODEC } from "../constants.js";
|
|
9
|
+
import { DoubleRelayError, HadEnoughRelaysError, RelayQueueFullError } from "../errors.js";
|
|
10
|
+
import { HopMessage, Status } from "../pb/index.js";
|
|
11
|
+
import { getExpirationMilliseconds } from "../utils.js";
|
|
12
12
|
// allow refreshing a relay reservation if it will expire in the next 10 minutes
|
|
13
13
|
const REFRESH_WINDOW = (60 * 1000) * 10;
|
|
14
14
|
// try to refresh relay reservations 5 minutes before expiry
|
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.6",
|
|
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",
|
|
@@ -46,28 +46,28 @@
|
|
|
46
46
|
"doc-check": "aegir doc-check"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@libp2p/crypto": "^5.1.
|
|
50
|
-
"@libp2p/interface": "^3.2.
|
|
51
|
-
"@libp2p/interface-internal": "^3.1.
|
|
52
|
-
"@libp2p/peer-collections": "^7.0.
|
|
53
|
-
"@libp2p/peer-id": "^6.0.
|
|
54
|
-
"@libp2p/peer-record": "^9.0.
|
|
55
|
-
"@libp2p/utils": "^7.2.
|
|
56
|
-
"@multiformats/multiaddr": "^13.0.
|
|
57
|
-
"@multiformats/multiaddr-matcher": "^3.0.
|
|
49
|
+
"@libp2p/crypto": "^5.1.19",
|
|
50
|
+
"@libp2p/interface": "^3.2.3",
|
|
51
|
+
"@libp2p/interface-internal": "^3.1.6",
|
|
52
|
+
"@libp2p/peer-collections": "^7.0.21",
|
|
53
|
+
"@libp2p/peer-id": "^6.0.10",
|
|
54
|
+
"@libp2p/peer-record": "^9.0.11",
|
|
55
|
+
"@libp2p/utils": "^7.2.2",
|
|
56
|
+
"@multiformats/multiaddr": "^13.0.3",
|
|
57
|
+
"@multiformats/multiaddr-matcher": "^3.0.2",
|
|
58
58
|
"any-signal": "^4.1.1",
|
|
59
59
|
"main-event": "^1.0.1",
|
|
60
|
-
"multiformats": "^
|
|
60
|
+
"multiformats": "^14.0.0",
|
|
61
61
|
"nanoid": "^5.1.5",
|
|
62
62
|
"progress-events": "^1.1.0",
|
|
63
63
|
"protons-runtime": "^6.0.1",
|
|
64
64
|
"retimeable-signal": "^1.0.1",
|
|
65
65
|
"uint8arraylist": "^2.4.8",
|
|
66
|
-
"uint8arrays": "^
|
|
66
|
+
"uint8arrays": "^6.1.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@libp2p/logger": "^6.2.
|
|
70
|
-
"aegir": "^
|
|
69
|
+
"@libp2p/logger": "^6.2.8",
|
|
70
|
+
"aegir": "^48.0.11",
|
|
71
71
|
"delay": "^7.0.0",
|
|
72
72
|
"it-all": "^3.0.9",
|
|
73
73
|
"it-protobuf-stream": "^2.0.3",
|
package/src/server/index.ts
CHANGED
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
RELAY_SOURCE_TAG,
|
|
13
13
|
RELAY_V2_HOP_CODEC,
|
|
14
14
|
RELAY_V2_STOP_CODEC
|
|
15
|
-
} from '../constants.
|
|
16
|
-
import { HopMessage, Status, StopMessage } from '../pb/index.
|
|
17
|
-
import { createLimitedRelay } from '../utils.
|
|
15
|
+
} from '../constants.ts'
|
|
16
|
+
import { HopMessage, Status, StopMessage } from '../pb/index.ts'
|
|
17
|
+
import { createLimitedRelay } from '../utils.ts'
|
|
18
18
|
import { ReservationStore } from './reservation-store.ts'
|
|
19
19
|
import { ReservationVoucherRecord } from './reservation-voucher.ts'
|
|
20
|
-
import type { CircuitRelayServerComponents, CircuitRelayServerInit, CircuitRelayService, RelayReservation } from '../index.
|
|
21
|
-
import type { Reservation } from '../pb/index.
|
|
20
|
+
import type { CircuitRelayServerComponents, CircuitRelayServerInit, CircuitRelayService, RelayReservation } from '../index.ts'
|
|
21
|
+
import type { Reservation } from '../pb/index.ts'
|
|
22
22
|
import type { Logger, Connection, Stream, PeerId, Startable, AbortOptions } from '@libp2p/interface'
|
|
23
23
|
import type { PeerMap } from '@libp2p/peer-collections'
|
|
24
24
|
import type { ProtobufStream } from '@libp2p/utils'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { trackedPeerMap } from '@libp2p/peer-collections'
|
|
2
2
|
import { retimeableSignal } from 'retimeable-signal'
|
|
3
|
-
import { DEFAULT_DATA_LIMIT, DEFAULT_DURATION_LIMIT, DEFAULT_MAX_RESERVATION_STORE_SIZE, DEFAULT_MAX_RESERVATION_TTL } from '../constants.
|
|
4
|
-
import { Status } from '../pb/index.
|
|
5
|
-
import type { RelayReservation, ServerReservationStoreInit } from '../index.
|
|
6
|
-
import type { Limit } from '../pb/index.
|
|
3
|
+
import { DEFAULT_DATA_LIMIT, DEFAULT_DURATION_LIMIT, DEFAULT_MAX_RESERVATION_STORE_SIZE, DEFAULT_MAX_RESERVATION_TTL } from '../constants.ts'
|
|
4
|
+
import { Status } from '../pb/index.ts'
|
|
5
|
+
import type { RelayReservation, ServerReservationStoreInit } from '../index.ts'
|
|
6
|
+
import type { Limit } from '../pb/index.ts'
|
|
7
7
|
import type { ComponentLogger, Logger, Metrics, PeerId } from '@libp2p/interface'
|
|
8
8
|
import type { PeerMap } from '@libp2p/peer-collections'
|
|
9
9
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
@@ -4,7 +4,7 @@ import { TypedEventEmitter, setMaxListeners } from 'main-event'
|
|
|
4
4
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
|
|
5
5
|
import {
|
|
6
6
|
RELAY_V2_HOP_CODEC
|
|
7
|
-
} from '../constants.
|
|
7
|
+
} from '../constants.ts'
|
|
8
8
|
import type { RelayDiscoveryComponents, RelayDiscoveryEvents, RelayDiscoveryInit } from '../index.ts'
|
|
9
9
|
import type { Logger, Peer, PeerId, PeerInfo, Startable, TopologyFilter } from '@libp2p/interface'
|
|
10
10
|
|
package/src/transport/index.ts
CHANGED
|
@@ -7,9 +7,9 @@ import { Circuit } from '@multiformats/multiaddr-matcher'
|
|
|
7
7
|
import { setMaxListeners } from 'main-event'
|
|
8
8
|
import * as Digest from 'multiformats/hashes/digest'
|
|
9
9
|
import { CustomProgressEvent } from 'progress-events'
|
|
10
|
-
import { DEFAULT_DISCOVERY_FILTER_ERROR_RATE, DEFAULT_DISCOVERY_FILTER_SIZE, MAX_CONNECTIONS, RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from '../constants.
|
|
11
|
-
import { StopMessage, HopMessage, Status } from '../pb/index.
|
|
12
|
-
import { CircuitListen, CircuitSearch, LimitTracker } from '../utils.
|
|
10
|
+
import { DEFAULT_DISCOVERY_FILTER_ERROR_RATE, DEFAULT_DISCOVERY_FILTER_SIZE, MAX_CONNECTIONS, RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from '../constants.ts'
|
|
11
|
+
import { StopMessage, HopMessage, Status } from '../pb/index.ts'
|
|
12
|
+
import { CircuitListen, CircuitSearch, LimitTracker } from '../utils.ts'
|
|
13
13
|
import { RelayDiscovery } from './discovery.ts'
|
|
14
14
|
import { createListener } from './listener.ts'
|
|
15
15
|
import { ReservationStore } from './reservation-store.ts'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ListenError } from '@libp2p/interface'
|
|
2
2
|
import { multiaddr } from '@multiformats/multiaddr'
|
|
3
3
|
import { TypedEventEmitter, setMaxListeners } from 'main-event'
|
|
4
|
-
import { DEFAULT_RESERVATION_COMPLETION_TIMEOUT } from '../constants.
|
|
5
|
-
import { CircuitListen, CircuitSearch } from '../utils.
|
|
4
|
+
import { DEFAULT_RESERVATION_COMPLETION_TIMEOUT } from '../constants.ts'
|
|
5
|
+
import { CircuitListen, CircuitSearch } from '../utils.ts'
|
|
6
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'
|
|
@@ -5,12 +5,12 @@ import { CODE_P2P, multiaddr } from '@multiformats/multiaddr'
|
|
|
5
5
|
import { Circuit } from '@multiformats/multiaddr-matcher'
|
|
6
6
|
import { TypedEventEmitter, setMaxListeners } from 'main-event'
|
|
7
7
|
import { nanoid } from 'nanoid'
|
|
8
|
-
import { DEFAULT_MAX_RESERVATION_QUEUE_LENGTH, DEFAULT_RESERVATION_COMPLETION_TIMEOUT, DEFAULT_RESERVATION_CONCURRENCY, KEEP_ALIVE_TAG, RELAY_V2_HOP_CODEC } from '../constants.
|
|
9
|
-
import { DoubleRelayError, HadEnoughRelaysError, RelayQueueFullError } from '../errors.
|
|
10
|
-
import { HopMessage, Status } from '../pb/index.
|
|
11
|
-
import { getExpirationMilliseconds } from '../utils.
|
|
8
|
+
import { DEFAULT_MAX_RESERVATION_QUEUE_LENGTH, DEFAULT_RESERVATION_COMPLETION_TIMEOUT, DEFAULT_RESERVATION_CONCURRENCY, KEEP_ALIVE_TAG, RELAY_V2_HOP_CODEC } from '../constants.ts'
|
|
9
|
+
import { DoubleRelayError, HadEnoughRelaysError, RelayQueueFullError } from '../errors.ts'
|
|
10
|
+
import { HopMessage, Status } from '../pb/index.ts'
|
|
11
|
+
import { getExpirationMilliseconds } from '../utils.ts'
|
|
12
12
|
import type { TransportReservationStoreComponents, TransportReservationStoreInit } from '../index.ts'
|
|
13
|
-
import type { Reservation } from '../pb/index.
|
|
13
|
+
import type { Reservation } from '../pb/index.ts'
|
|
14
14
|
import type { AbortOptions, Libp2pEvents, Logger, PeerId, PeerStore, Startable, Peer, Connection } from '@libp2p/interface'
|
|
15
15
|
import type { ConnectionManager } from '@libp2p/interface-internal'
|
|
16
16
|
import type { Filter } from '@libp2p/utils'
|