feat: add ipni fallback

This commit is contained in:
Derrick Hammer 2023-07-29 18:35:17 -04:00
parent 3befddd410
commit a61b0d4771
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 1 deletions

View File

@ -18,6 +18,7 @@ import { delegatedPeerRouting } from "@libp2p/delegated-peer-routing";
import { create as createIpfsHttpClient } from "ipfs-http-client"; import { create as createIpfsHttpClient } from "ipfs-http-client";
import { DELEGATE_LIST } from "./constants.js"; import { DELEGATE_LIST } from "./constants.js";
import { multiaddr } from "@multiformats/multiaddr"; import { multiaddr } from "@multiformats/multiaddr";
import { ipniContentRouting } from "@libp2p/ipni-content-routing";
function getDelegateConfig(): any { function getDelegateConfig(): any {
const delegateString = const delegateString =
@ -49,7 +50,10 @@ export function libp2pConfig(proxy: MultiSocketProxy): Libp2pOptions<{
connectionEncryption: [noise()], connectionEncryption: [noise()],
streamMuxers: [yamux(), mplex()], streamMuxers: [yamux(), mplex()],
peerDiscovery: [bootstrap(bootstrapConfig)], peerDiscovery: [bootstrap(bootstrapConfig)],
contentRouters: [delegatedContentRouting(client)], contentRouters: [
delegatedContentRouting(client),
ipniContentRouting("https://cid.contact"),
],
peerRouters: [delegatedPeerRouting(client)], peerRouters: [delegatedPeerRouting(client)],
services: { services: {
identify: identifyService(), identify: identifyService(),