Skip to content

Commit

Permalink
fix: replace IPNI gateway with delegated routing client (#297)
Browse files Browse the repository at this point in the history
Removes proprietary IPNI content routing implementation with `@helia/delegated-routing-v1-http-api-client` which also gives us better peer routing and IPNS support.
  • Loading branch information
achingbrain authored Nov 2, 2023
1 parent 0776106 commit 57d580d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/helia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@
"@chainsafe/libp2p-gossipsub": "^10.0.0",
"@chainsafe/libp2p-noise": "^13.0.0",
"@chainsafe/libp2p-yamux": "^5.0.0",
"@helia/delegated-routing-v1-http-api-client": "^1.1.0",
"@helia/interface": "^2.0.0",
"@ipld/dag-cbor": "^9.0.0",
"@ipld/dag-json": "^10.0.1",
"@ipld/dag-pb": "^4.0.3",
"@libp2p/bootstrap": "^9.0.2",
"@libp2p/interface": "^0.1.1",
"@libp2p/ipni-content-routing": "^2.0.0",
"@libp2p/kad-dht": "^10.0.2",
"@libp2p/logger": "^3.0.1",
"@libp2p/mdns": "^9.0.2",
Expand Down
7 changes: 3 additions & 4 deletions packages/helia/src/utils/libp2p-defaults.browser.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { gossipsub } from '@chainsafe/libp2p-gossipsub'
import { noise } from '@chainsafe/libp2p-noise'
import { yamux } from '@chainsafe/libp2p-yamux'
import { createDelegatedRoutingV1HttpApiClient } from '@helia/delegated-routing-v1-http-api-client'
import { bootstrap } from '@libp2p/bootstrap'
import { ipniContentRouting } from '@libp2p/ipni-content-routing'
import { type DualKadDHT, kadDHT } from '@libp2p/kad-dht'
import { mplex } from '@libp2p/mplex'
import { webRTC, webRTCDirect } from '@libp2p/webrtc'
Expand All @@ -21,6 +21,7 @@ import type { Libp2pOptions } from 'libp2p'

export interface DefaultLibp2pServices extends Record<string, unknown> {
dht: DualKadDHT
delegatedRouting: unknown
pubsub: PubSub
identify: IdentifyService
autoNAT: unknown
Expand Down Expand Up @@ -54,14 +55,12 @@ export function libp2pDefaults (): Libp2pOptions<DefaultLibp2pServices> {
peerDiscovery: [
bootstrap(bootstrapConfig)
],
contentRouters: [
ipniContentRouting('https://cid.contact')
],
services: {
identify: identifyService(),
autoNAT: autoNATService(),
pubsub: gossipsub(),
dcutr: dcutrService(),
delegatedRouting: () => createDelegatedRoutingV1HttpApiClient('https://delegated-ipfs.dev'),
dht: kadDHT({
clientMode: true,
validators: {
Expand Down
7 changes: 3 additions & 4 deletions packages/helia/src/utils/libp2p-defaults.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { gossipsub } from '@chainsafe/libp2p-gossipsub'
import { noise } from '@chainsafe/libp2p-noise'
import { yamux } from '@chainsafe/libp2p-yamux'
import { createDelegatedRoutingV1HttpApiClient } from '@helia/delegated-routing-v1-http-api-client'
import { bootstrap } from '@libp2p/bootstrap'
import { ipniContentRouting } from '@libp2p/ipni-content-routing'
import { type DualKadDHT, kadDHT } from '@libp2p/kad-dht'
import { mdns } from '@libp2p/mdns'
import { mplex } from '@libp2p/mplex'
Expand All @@ -23,6 +23,7 @@ import type { Libp2pOptions } from 'libp2p'

export interface DefaultLibp2pServices extends Record<string, unknown> {
dht: DualKadDHT
delegatedRouting: unknown
pubsub: PubSub
relay: CircuitRelayService
identify: IdentifyService
Expand Down Expand Up @@ -61,15 +62,13 @@ export function libp2pDefaults (): Libp2pOptions<DefaultLibp2pServices> {
mdns(),
bootstrap(bootstrapConfig)
],
contentRouters: [
ipniContentRouting('https://cid.contact')
],
services: {
identify: identifyService(),
autoNAT: autoNATService(),
upnp: uPnPNATService(),
pubsub: gossipsub(),
dcutr: dcutrService(),
delegatedRouting: () => createDelegatedRoutingV1HttpApiClient('https://delegated-ipfs.dev'),
dht: kadDHT({
validators: {
ipns: ipnsValidator
Expand Down

0 comments on commit 57d580d

Please sign in to comment.