Skip to content

Commit fc393b1

Browse files
authored
chore: add tls to interop testing (#3020)
Test tls as well as noise for node.js
1 parent f3c7658 commit fc393b1

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

interop/node-version.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"webrtc",
1212
"webrtc-direct"
1313
],
14-
"secureChannels": ["noise"],
14+
"secureChannels": ["noise", "tls"],
1515
"muxers": ["yamux", "mplex"]
1616
}

interop/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
"@chainsafe/libp2p-noise": "^16.0.0",
2222
"@chainsafe/libp2p-yamux": "^7.0.1",
2323
"@libp2p/circuit-relay-v2": "^3.1.3",
24-
"@libp2p/interface": "^2.2.1",
2524
"@libp2p/identify": "^3.0.12",
25+
"@libp2p/interface": "^2.2.1",
2626
"@libp2p/mplex": "^11.0.13",
2727
"@libp2p/ping": "^2.0.12",
2828
"@libp2p/tcp": "^10.0.13",
29+
"@libp2p/tls": "^2.0.17",
2930
"@libp2p/webrtc": "^5.0.19",
3031
"@libp2p/websockets": "^9.0.13",
3132
"@libp2p/webtransport": "^5.0.18",

interop/test/fixtures/get-libp2p.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
import { noise } from '@chainsafe/libp2p-noise'
44
import { yamux } from '@chainsafe/libp2p-yamux'
55
import { circuitRelayTransport } from '@libp2p/circuit-relay-v2'
6-
import { type Identify, identify } from '@libp2p/identify'
6+
import { identify } from '@libp2p/identify'
77
import { mplex } from '@libp2p/mplex'
8-
import { type PingService, ping } from '@libp2p/ping'
8+
import { ping } from '@libp2p/ping'
99
import { tcp } from '@libp2p/tcp'
10+
import { tls } from '@libp2p/tls'
1011
import { webRTC, webRTCDirect } from '@libp2p/webrtc'
1112
import { webSockets } from '@libp2p/websockets'
1213
import { webTransport } from '@libp2p/webtransport'
13-
import { type Libp2pOptions, createLibp2p } from 'libp2p'
14+
import { createLibp2p } from 'libp2p'
15+
import type { Identify } from '@libp2p/identify'
1416
import type { Libp2p } from '@libp2p/interface'
17+
import type { PingService } from '@libp2p/ping'
18+
import type { Libp2pOptions } from 'libp2p'
1519

1620
const isDialer: boolean = process.env.is_dialer === 'true'
1721

@@ -106,6 +110,9 @@ export async function getLibp2p (): Promise<Libp2p<{ ping: PingService }>> {
106110
case 'noise':
107111
options.connectionEncrypters = [noise()]
108112
break
113+
case 'tls':
114+
options.connectionEncrypters = [tls()]
115+
break
109116
default:
110117
throw new Error(`Unknown secure channel: ${SECURE_CHANNEL ?? ''}`)
111118
}

0 commit comments

Comments
 (0)