1
1
import { noise } from "@chainsafe/libp2p-noise" ;
2
2
import { circuitRelayTransport } from "@libp2p/circuit-relay-v2" ;
3
3
import { identify } from "@libp2p/identify" ;
4
- import { keychain } from "@libp2p/keychain" ;
5
- import { defaultLogger } from "@libp2p/logger" ;
4
+ // import { keychain } from "@libp2p/keychain";
5
+ // import { defaultLogger } from "@libp2p/logger";
6
6
import { mplex } from "@libp2p/mplex" ;
7
7
import { webRTC } from "@libp2p/webrtc" ;
8
8
import { webSockets } from "@libp2p/websockets" ;
9
9
import * as filters from "@libp2p/websockets/filters" ;
10
10
import { multiaddr } from "@multiformats/multiaddr" ;
11
- import { LevelDatastore } from "datastore-level" ;
12
- import { Key } from "interface-datastore" ;
11
+ // import { LevelDatastore } from "datastore-level";
12
+ // import { Key } from "interface-datastore";
13
13
import { createLibp2p } from "libp2p" ;
14
14
import { createHa } from "./ha" ;
15
15
16
16
export async function createNode ( ) {
17
- const selfKey = new Key ( "/pkcs8/self" ) ;
18
- const datastore = new LevelDatastore ( `libp2p/data` ) ;
19
- const chain = keychain ( ) ( {
20
- datastore : datastore ,
21
- logger : defaultLogger ( )
22
- } ) ;
23
- let peerId ;
24
- if ( await datastore . has ( selfKey ) ) {
25
- peerId = await chain . exportPeerId ( "self" ) ;
26
- }
17
+ // const selfKey = new Key("/pkcs8/self");
18
+ // const datastore = new LevelDatastore(`libp2p/data`);
19
+ // const chain = keychain()({
20
+ // datastore: datastore,
21
+ // logger: defaultLogger()
22
+ // });
23
+ // let peerId;
24
+ // if (await datastore.has(selfKey)) {
25
+ // peerId = await chain.exportPeerId("self");
26
+ // }
27
27
const node = await createLibp2p ( {
28
- peerId : peerId ,
28
+ // peerId: peerId,
29
29
addresses : {
30
30
listen : [ "/webrtc" ]
31
31
} ,
@@ -51,9 +51,9 @@ export async function createNode() {
51
51
minConnections : 0
52
52
}
53
53
} ) ;
54
- if ( chain != null && ! ( await datastore . has ( selfKey ) ) ) {
55
- await chain . importPeer ( "self" , node . peerId ) ;
56
- }
54
+ // if (chain != null && !(await datastore.has(selfKey))) {
55
+ // await chain.importPeer("self", node.peerId);
56
+ // }
57
57
return node ;
58
58
}
59
59
0 commit comments