helia 2.0.2 → 2.0.3-51316ba
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +30 -51
- package/dist/src/index.d.ts +3 -10
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -34
- package/dist/src/index.js.map +1 -1
- package/dist/src/storage.d.ts +1 -1
- package/dist/src/storage.d.ts.map +1 -1
- package/dist/src/utils/libp2p-defaults.browser.d.ts +7 -3
- package/dist/src/utils/libp2p-defaults.browser.d.ts.map +1 -1
- package/dist/src/utils/libp2p-defaults.browser.js +7 -5
- package/dist/src/utils/libp2p-defaults.browser.js.map +1 -1
- package/dist/src/utils/libp2p-defaults.d.ts +7 -3
- package/dist/src/utils/libp2p-defaults.d.ts.map +1 -1
- package/dist/src/utils/libp2p-defaults.js +11 -5
- package/dist/src/utils/libp2p-defaults.js.map +1 -1
- package/dist/src/utils/libp2p.d.ts +2 -8
- package/dist/src/utils/libp2p.d.ts.map +1 -1
- package/dist/src/utils/libp2p.js.map +1 -1
- package/dist/src/utils/networked-storage.d.ts +1 -1
- package/dist/src/utils/networked-storage.d.ts.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +5 -4
- package/src/index.ts +14 -40
- package/src/storage.ts +1 -1
- package/src/utils/libp2p-defaults.browser.ts +18 -7
- package/src/utils/libp2p-defaults.ts +24 -7
- package/src/utils/libp2p.ts +2 -5
- package/src/utils/networked-storage.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/typedoc-urls.json +0 -8
|
@@ -7,31 +7,47 @@ import { type DualKadDHT, kadDHT } from '@libp2p/kad-dht'
|
|
|
7
7
|
import { mdns } from '@libp2p/mdns'
|
|
8
8
|
import { mplex } from '@libp2p/mplex'
|
|
9
9
|
import { tcp } from '@libp2p/tcp'
|
|
10
|
+
import { webRTC, webRTCDirect } from '@libp2p/webrtc'
|
|
10
11
|
import { webSockets } from '@libp2p/websockets'
|
|
11
12
|
import { ipnsSelector } from 'ipns/selector'
|
|
12
13
|
import { ipnsValidator } from 'ipns/validator'
|
|
13
14
|
import { autoNATService } from 'libp2p/autonat'
|
|
14
15
|
import { circuitRelayTransport, circuitRelayServer, type CircuitRelayService } from 'libp2p/circuit-relay'
|
|
15
16
|
import { dcutrService } from 'libp2p/dcutr'
|
|
16
|
-
import { identifyService } from 'libp2p/identify'
|
|
17
|
+
import { type IdentifyService, identifyService } from 'libp2p/identify'
|
|
18
|
+
import { pingService, type PingService } from 'libp2p/ping'
|
|
17
19
|
import { uPnPNATService } from 'libp2p/upnp-nat'
|
|
18
20
|
import { bootstrapConfig } from './bootstrappers.js'
|
|
19
21
|
import type { PubSub } from '@libp2p/interface/pubsub'
|
|
20
22
|
import type { Libp2pOptions } from 'libp2p'
|
|
21
23
|
|
|
22
|
-
export
|
|
24
|
+
export interface DefaultLibp2pServices extends Record<string, unknown> {
|
|
25
|
+
dht: DualKadDHT
|
|
26
|
+
pubsub: PubSub
|
|
27
|
+
relay: CircuitRelayService
|
|
28
|
+
identify: IdentifyService
|
|
29
|
+
autoNAT: unknown
|
|
30
|
+
upnp: unknown
|
|
31
|
+
dcutr: unknown
|
|
32
|
+
ping: PingService
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function libp2pDefaults (): Libp2pOptions<DefaultLibp2pServices> {
|
|
23
36
|
return {
|
|
24
37
|
addresses: {
|
|
25
38
|
listen: [
|
|
26
|
-
'/ip4/0.0.0.0/tcp/0'
|
|
39
|
+
'/ip4/0.0.0.0/tcp/0',
|
|
40
|
+
'/webrtc'
|
|
27
41
|
]
|
|
28
42
|
},
|
|
29
43
|
transports: [
|
|
30
|
-
tcp(),
|
|
31
|
-
webSockets(),
|
|
32
44
|
circuitRelayTransport({
|
|
33
45
|
discoverRelays: 1
|
|
34
|
-
})
|
|
46
|
+
}),
|
|
47
|
+
tcp(),
|
|
48
|
+
webRTC(),
|
|
49
|
+
webRTCDirect(),
|
|
50
|
+
webSockets()
|
|
35
51
|
],
|
|
36
52
|
connectionEncryption: [
|
|
37
53
|
noise()
|
|
@@ -63,7 +79,8 @@ export function libp2pDefaults (): Libp2pOptions<{ dht: DualKadDHT, pubsub: PubS
|
|
|
63
79
|
}),
|
|
64
80
|
relay: circuitRelayServer({
|
|
65
81
|
advertise: true
|
|
66
|
-
})
|
|
82
|
+
}),
|
|
83
|
+
ping: pingService()
|
|
67
84
|
}
|
|
68
85
|
}
|
|
69
86
|
}
|
package/src/utils/libp2p.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { createLibp2p as create, type Libp2pOptions } from 'libp2p'
|
|
2
|
-
import { libp2pDefaults } from './libp2p-defaults.js'
|
|
2
|
+
import { type DefaultLibp2pServices, libp2pDefaults } from './libp2p-defaults.js'
|
|
3
3
|
import type { Libp2p } from '@libp2p/interface'
|
|
4
|
-
import type { PubSub } from '@libp2p/interface/pubsub'
|
|
5
|
-
import type { DualKadDHT } from '@libp2p/kad-dht'
|
|
6
4
|
import type { Datastore } from 'interface-datastore'
|
|
7
|
-
import type { CircuitRelayService } from 'libp2p/circuit-relay'
|
|
8
5
|
|
|
9
6
|
export interface CreateLibp2pOptions {
|
|
10
7
|
datastore: Datastore
|
|
11
8
|
start?: boolean
|
|
12
9
|
}
|
|
13
10
|
|
|
14
|
-
export async function createLibp2p (datastore: Datastore, options?: Libp2pOptions<any>): Promise<Libp2p<
|
|
11
|
+
export async function createLibp2p (datastore: Datastore, options?: Libp2pOptions<any>): Promise<Libp2p<DefaultLibp2pServices>> {
|
|
15
12
|
const defaults = libp2pDefaults()
|
|
16
13
|
options = options ?? {}
|
|
17
14
|
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '2.0.
|
|
1
|
+
export const version = '2.0.3-51316ba'
|
|
2
2
|
export const name = 'helia'
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"DAGWalker": "https://ipfs.github.io/helia/interfaces/helia.DAGWalker.html",
|
|
3
|
-
".:DAGWalker": "https://ipfs.github.io/helia/interfaces/helia.DAGWalker.html",
|
|
4
|
-
"HeliaInit": "https://ipfs.github.io/helia/interfaces/helia.HeliaInit.html",
|
|
5
|
-
".:HeliaInit": "https://ipfs.github.io/helia/interfaces/helia.HeliaInit.html",
|
|
6
|
-
"createHelia": "https://ipfs.github.io/helia/functions/helia.createHelia.html",
|
|
7
|
-
".:createHelia": "https://ipfs.github.io/helia/functions/helia.createHelia.html"
|
|
8
|
-
}
|