@libp2p/circuit-relay-v2 0.0.0-e2267d437 → 1.0.0
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 +9 -9
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/server/advert-service.d.ts +2 -4
- package/dist/src/server/advert-service.d.ts.map +1 -1
- package/dist/src/server/advert-service.js +1 -1
- package/dist/src/server/advert-service.js.map +1 -1
- package/dist/src/server/index.d.ts +2 -8
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/server/index.js +1 -1
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/server/reservation-store.d.ts +1 -3
- package/dist/src/server/reservation-store.d.ts.map +1 -1
- package/dist/src/server/reservation-store.js.map +1 -1
- package/dist/src/server/reservation-voucher.d.ts +1 -2
- package/dist/src/server/reservation-voucher.d.ts.map +1 -1
- package/dist/src/server/reservation-voucher.js.map +1 -1
- package/dist/src/transport/discovery.d.ts +3 -9
- package/dist/src/transport/discovery.d.ts.map +1 -1
- package/dist/src/transport/discovery.js +1 -1
- package/dist/src/transport/discovery.js.map +1 -1
- package/dist/src/transport/index.d.ts +2 -10
- package/dist/src/transport/index.d.ts.map +1 -1
- package/dist/src/transport/index.js +1 -1
- package/dist/src/transport/index.js.map +1 -1
- package/dist/src/transport/listener.d.ts +2 -3
- package/dist/src/transport/listener.d.ts.map +1 -1
- package/dist/src/transport/listener.js +1 -2
- package/dist/src/transport/listener.js.map +1 -1
- package/dist/src/transport/reservation-store.d.ts +2 -7
- package/dist/src/transport/reservation-store.d.ts.map +1 -1
- package/dist/src/transport/reservation-store.js +1 -1
- package/dist/src/transport/reservation-store.js.map +1 -1
- package/dist/src/transport/transport.d.ts +4 -6
- package/dist/src/transport/transport.d.ts.map +1 -1
- package/dist/src/transport/transport.js +2 -3
- package/dist/src/transport/transport.js.map +1 -1
- package/dist/src/utils.d.ts +1 -2
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/src/utils.js.map +1 -1
- package/dist/typedoc-urls.json +16 -0
- package/package.json +14 -10
- package/src/index.ts +3 -3
- package/src/server/advert-service.ts +2 -4
- package/src/server/index.ts +3 -10
- package/src/server/reservation-store.ts +1 -3
- package/src/server/reservation-voucher.ts +1 -2
- package/src/transport/discovery.ts +3 -9
- package/src/transport/index.ts +2 -10
- package/src/transport/listener.ts +3 -6
- package/src/transport/reservation-store.ts +2 -8
- package/src/transport/transport.ts +4 -12
- package/src/utils.ts +2 -3
package/dist/src/utils.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAA;AAM5D,KAAK,SAAU,CAAC,CAAC,gBAAgB,CAAE,MAA2C,EAAE,KAA4B,EAAE,OAAsB;IAClI,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAA;IAElC,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;QAElC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,iFAAiF;YACjF,MAAM,SAAS,GAAG,MAAM,CAAC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relay_v2.CircuitRelayServerComponents.html",
|
3
|
+
"CircuitRelayServerInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayServerInit.html",
|
4
|
+
"CircuitRelayService": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayService.html",
|
5
|
+
".:CircuitRelayService": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayService.html",
|
6
|
+
"CircuitRelayServiceEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayServiceEvents.html",
|
7
|
+
".:CircuitRelayServiceEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayServiceEvents.html",
|
8
|
+
"CircuitRelayTransportComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayTransportComponents.html",
|
9
|
+
"CircuitRelayTransportInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.CircuitRelayTransportInit.html",
|
10
|
+
"RelayReservation": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.RelayReservation.html",
|
11
|
+
".:RelayReservation": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_circuit_relay_v2.RelayReservation.html",
|
12
|
+
"RELAY_V2_HOP_CODEC": "https://libp2p.github.io/js-libp2p/variables/_libp2p_circuit_relay_v2.RELAY_V2_HOP_CODEC.html",
|
13
|
+
"RELAY_V2_STOP_CODEC": "https://libp2p.github.io/js-libp2p/variables/_libp2p_circuit_relay_v2.RELAY_V2_STOP_CODEC.html",
|
14
|
+
"circuitRelayServer": "https://libp2p.github.io/js-libp2p/functions/_libp2p_circuit_relay_v2.circuitRelayServer.html",
|
15
|
+
"circuitRelayTransport": "https://libp2p.github.io/js-libp2p/functions/_libp2p_circuit_relay_v2.circuitRelayTransport.html"
|
16
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@libp2p/circuit-relay-v2",
|
3
|
-
"version": "
|
3
|
+
"version": "1.0.0",
|
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",
|
@@ -11,6 +11,10 @@
|
|
11
11
|
"bugs": {
|
12
12
|
"url": "https://github.com/libp2p/js-libp2p/issues"
|
13
13
|
},
|
14
|
+
"publishConfig": {
|
15
|
+
"access": "public",
|
16
|
+
"provenance": true
|
17
|
+
},
|
14
18
|
"type": "module",
|
15
19
|
"types": "./dist/src/index.d.ts",
|
16
20
|
"files": [
|
@@ -47,12 +51,12 @@
|
|
47
51
|
"dep-check": "aegir dep-check"
|
48
52
|
},
|
49
53
|
"dependencies": {
|
50
|
-
"@libp2p/interface": "0.
|
51
|
-
"@libp2p/interface-internal": "0.1.
|
52
|
-
"@libp2p/peer-collections": "4.0.
|
53
|
-
"@libp2p/peer-id": "
|
54
|
-
"@libp2p/peer-record": "6.0.
|
55
|
-
"@libp2p/utils": "
|
54
|
+
"@libp2p/interface": "^1.0.0",
|
55
|
+
"@libp2p/interface-internal": "^0.1.10",
|
56
|
+
"@libp2p/peer-collections": "^4.0.9",
|
57
|
+
"@libp2p/peer-id": "^4.0.0",
|
58
|
+
"@libp2p/peer-record": "^6.0.10",
|
59
|
+
"@libp2p/utils": "^5.0.0",
|
56
60
|
"@multiformats/mafmt": "^12.1.6",
|
57
61
|
"@multiformats/multiaddr": "^12.1.10",
|
58
62
|
"any-signal": "^4.1.1",
|
@@ -68,9 +72,9 @@
|
|
68
72
|
"uint8arrays": "^4.0.6"
|
69
73
|
},
|
70
74
|
"devDependencies": {
|
71
|
-
"@libp2p/interface-compliance-tests": "
|
72
|
-
"@libp2p/logger": "
|
73
|
-
"@libp2p/peer-id-factory": "3.0.
|
75
|
+
"@libp2p/interface-compliance-tests": "^5.0.0",
|
76
|
+
"@libp2p/logger": "^4.0.0",
|
77
|
+
"@libp2p/peer-id-factory": "^3.0.9",
|
74
78
|
"aegir": "^41.0.2",
|
75
79
|
"it-drain": "^3.0.3",
|
76
80
|
"it-pair": "^2.0.6",
|
package/src/index.ts
CHANGED
@@ -35,7 +35,7 @@
|
|
35
35
|
*/
|
36
36
|
|
37
37
|
import type { Limit } from './pb/index.js'
|
38
|
-
import type { TypedEventEmitter } from '@libp2p/interface
|
38
|
+
import type { TypedEventEmitter } from '@libp2p/interface'
|
39
39
|
import type { PeerMap } from '@libp2p/peer-collections'
|
40
40
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
41
41
|
|
@@ -55,8 +55,8 @@ export interface CircuitRelayService extends TypedEventEmitter<CircuitRelayServi
|
|
55
55
|
reservations: PeerMap<RelayReservation>
|
56
56
|
}
|
57
57
|
|
58
|
-
export { circuitRelayServer } from './server/index.js'
|
59
|
-
export { circuitRelayTransport } from './transport/index.js'
|
58
|
+
export { circuitRelayServer, type CircuitRelayServerInit, type CircuitRelayServerComponents } from './server/index.js'
|
59
|
+
export { circuitRelayTransport, type CircuitRelayTransportInit, type CircuitRelayTransportComponents } from './transport/index.js'
|
60
60
|
|
61
61
|
export {
|
62
62
|
RELAY_V2_HOP_CODEC,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { TypedEventEmitter } from '@libp2p/interface
|
1
|
+
import { TypedEventEmitter } from '@libp2p/interface'
|
2
2
|
import pRetry from 'p-retry'
|
3
3
|
import {
|
4
4
|
DEFAULT_ADVERT_BOOT_DELAY,
|
@@ -6,9 +6,7 @@ import {
|
|
6
6
|
RELAY_RENDEZVOUS_NS
|
7
7
|
} from '../constants.js'
|
8
8
|
import { namespaceToCid } from '../utils.js'
|
9
|
-
import type { ComponentLogger, Logger } from '@libp2p/interface'
|
10
|
-
import type { ContentRouting } from '@libp2p/interface/content-routing'
|
11
|
-
import type { Startable } from '@libp2p/interface/startable'
|
9
|
+
import type { ComponentLogger, Logger, ContentRouting, Startable } from '@libp2p/interface'
|
12
10
|
|
13
11
|
export interface AdvertServiceInit {
|
14
12
|
/**
|
package/src/server/index.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { TypedEventEmitter, setMaxListeners } from '@libp2p/interface
|
1
|
+
import { TypedEventEmitter, setMaxListeners } from '@libp2p/interface'
|
2
2
|
import { peerIdFromBytes } from '@libp2p/peer-id'
|
3
3
|
import { RecordEnvelope } from '@libp2p/peer-record'
|
4
4
|
import { type Multiaddr, multiaddr } from '@multiformats/multiaddr'
|
@@ -18,15 +18,8 @@ import { AdvertService, type AdvertServiceComponents, type AdvertServiceInit } f
|
|
18
18
|
import { ReservationStore, type ReservationStoreInit } from './reservation-store.js'
|
19
19
|
import { ReservationVoucherRecord } from './reservation-voucher.js'
|
20
20
|
import type { CircuitRelayService, RelayReservation } from '../index.js'
|
21
|
-
import type { ComponentLogger, Logger } from '@libp2p/interface'
|
22
|
-
import type {
|
23
|
-
import type { ConnectionGater } from '@libp2p/interface/connection-gater'
|
24
|
-
import type { PeerId } from '@libp2p/interface/peer-id'
|
25
|
-
import type { PeerStore } from '@libp2p/interface/peer-store'
|
26
|
-
import type { Startable } from '@libp2p/interface/startable'
|
27
|
-
import type { AddressManager } from '@libp2p/interface-internal/address-manager'
|
28
|
-
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
29
|
-
import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar'
|
21
|
+
import type { ComponentLogger, Logger, Connection, Stream, ConnectionGater, PeerId, PeerStore, Startable } from '@libp2p/interface'
|
22
|
+
import type { AddressManager, ConnectionManager, IncomingStreamData, Registrar } from '@libp2p/interface-internal'
|
30
23
|
import type { PeerMap } from '@libp2p/peer-collections'
|
31
24
|
|
32
25
|
const isRelayAddr = (ma: Multiaddr): boolean => ma.protoCodes().includes(CIRCUIT_PROTO_CODE)
|
@@ -2,9 +2,7 @@ import { PeerMap } from '@libp2p/peer-collections'
|
|
2
2
|
import { DEFAULT_DATA_LIMIT, DEFAULT_DURATION_LIMIT, DEFAULT_MAX_RESERVATION_CLEAR_INTERVAL, DEFAULT_MAX_RESERVATION_STORE_SIZE, DEFAULT_MAX_RESERVATION_TTL } from '../constants.js'
|
3
3
|
import { type Limit, Status } from '../pb/index.js'
|
4
4
|
import type { RelayReservation } from '../index.js'
|
5
|
-
import type { RecursivePartial } from '@libp2p/interface'
|
6
|
-
import type { PeerId } from '@libp2p/interface/peer-id'
|
7
|
-
import type { Startable } from '@libp2p/interface/startable'
|
5
|
+
import type { RecursivePartial, PeerId, Startable } from '@libp2p/interface'
|
8
6
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
9
7
|
|
10
8
|
export type ReservationStatus = Status.OK | Status.PERMISSION_DENIED | Status.RESERVATION_REFUSED
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { ReservationVoucher } from '../pb/index.js'
|
2
|
-
import type { PeerId } from '@libp2p/interface
|
3
|
-
import type { Record } from '@libp2p/interface/record'
|
2
|
+
import type { PeerId, Record } from '@libp2p/interface'
|
4
3
|
|
5
4
|
export interface ReservationVoucherOptions {
|
6
5
|
relay: PeerId
|
@@ -1,17 +1,11 @@
|
|
1
|
-
import { TypedEventEmitter } from '@libp2p/interface
|
1
|
+
import { TypedEventEmitter } from '@libp2p/interface'
|
2
2
|
import {
|
3
3
|
RELAY_RENDEZVOUS_NS,
|
4
4
|
RELAY_V2_HOP_CODEC
|
5
5
|
} from '../constants.js'
|
6
6
|
import { namespaceToCid } from '../utils.js'
|
7
|
-
import type { ComponentLogger, Logger } from '@libp2p/interface'
|
8
|
-
import type {
|
9
|
-
import type { PeerId } from '@libp2p/interface/peer-id'
|
10
|
-
import type { PeerStore } from '@libp2p/interface/peer-store'
|
11
|
-
import type { Startable } from '@libp2p/interface/startable'
|
12
|
-
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
13
|
-
import type { Registrar } from '@libp2p/interface-internal/registrar'
|
14
|
-
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
|
7
|
+
import type { ComponentLogger, Logger, ContentRouting, PeerId, PeerStore, Startable } from '@libp2p/interface'
|
8
|
+
import type { ConnectionManager, Registrar, TransportManager } from '@libp2p/interface-internal'
|
15
9
|
|
16
10
|
export interface RelayDiscoveryEvents {
|
17
11
|
'relay:discover': CustomEvent<PeerId>
|
package/src/transport/index.ts
CHANGED
@@ -1,16 +1,8 @@
|
|
1
|
-
import { type Transport, type Upgrader } from '@libp2p/interface
|
1
|
+
import { type Transport, type Upgrader, type Libp2pEvents, type ComponentLogger, type ConnectionGater, type ContentRouting, type TypedEventTarget, type PeerId, type PeerStore } from '@libp2p/interface'
|
2
2
|
import { type RelayDiscoveryComponents } from './discovery.js'
|
3
3
|
import { type RelayStoreInit } from './reservation-store.js'
|
4
4
|
import { CircuitRelayTransport } from './transport.js'
|
5
|
-
import type {
|
6
|
-
import type { ConnectionGater } from '@libp2p/interface/connection-gater'
|
7
|
-
import type { ContentRouting } from '@libp2p/interface/content-routing'
|
8
|
-
import type { TypedEventTarget } from '@libp2p/interface/events'
|
9
|
-
import type { PeerId } from '@libp2p/interface/peer-id'
|
10
|
-
import type { PeerStore } from '@libp2p/interface/peer-store'
|
11
|
-
import type { AddressManager } from '@libp2p/interface-internal/address-manager'
|
12
|
-
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
13
|
-
import type { Registrar } from '@libp2p/interface-internal/registrar'
|
5
|
+
import type { AddressManager, ConnectionManager, Registrar } from '@libp2p/interface-internal'
|
14
6
|
|
15
7
|
export interface CircuitRelayTransportComponents extends RelayDiscoveryComponents {
|
16
8
|
peerId: PeerId
|
@@ -1,12 +1,9 @@
|
|
1
|
-
import { CodeError } from '@libp2p/interface
|
2
|
-
import { TypedEventEmitter } from '@libp2p/interface/events'
|
1
|
+
import { CodeError, TypedEventEmitter } from '@libp2p/interface'
|
3
2
|
import { PeerMap } from '@libp2p/peer-collections'
|
4
3
|
import { multiaddr } from '@multiformats/multiaddr'
|
5
4
|
import type { ReservationStore } from './reservation-store.js'
|
6
|
-
import type { ComponentLogger, Logger } from '@libp2p/interface'
|
7
|
-
import type {
|
8
|
-
import type { Listener, ListenerEvents } from '@libp2p/interface/transport'
|
9
|
-
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
5
|
+
import type { ComponentLogger, Logger, PeerId, Listener, ListenerEvents } from '@libp2p/interface'
|
6
|
+
import type { ConnectionManager } from '@libp2p/interface-internal'
|
10
7
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
11
8
|
|
12
9
|
export interface CircuitRelayTransportListenerComponents {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { TypedEventEmitter, type TypedEventTarget } from '@libp2p/interface
|
1
|
+
import { TypedEventEmitter, type TypedEventTarget, type Libp2pEvents, type AbortOptions, type ComponentLogger, type Logger, type Connection, type PeerId, type PeerStore, type Startable } from '@libp2p/interface'
|
2
2
|
import { PeerMap } from '@libp2p/peer-collections'
|
3
3
|
import { PeerJobQueue } from '@libp2p/utils/peer-job-queue'
|
4
4
|
import { multiaddr } from '@multiformats/multiaddr'
|
@@ -8,13 +8,7 @@ import { DEFAULT_RESERVATION_CONCURRENCY, RELAY_TAG, RELAY_V2_HOP_CODEC } from '
|
|
8
8
|
import { HopMessage, Status } from '../pb/index.js'
|
9
9
|
import { getExpirationMilliseconds } from '../utils.js'
|
10
10
|
import type { Reservation } from '../pb/index.js'
|
11
|
-
import type {
|
12
|
-
import type { Connection } from '@libp2p/interface/connection'
|
13
|
-
import type { PeerId } from '@libp2p/interface/peer-id'
|
14
|
-
import type { PeerStore } from '@libp2p/interface/peer-store'
|
15
|
-
import type { Startable } from '@libp2p/interface/startable'
|
16
|
-
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
17
|
-
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
|
11
|
+
import type { ConnectionManager, TransportManager } from '@libp2p/interface-internal'
|
18
12
|
|
19
13
|
// allow refreshing a relay reservation if it will expire in the next 10 minutes
|
20
14
|
const REFRESH_WINDOW = (60 * 1000) * 10
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { CodeError } from '@libp2p/interface
|
2
|
-
import { symbol, type Transport, type CreateListenerOptions, type Listener, type Upgrader } from '@libp2p/interface/transport'
|
1
|
+
import { CodeError, transportSymbol } from '@libp2p/interface'
|
3
2
|
import { peerIdFromBytes, peerIdFromString } from '@libp2p/peer-id'
|
4
3
|
import { streamToMaConnection } from '@libp2p/utils/stream-to-ma-conn'
|
5
4
|
import * as mafmt from '@multiformats/mafmt'
|
@@ -11,15 +10,8 @@ import { RelayDiscovery } from './discovery.js'
|
|
11
10
|
import { createListener } from './listener.js'
|
12
11
|
import { ReservationStore } from './reservation-store.js'
|
13
12
|
import type { CircuitRelayTransportComponents, CircuitRelayTransportInit } from './index.js'
|
14
|
-
import type { AbortOptions, ComponentLogger, Logger } from '@libp2p/interface'
|
15
|
-
import type {
|
16
|
-
import type { ConnectionGater } from '@libp2p/interface/connection-gater'
|
17
|
-
import type { PeerId } from '@libp2p/interface/peer-id'
|
18
|
-
import type { PeerStore } from '@libp2p/interface/peer-store'
|
19
|
-
import type { AddressManager } from '@libp2p/interface-internal/address-manager'
|
20
|
-
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
21
|
-
import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar'
|
22
|
-
import type { TransportManager } from '@libp2p/interface-internal/src/transport-manager/index.js'
|
13
|
+
import type { AbortOptions, ComponentLogger, Logger, Connection, Stream, ConnectionGater, PeerId, PeerStore, Transport, CreateListenerOptions, Listener, Upgrader } from '@libp2p/interface'
|
14
|
+
import type { AddressManager, ConnectionManager, IncomingStreamData, Registrar, TransportManager } from '@libp2p/interface-internal'
|
23
15
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
24
16
|
|
25
17
|
const isValidStop = (request: StopMessage): request is Required<StopMessage> => {
|
@@ -136,7 +128,7 @@ export class CircuitRelayTransport implements Transport {
|
|
136
128
|
this.started = false
|
137
129
|
}
|
138
130
|
|
139
|
-
readonly [
|
131
|
+
readonly [transportSymbol] = true
|
140
132
|
|
141
133
|
readonly [Symbol.toStringTag] = 'libp2p/circuit-relay-v2'
|
142
134
|
|
package/src/utils.ts
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
import { CodeError } from '@libp2p/interface
|
1
|
+
import { CodeError } from '@libp2p/interface'
|
2
2
|
import { anySignal } from 'any-signal'
|
3
3
|
import { CID } from 'multiformats/cid'
|
4
4
|
import { sha256 } from 'multiformats/hashes/sha2'
|
5
5
|
import { ERR_TRANSFER_LIMIT_EXCEEDED } from './constants.js'
|
6
6
|
import type { Limit } from './pb/index.js'
|
7
|
-
import type { LoggerOptions } from '@libp2p/interface'
|
8
|
-
import type { Stream } from '@libp2p/interface/connection'
|
7
|
+
import type { LoggerOptions, Stream } from '@libp2p/interface'
|
9
8
|
import type { Source } from 'it-stream-types'
|
10
9
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
11
10
|
|