Skip to content

Commit 24afba3

Browse files
committed
refactor!: extract circuit relay v2 to separate module (#2222)
BREAKING CHANGE: imports from `libp2p/circuit-relay` should be updated to `@libp2p/circuit-relay-v2`
1 parent a364d95 commit 24afba3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+451
-1492
lines changed

.release-please.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"packages/pubsub": {},
3030
"packages/pubsub-floodsub": {},
3131
"packages/stream-multiplexer-mplex": {},
32+
"packages/transport-circuit-relay-v2": {},
3233
"packages/transport-tcp": {},
3334
"packages/transport-webrtc": {},
3435
"packages/transport-websockets": {},

doc/CONFIGURATION.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ import { tcp } from '@libp2p/tcp'
443443
import { mplex } from '@libp2p/mplex'
444444
import { yamux } from '@chainsafe/libp2p-yamux'
445445
import { noise } from '@chainsafe/libp2p-noise'
446-
import { circuitRelayTransport, circuitRelayServer } from 'libp2p/circuit-relay'
446+
import { circuitRelayTransport, circuitRelayServer } from '@libp2p/circuit-relay-v2'
447447
import { identify } from '@libp2p/identify'
448448

449449

@@ -501,7 +501,7 @@ import { tcp } from '@libp2p/tcp'
501501
import { mplex } from '@libp2p/mplex'
502502
import { yamux } from '@chainsafe/libp2p-yamux'
503503
import { noise } from '@chainsafe/libp2p-noise'
504-
import { circuitRelayTransport } from 'libp2p/circuit-relay'
504+
import { circuitRelayTransport } from '@libp2p/circuit-relay-v2'
505505

506506
const node = await createLibp2p({
507507
transports: [
@@ -529,7 +529,7 @@ import { createLibp2p } from 'libp2p'
529529
import { tcp } from '@libp2p/tcp'
530530
import { mplex } from '@libp2p/mplex'
531531
import { noise } from '@chainsafe/libp2p-noise'
532-
import { circuitRelayTransport } from 'libp2p/circuit-relay'
532+
import { circuitRelayTransport } from '@libp2p/circuit-relay-v2'
533533

534534
const node = await createLibp2p({
535535
transports: [

interop/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"dependencies": {
5454
"@chainsafe/libp2p-noise": "^13.0.0",
5555
"@chainsafe/libp2p-yamux": "^5.0.0",
56+
"@libp2p/circuit-relay-v2": "^0.0.0",
5657
"@libp2p/identify": "^0.0.0",
5758
"@libp2p/mplex": "^9.0.12",
5859
"@libp2p/ping": "^0.0.0",

interop/relay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { noise } from '@chainsafe/libp2p-noise'
22
import { yamux } from '@chainsafe/libp2p-yamux'
3+
import { circuitRelayServer } from '@libp2p/circuit-relay-v2'
34
import { identify } from '@libp2p/identify'
45
import { webSockets } from '@libp2p/websockets'
56
import * as filters from '@libp2p/websockets/filters'
67
import { createLibp2p } from 'libp2p'
7-
import { circuitRelayServer } from 'libp2p/circuit-relay'
88

99
export async function createRelay () {
1010
const server = await createLibp2p({

interop/test/ping.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { } from 'aegir/chai'
55
import { noise } from '@chainsafe/libp2p-noise'
66
import { yamux } from '@chainsafe/libp2p-yamux'
7+
import { circuitRelayTransport } from '@libp2p/circuit-relay-v2'
78
import { type Identify, identify } from '@libp2p/identify'
89
import { mplex } from '@libp2p/mplex'
910
import { ping, type PingService } from '@libp2p/ping'
@@ -14,7 +15,6 @@ import * as filters from '@libp2p/websockets/filters'
1415
import { webTransport } from '@libp2p/webtransport'
1516
import { type Multiaddr, multiaddr } from '@multiformats/multiaddr'
1617
import { createLibp2p, type Libp2p, type Libp2pOptions } from 'libp2p'
17-
import { circuitRelayTransport } from 'libp2p/circuit-relay'
1818

1919
async function redisProxy (commands: any[]): Promise<any> {
2020
const res = await fetch(`http://localhost:${process.env.proxyPort ?? ''}/`, { body: JSON.stringify(commands), method: 'POST' })

interop/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
{
2121
"path": "../packages/stream-multiplexer-mplex"
2222
},
23+
{
24+
"path": "../packages/transport-circuit-relay-v2"
25+
},
2326
{
2427
"path": "../packages/transport-tcp"
2528
},

packages/connection-encrypter-plaintext/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ Loading this module through a script tag will make it's exports available as `Li
3939
<script src="https://unpkg.com/@libp2p/plaintext/dist/index.min.js"></script>
4040
```
4141

42-
> Implementation of the DCUtR Protocol
43-
4442
# API Docs
4543

4644
- <https://libp2p.github.io/js-libp2p/modules/_libp2p_plaintext.html>

packages/libp2p/.aegir.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default {
1616
const { WebSockets } = await import('@multiformats/mafmt')
1717
const { createLibp2p } = await import('./dist/src/index.js')
1818
const { plaintext } = await import('@libp2p/plaintext')
19-
const { circuitRelayServer, circuitRelayTransport } = await import('./dist/src/circuit-relay/index.js')
19+
const { circuitRelayServer, circuitRelayTransport } = await import('@libp2p/circuit-relay-v2')
2020
const { identify } = await import('@libp2p/identify')
2121
const { fetchService } = await import('./dist/src/fetch/index.js')
2222

packages/libp2p/package.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@
4848
"types": "./dist/src/index.d.ts",
4949
"import": "./dist/src/index.js"
5050
},
51-
"./circuit-relay": {
52-
"types": "./dist/src/circuit-relay/index.d.ts",
53-
"import": "./dist/src/circuit-relay/index.js"
54-
},
5551
"./fetch": {
5652
"types": "./dist/src/fetch/index.d.ts",
5753
"import": "./dist/src/fetch/index.js"
@@ -99,7 +95,6 @@
9995
"@libp2p/peer-collections": "^4.0.8",
10096
"@libp2p/peer-id": "^3.0.6",
10197
"@libp2p/peer-id-factory": "^3.0.8",
102-
"@libp2p/peer-record": "^6.0.9",
10398
"@libp2p/peer-store": "^9.0.9",
10499
"@libp2p/utils": "^4.0.7",
105100
"@multiformats/mafmt": "^12.1.2",
@@ -116,15 +111,12 @@
116111
"it-length-prefixed": "^9.0.1",
117112
"it-map": "^3.0.3",
118113
"it-merge": "^3.0.0",
119-
"it-pair": "^2.0.6",
120114
"it-pipe": "^3.0.1",
121-
"it-protobuf-stream": "^1.0.0",
122115
"it-stream-types": "^2.0.1",
123116
"merge-options": "^3.0.4",
124117
"multiformats": "^12.0.1",
125118
"p-defer": "^4.0.0",
126119
"p-queue": "^7.3.4",
127-
"p-retry": "^6.0.0",
128120
"private-ip": "^3.0.0",
129121
"protons-runtime": "^5.0.0",
130122
"rate-limiter-flexible": "^3.0.0",
@@ -136,6 +128,7 @@
136128
"@chainsafe/libp2p-noise": "^13.0.0",
137129
"@chainsafe/libp2p-yamux": "^5.0.0",
138130
"@libp2p/bootstrap": "^9.0.12",
131+
"@libp2p/circuit-relay-v2": "^0.0.0",
139132
"@libp2p/daemon-client": "^7.0.0",
140133
"@libp2p/daemon-server": "^6.0.0",
141134
"@libp2p/floodsub": "^8.0.13",
@@ -152,7 +145,6 @@
152145
"execa": "^8.0.1",
153146
"go-libp2p": "^1.1.1",
154147
"it-pushable": "^3.2.0",
155-
"it-to-buffer": "^4.0.1",
156148
"npm-run-all": "^4.1.5",
157149
"p-event": "^6.0.0",
158150
"p-times": "^4.0.0",

packages/libp2p/src/connection-manager/auto-dial.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { PeerMap, PeerSet } from '@libp2p/peer-collections'
2+
import { PeerJobQueue } from '@libp2p/utils/peer-job-queue'
23
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
3-
import { PeerJobQueue } from '../utils/peer-job-queue.js'
44
import { AUTO_DIAL_CONCURRENCY, AUTO_DIAL_DISCOVERED_PEERS_DEBOUNCE, AUTO_DIAL_INTERVAL, AUTO_DIAL_MAX_QUEUE_LENGTH, AUTO_DIAL_PEER_RETRY_THRESHOLD, AUTO_DIAL_PRIORITY, LAST_DIAL_FAILURE_KEY, MIN_CONNECTIONS } from './constants.js'
55
import type { Libp2pEvents, Logger, ComponentLogger } from '@libp2p/interface'
66
import type { TypedEventTarget } from '@libp2p/interface/events'

0 commit comments

Comments
 (0)