File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed
examples/js-libp2p-example-transports Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable no-console */
2
2
3
3
import fs from 'fs'
4
- import https from 'https'
5
4
import { noise } from '@chainsafe/libp2p-noise'
6
5
import { yamux } from '@chainsafe/libp2p-yamux'
7
6
import { tcp } from '@libp2p/tcp'
@@ -11,11 +10,6 @@ import { createLibp2p } from 'libp2p'
11
10
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
12
11
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
13
12
14
- const httpServer = https . createServer ( {
15
- cert : fs . readFileSync ( './test_certs/cert.pem' ) ,
16
- key : fs . readFileSync ( './test_certs/key.pem' )
17
- } )
18
-
19
13
const createNode = async ( addresses = [ ] ) => {
20
14
if ( ! Array . isArray ( addresses ) ) {
21
15
addresses = [ addresses ]
@@ -28,7 +22,10 @@ const createNode = async (addresses = []) => {
28
22
transports : [
29
23
tcp ( ) ,
30
24
webSockets ( {
31
- server : httpServer ,
25
+ https : {
26
+ cert : fs . readFileSync ( './test_certs/cert.pem' ) ,
27
+ key : fs . readFileSync ( './test_certs/key.pem' )
28
+ } ,
32
29
websocket : {
33
30
rejectUnauthorized : false
34
31
}
Original file line number Diff line number Diff line change 19
19
"@chainsafe/libp2p-noise" : " ^16.0.0" ,
20
20
"@chainsafe/libp2p-yamux" : " ^7.0.0" ,
21
21
"@libp2p/tcp" : " ^10.0.0" ,
22
- "@libp2p/websockets" : " ^9.0 .0" ,
22
+ "@libp2p/websockets" : " ^9.1 .0" ,
23
23
"it-pipe" : " ^3.0.1" ,
24
24
"it-to-buffer" : " ^4.0.2" ,
25
25
"libp2p" : " ^2.0.0" ,
You can’t perform that action at this time.
0 commit comments