|
3 | 3 | import { noise } from '@chainsafe/libp2p-noise'
|
4 | 4 | import { yamux } from '@chainsafe/libp2p-yamux'
|
5 | 5 | import { circuitRelayTransport } from '@libp2p/circuit-relay-v2'
|
6 |
| -import { type Identify, identify } from '@libp2p/identify' |
| 6 | +import { identify } from '@libp2p/identify' |
7 | 7 | import { mplex } from '@libp2p/mplex'
|
8 |
| -import { type PingService, ping } from '@libp2p/ping' |
| 8 | +import { ping } from '@libp2p/ping' |
9 | 9 | import { tcp } from '@libp2p/tcp'
|
| 10 | +import { tls } from '@libp2p/tls' |
10 | 11 | import { webRTC, webRTCDirect } from '@libp2p/webrtc'
|
11 | 12 | import { webSockets } from '@libp2p/websockets'
|
12 | 13 | import { webTransport } from '@libp2p/webtransport'
|
13 |
| -import { type Libp2pOptions, createLibp2p } from 'libp2p' |
| 14 | +import { createLibp2p } from 'libp2p' |
| 15 | +import type { Identify } from '@libp2p/identify' |
14 | 16 | import type { Libp2p } from '@libp2p/interface'
|
| 17 | +import type { PingService } from '@libp2p/ping' |
| 18 | +import type { Libp2pOptions } from 'libp2p' |
15 | 19 |
|
16 | 20 | const isDialer: boolean = process.env.is_dialer === 'true'
|
17 | 21 |
|
@@ -106,6 +110,9 @@ export async function getLibp2p (): Promise<Libp2p<{ ping: PingService }>> {
|
106 | 110 | case 'noise':
|
107 | 111 | options.connectionEncrypters = [noise()]
|
108 | 112 | break
|
| 113 | + case 'tls': |
| 114 | + options.connectionEncrypters = [tls()] |
| 115 | + break |
109 | 116 | default:
|
110 | 117 | throw new Error(`Unknown secure channel: ${SECURE_CHANNEL ?? ''}`)
|
111 | 118 | }
|
|
0 commit comments