This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { webSockets } from '@libp2p/websockets' | |
import { mplex } from '@libp2p/mplex' | |
import { noise } from '@chainsafe/libp2p-noise' | |
import { createLibp2p } from 'libp2p' | |
import { MemoryBlockstore } from 'blockstore-core/memory' | |
import { createBitswap } from 'ipfs-bitswap' | |
import { CID } from 'multiformats/cid' | |
import { multiaddr } from '@multiformats/multiaddr' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { fetch } from '@web-std/fetch' | |
import { BatchWriteItemCommand, ScanCommand } from '@aws-sdk/client-dynamodb' | |
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb' | |
import pWaitFor from 'p-wait-for' | |
import { AGGREGATE_KEY } from '../stacks/config.js' | |
import { createCarTable } from '../data/tables/car.js' | |
import { getCars } from '../data/test/helpers/car.js' | |
import { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Signer from '@ucanto/principal/ed25519' | |
import { CAR } from '@ucanto/transport' | |
import * as CBOR from '@ucanto/transport/cbor' | |
import * as UcantoClient from '@ucanto/client' | |
import * as DAGJSON from '@ipld/dag-json' | |
const uploadService = await Signer.generate() | |
const alice = await Signer.generate() | |
const { proof, spaceDid } = await createSpace(alice) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in {1..500}; do curl -svo /dev/null/ -H "requestflood: true" -H 'Cache-Control: no-cache' "https://bafkreidyeivj7adnnac6ljvzj2e3rd5xdw3revw4da7mx2ckrstapoupoq.ipfs.w3s.link/" 2>&1 | grep "< HTTP"; done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dotenv from 'dotenv' | |
import { | |
S3Client, | |
paginateListObjectsV2, | |
GetObjectCommand | |
} from '@aws-sdk/client-s3' | |
import { Cluster } from '@nftstorage/ipfs-cluster' | |
dotenv.config({ path: '.env.local' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Libp2p = require('libp2p') | |
const Mplex = require('libp2p-mplex') | |
const KickoffProtocol = require('./kickoff-protocol') | |
const node = await Libp2p.create({ | |
modules: { | |
// … other required modules | |
streamMuxer: [ Mplex ], | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pipe = require('it-pipe') | |
// The codec of our protocol | |
const PROTOCOL = '/libp2p/kickoff-app/1.0.0' | |
/** | |
* A simple handler to print incoming messages to the console | |
* @param {Object} params | |
* @param {Connection} params.connection The connection the stream belongs to | |
* @param {Stream} params.stream stream to the peer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Libp2p = require('libp2p') | |
const KadDht = require('libp2p-kad-dht') | |
const DelegatedContentRouter = require('libp2p-delegated-content-routing') | |
const DelegatedPeerRouter = require('libp2p-delegated-peer-routing') | |
const ipfsHttpClient = require('ipfs-http-client') | |
const PeerId = require('peer-id') | |
const CID = require('cids') | |
const peerId = await PeerId.create() | |
const delegateContentRouter = new DelegatedContentRouter(peerId, ipfsHttpClient({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Libp2p = require('libp2p') | |
const Gossipsub = require('libp2p-gossipsub') | |
const node = await Libp2p.create({ | |
modules: { | |
// … other required modules | |
pubsub: Gossipsub | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Libp2p = require('libp2p') | |
const WebSockets = require('libp2p-websockets') | |
const WebRtcStar = require('libp2p-webrtc-star') | |
const Bootstrap = require('libp2p-bootstrap') | |
const Mdns = require('libp2p-mdns') | |
// Known peers addresses | |
const bootstrapMultiaddrs = [ | |
'/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/p2p/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd', | |
'/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/p2p/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3' |
NewerOlder