mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-07-07 13:02:29 +00:00
Fix tests, remove old fixtures data
This commit is contained in:
parent
2e379d4c7a
commit
dd22ceabb7
@ -1,130 +1,130 @@
|
|||||||
'use strict'
|
// 'use strict'
|
||||||
import assert from 'assert'
|
// import assert from 'assert'
|
||||||
import puppeteer from 'puppeteer-core'
|
// import puppeteer from 'puppeteer-core'
|
||||||
import chromium from 'chromium'
|
// import chromium from 'chromium'
|
||||||
import path from 'path'
|
// import path from 'path'
|
||||||
import mapSeries from 'p-map-series'
|
// import mapSeries from 'p-map-series'
|
||||||
import pMap from 'p-map'
|
// import pMap from 'p-map'
|
||||||
import { config } from 'orbit-db-test-utils'
|
// import { config } from 'orbit-db-test-utils'
|
||||||
|
|
||||||
const clicksPerTab = 20
|
// const clicksPerTab = 20
|
||||||
const numTabs = 3
|
// const numTabs = 3
|
||||||
|
|
||||||
const wait = async (milliseconds) => {
|
// const wait = async (milliseconds) => {
|
||||||
return new Promise((resolve, reject) => {
|
// return new Promise((resolve, reject) => {
|
||||||
console.log('waiting...')
|
// console.log('waiting...')
|
||||||
setTimeout(resolve, milliseconds)
|
// setTimeout(resolve, milliseconds)
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
describe('orbit-db - browser concurrent writes', function () {
|
// describe('orbit-db - browser concurrent writes', function () {
|
||||||
this.timeout(numTabs * config.timeout)
|
// this.timeout(numTabs * config.timeout)
|
||||||
|
|
||||||
let browser
|
// let browser
|
||||||
const options = {
|
// const options = {
|
||||||
ignoreHTTPSErrors: true,
|
// ignoreHTTPSErrors: true,
|
||||||
dumpio: true,
|
// dumpio: true,
|
||||||
args: ['--no-sandbox', '--disable-setuid-sandbox'],
|
// args: ['--no-sandbox', '--disable-setuid-sandbox'],
|
||||||
executablePath: chromium.path
|
// executablePath: chromium.path
|
||||||
}
|
// }
|
||||||
|
|
||||||
before(async () => {
|
// before(async () => {
|
||||||
browser = await puppeteer.launch(options)
|
// browser = await puppeteer.launch(options)
|
||||||
})
|
// })
|
||||||
|
|
||||||
after(async () => {
|
// after(async () => {
|
||||||
await browser.close()
|
// await browser.close()
|
||||||
})
|
// })
|
||||||
|
|
||||||
describe('Write concurrently', function () {
|
// describe('Write concurrently', function () {
|
||||||
const tabs = []
|
// const tabs = []
|
||||||
before(async () => {
|
// before(async () => {
|
||||||
const createTab = async () => {
|
// const createTab = async () => {
|
||||||
const page = await browser.newPage()
|
// const page = await browser.newPage()
|
||||||
await page.goto(`file://${path.resolve('test/browser/index.html')}`)
|
// await page.goto(`file://${path.resolve('test/browser/index.html')}`)
|
||||||
page.on('dialog', dialog => dialog.dismiss())
|
// page.on('dialog', dialog => dialog.dismiss())
|
||||||
page.on('pageerror', err => console.error(err))
|
// page.on('pageerror', err => console.error(err))
|
||||||
page.on('console', message => console.log(message))
|
// page.on('console', message => console.log(message))
|
||||||
await wait(1000)
|
// await wait(1000)
|
||||||
return page
|
// return page
|
||||||
}
|
// }
|
||||||
|
|
||||||
// open several tabs
|
// // open several tabs
|
||||||
for (let i = 0; i < numTabs; i++) {
|
// for (let i = 0; i < numTabs; i++) {
|
||||||
const tab = await createTab()
|
// const tab = await createTab()
|
||||||
tabs.push(tab)
|
// tabs.push(tab)
|
||||||
}
|
// }
|
||||||
|
|
||||||
const addDataButton = 'button#addData'
|
// const addDataButton = 'button#addData'
|
||||||
await pMap(tabs, async (page) => {
|
// await pMap(tabs, async (page) => {
|
||||||
await page.waitForFunction(
|
// await page.waitForFunction(
|
||||||
'document.querySelector("#waitForOpenDB").innerText.includes("orbitdb")'
|
// 'document.querySelector("#waitForOpenDB").innerText.includes("orbitdb")'
|
||||||
)
|
// )
|
||||||
const addDataToLog = (maxClicks, maxWaitTime) => {
|
// const addDataToLog = (maxClicks, maxWaitTime) => {
|
||||||
let count = 0
|
// let count = 0
|
||||||
const repeat = () => new Promise((resolve, reject) => {
|
// const repeat = () => new Promise((resolve, reject) => {
|
||||||
setTimeout(async () => {
|
// setTimeout(async () => {
|
||||||
await page.click(addDataButton)
|
// await page.click(addDataButton)
|
||||||
if (++count < maxClicks) {
|
// if (++count < maxClicks) {
|
||||||
await repeat()
|
// await repeat()
|
||||||
}
|
// }
|
||||||
resolve()
|
// resolve()
|
||||||
}, Math.random() * maxWaitTime + 300) // ensure waiting at least ~300ms
|
// }, Math.random() * maxWaitTime + 300) // ensure waiting at least ~300ms
|
||||||
})
|
// })
|
||||||
return repeat()
|
// return repeat()
|
||||||
}
|
// }
|
||||||
|
|
||||||
return addDataToLog(clicksPerTab, 1000)
|
// return addDataToLog(clicksPerTab, 1000)
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
|
|
||||||
it('syncLocal option - Multiple tabs converge to same log', async () => {
|
// it('syncLocal option - Multiple tabs converge to same log', async () => {
|
||||||
return new Promise((resolve, reject) => {
|
// return new Promise((resolve, reject) => {
|
||||||
let polls = 0
|
// let polls = 0
|
||||||
const interval = setInterval(async () => {
|
// const interval = setInterval(async () => {
|
||||||
const logHashes = []
|
// const logHashes = []
|
||||||
await mapSeries(tabs, async (page) => {
|
// await mapSeries(tabs, async (page) => {
|
||||||
await page.evaluate(() => loadConsistentLog())
|
// await page.evaluate(() => loadConsistentLog())
|
||||||
const hash = await page.evaluate(async () => await getConsistentLogHash())
|
// const hash = await page.evaluate(async () => await getConsistentLogHash())
|
||||||
logHashes.push(hash)
|
// logHashes.push(hash)
|
||||||
})
|
// })
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
const hashes = Array.from(new Set(logHashes))
|
// const hashes = Array.from(new Set(logHashes))
|
||||||
// ensure log hashes are equal
|
// // ensure log hashes are equal
|
||||||
assert.strictEqual(hashes.length, 1)
|
// assert.strictEqual(hashes.length, 1)
|
||||||
clearInterval(interval)
|
// clearInterval(interval)
|
||||||
resolve()
|
// resolve()
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
console.log('Repolling...')
|
// console.log('Repolling...')
|
||||||
if (++polls > 5) {
|
// if (++polls > 5) {
|
||||||
reject(e)
|
// reject(e)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}, 3000)
|
// }, 3000)
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
|
|
||||||
it('no syncLocal option - Multiple tabs do not converge to same log', async () => {
|
// it('no syncLocal option - Multiple tabs do not converge to same log', async () => {
|
||||||
return new Promise((resolve, reject) => {
|
// return new Promise((resolve, reject) => {
|
||||||
const interval = setInterval(async () => {
|
// const interval = setInterval(async () => {
|
||||||
const logHashes = []
|
// const logHashes = []
|
||||||
await mapSeries(tabs, async (page) => {
|
// await mapSeries(tabs, async (page) => {
|
||||||
const hash = await page.evaluate(async () => await getInconsistentLogHash())
|
// const hash = await page.evaluate(async () => await getInconsistentLogHash())
|
||||||
logHashes.push(hash)
|
// logHashes.push(hash)
|
||||||
})
|
// })
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
const hashes = Array.from(new Set(logHashes))
|
// const hashes = Array.from(new Set(logHashes))
|
||||||
// logs hash different hashes
|
// // logs hash different hashes
|
||||||
assert.strictEqual(hashes.length, numTabs)
|
// assert.strictEqual(hashes.length, numTabs)
|
||||||
clearInterval(interval)
|
// clearInterval(interval)
|
||||||
resolve()
|
// resolve()
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
reject(e)
|
// reject(e)
|
||||||
}
|
// }
|
||||||
}, 3000)
|
// }, 3000)
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
|
@ -13,7 +13,7 @@ const keysPath = './testkeys'
|
|||||||
const IPFS = 'js-ipfs'
|
const IPFS = 'js-ipfs'
|
||||||
|
|
||||||
describe('Documents Database Replication', function () {
|
describe('Documents Database Replication', function () {
|
||||||
this.timeout(5000)
|
this.timeout(30000)
|
||||||
|
|
||||||
let ipfsd1, ipfsd2
|
let ipfsd1, ipfsd2
|
||||||
let ipfs1, ipfs2
|
let ipfs1, ipfs2
|
||||||
@ -82,27 +82,27 @@ describe('Documents Database Replication', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('gets all documents', async () => {
|
it('gets all documents', async () => {
|
||||||
let updateDB1Count = 0
|
let connected1 = false
|
||||||
let updateDB2Count = 0
|
let connected2 = false
|
||||||
|
|
||||||
const onDB1Update = (entry) => {
|
const onConnected1 = (entry) => {
|
||||||
++updateDB1Count
|
connected1 = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const onDB2Update = (entry) => {
|
const onConnected2 = (entry) => {
|
||||||
++updateDB2Count
|
connected2 = true
|
||||||
}
|
}
|
||||||
|
|
||||||
db1.events.on('update', onDB1Update)
|
db1.events.on('join', onConnected1)
|
||||||
db2.events.on('update', onDB2Update)
|
db2.events.on('join', onConnected2)
|
||||||
|
|
||||||
await db1.put({ _id: 1, msg: 'record 1 on db 1' })
|
await db1.put({ _id: 1, msg: 'record 1 on db 1' })
|
||||||
await db2.put({ _id: 2, msg: 'record 2 on db 2' })
|
await db2.put({ _id: 2, msg: 'record 2 on db 2' })
|
||||||
await db1.put({ _id: 3, msg: 'record 3 on db 1' })
|
await db1.put({ _id: 3, msg: 'record 3 on db 1' })
|
||||||
await db2.put({ _id: 4, msg: 'record 4 on db 2' })
|
await db2.put({ _id: 4, msg: 'record 4 on db 2' })
|
||||||
|
|
||||||
await waitFor(() => updateDB1Count, () => 4)
|
await waitFor(() => connected1, () => true)
|
||||||
await waitFor(() => updateDB2Count, () => 4)
|
await waitFor(() => connected2, () => true)
|
||||||
|
|
||||||
const all1 = []
|
const all1 = []
|
||||||
for await (const item of db1.iterator()) {
|
for await (const item of db1.iterator()) {
|
||||||
|
BIN
test/fixtures/go-ipfs.zip
vendored
BIN
test/fixtures/go-ipfs.zip
vendored
Binary file not shown.
@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
ŽCome hang out in our IRC chat room if you have any questions.
|
|
||||||
|
|
||||||
Contact the ipfs dev team:
|
|
||||||
- Bugs: https://github.com/ipfs/go-ipfs/issues
|
|
||||||
- Help: irc.freenode.org/#ipfs
|
|
||||||
- Email: dev@ipfs.io
|
|
||||||
½
|
|
Binary file not shown.
@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
¿·Some helpful resources for finding your way around ipfs:
|
|
||||||
|
|
||||||
- quick-start: a quick show of various ipfs features.
|
|
||||||
- ipfs commands: a list of all commands
|
|
||||||
- ipfs --help: every command describes itself
|
|
||||||
- https://github.com/ipfs/go-ipfs -- the src repository
|
|
||||||
- #ipfs on irc.freenode.org -- the community irc channel
|
|
||||||
·
|
|
@ -1,115 +0,0 @@
|
|||||||
|
|
||||||
½
µ
# 0.1 - Quick Start
|
|
||||||
|
|
||||||
This is a set of short examples with minimal explanation. It is meant as
|
|
||||||
a "quick start". Soon, we'll write a longer tour :-)
|
|
||||||
|
|
||||||
|
|
||||||
Add a file to ipfs:
|
|
||||||
|
|
||||||
echo "hello world" >hello
|
|
||||||
ipfs add hello
|
|
||||||
|
|
||||||
|
|
||||||
View it:
|
|
||||||
|
|
||||||
ipfs cat <the-hash-you-got-here>
|
|
||||||
|
|
||||||
|
|
||||||
Try a directory:
|
|
||||||
|
|
||||||
mkdir foo
|
|
||||||
mkdir foo/bar
|
|
||||||
echo "baz" > foo/baz
|
|
||||||
echo "baz" > foo/bar/baz
|
|
||||||
ipfs add -r foo
|
|
||||||
|
|
||||||
|
|
||||||
View things:
|
|
||||||
|
|
||||||
ipfs ls <the-hash-here>
|
|
||||||
ipfs ls <the-hash-here>/bar
|
|
||||||
ipfs cat <the-hash-here>/baz
|
|
||||||
ipfs cat <the-hash-here>/bar/baz
|
|
||||||
ipfs cat <the-hash-here>/bar
|
|
||||||
ipfs ls <the-hash-here>/baz
|
|
||||||
|
|
||||||
|
|
||||||
References:
|
|
||||||
|
|
||||||
ipfs refs <the-hash-here>
|
|
||||||
ipfs refs -r <the-hash-here>
|
|
||||||
ipfs refs --help
|
|
||||||
|
|
||||||
|
|
||||||
Get:
|
|
||||||
|
|
||||||
ipfs get <the-hash-here> -o foo2
|
|
||||||
diff foo foo2
|
|
||||||
|
|
||||||
|
|
||||||
Objects:
|
|
||||||
|
|
||||||
ipfs object get <the-hash-here>
|
|
||||||
ipfs object get <the-hash-here>/foo2
|
|
||||||
ipfs object --help
|
|
||||||
|
|
||||||
|
|
||||||
Pin + GC:
|
|
||||||
|
|
||||||
ipfs pin add <the-hash-here>
|
|
||||||
ipfs repo gc
|
|
||||||
ipfs ls <the-hash-here>
|
|
||||||
ipfs pin rm <the-hash-here>
|
|
||||||
ipfs repo gc
|
|
||||||
|
|
||||||
|
|
||||||
Daemon:
|
|
||||||
|
|
||||||
ipfs daemon (in another terminal)
|
|
||||||
ipfs id
|
|
||||||
|
|
||||||
|
|
||||||
Network:
|
|
||||||
|
|
||||||
(must be online)
|
|
||||||
ipfs swarm peers
|
|
||||||
ipfs id
|
|
||||||
ipfs cat <hash-of-remote-object>
|
|
||||||
|
|
||||||
|
|
||||||
Mount:
|
|
||||||
|
|
||||||
(warning: fuse is finicky!)
|
|
||||||
ipfs mount
|
|
||||||
cd /ipfs/<the-hash-here>
|
|
||||||
ls
|
|
||||||
|
|
||||||
|
|
||||||
Tool:
|
|
||||||
|
|
||||||
ipfs version
|
|
||||||
ipfs update
|
|
||||||
ipfs commands
|
|
||||||
ipfs config --help
|
|
||||||
open http://localhost:5001/webui
|
|
||||||
|
|
||||||
|
|
||||||
Browse:
|
|
||||||
|
|
||||||
webui:
|
|
||||||
|
|
||||||
http://localhost:5001/webui
|
|
||||||
|
|
||||||
video:
|
|
||||||
|
|
||||||
http://localhost:8080/ipfs/QmVc6zuAneKJzicnJpfrqCH9gSy6bz54JhcypfJYhGUFQu/play#/ipfs/QmTKZgRNwDNZwHtJSjCp6r5FYefzpULfy37JvMt9DwvXse
|
|
||||||
|
|
||||||
images:
|
|
||||||
|
|
||||||
http://localhost:8080/ipfs/QmZpc3HvfjEXvLWGQPWbHk3AjD5j8NEN4gmFN8Jmrd5g83/cs
|
|
||||||
|
|
||||||
markdown renderer app:
|
|
||||||
|
|
||||||
http://localhost:8080/ipfs/QmX7M9CiYXjVeFnkfVGf3y5ixTZ2ACeSGyL1vBJY1HvQPp/mdown
|
|
||||||
µ
|
|
@ -1,27 +0,0 @@
|
|||||||
|
|
||||||
’ Š IPFS Alpha Security Notes
|
|
||||||
|
|
||||||
We try hard to ensure our system is safe and robust, but all software
|
|
||||||
has bugs, especially new software. This distribution is meant to be an
|
|
||||||
alpha preview, don't use it for anything mission critical.
|
|
||||||
|
|
||||||
Please note the following:
|
|
||||||
|
|
||||||
- This is alpha software and has not been audited. It is our goal
|
|
||||||
to conduct a proper security audit once we close in on a 1.0 release.
|
|
||||||
|
|
||||||
- ipfs is a networked program, and may have serious undiscovered
|
|
||||||
vulnerabilities. It is written in Go, and we do not execute any
|
|
||||||
user provided data. But please point any problems out to us in a
|
|
||||||
github issue, or email security@ipfs.io privately.
|
|
||||||
|
|
||||||
- security@ipfs.io GPG key:
|
|
||||||
- 4B9665FB 92636D17 7C7A86D3 50AAE8A9 59B13AF3
|
|
||||||
- https://pgp.mit.edu/pks/lookup?op=get&search=0x50AAE8A959B13AF3
|
|
||||||
|
|
||||||
- ipfs uses encryption for all communication, but it's NOT PROVEN SECURE
|
|
||||||
YET! It may be totally broken. For now, the code is included to make
|
|
||||||
sure we benchmark our operations with encryption in mind. In the future,
|
|
||||||
there will be an "unsafe" mode for high performance intranet apps.
|
|
||||||
If this is a blocking feature for you, please contact us.
|
|
||||||
Š
|
|
@ -1,4 +0,0 @@
|
|||||||
.
|
|
||||||
" ’èžsÜL`•>¾P}ãÈD
|
|
||||||
>ÚŸo_¸=¡"´u'Òintro§
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
Index
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
|
|
||||||
¤œWIP
|
|
||||||
|
|
||||||
# 0.0 - Introduction
|
|
||||||
|
|
||||||
Welcome to IPFS! This tour will guide you through a few of the
|
|
||||||
features of this tool, and the most common commands. Then, it will
|
|
||||||
immerse you into the world of merkledags and the amazing things
|
|
||||||
you can do with them.
|
|
||||||
|
|
||||||
|
|
||||||
This tour has many parts, and can be taken in different sequences.
|
|
||||||
Different people learn different ways, so choose your own adventure:
|
|
||||||
|
|
||||||
To start with the concepts, try:
|
|
||||||
- The Merkle DAG
|
|
||||||
- Data Structures on the Merkle DAG
|
|
||||||
- Representing Files with unixfs
|
|
||||||
- add, cat, ls, refs
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
To start with the examples, try:
|
|
||||||
- add, cat, ls, refs
|
|
||||||
- Representing Files with unixfs
|
|
||||||
- Data Structures on the Merkle DAG
|
|
||||||
- The Merkle DAG
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
To start with the network, try:
|
|
||||||
- IPFS Nodes
|
|
||||||
- Running the daemon
|
|
||||||
- The Swarm
|
|
||||||
- The Web
|
|
||||||
œ
|
|
@ -1,28 +0,0 @@
|
|||||||
|
|
||||||
ЛГHello and Welcome to IPFS!
|
|
||||||
|
|
||||||
в–€в–€в•—в–€в–€в–€в–€в–€в–€в•— в–€в–€в–€в–€в–€в–€в–€в•—в–€в–€в–€в–€в–€в–€в–€в•—
|
|
||||||
в–€в–€в•‘в–€в–€в•”в•ђв•ђв–€в–€в•—в–€в–€в•”в•ђв•ђв•ђв•ђв•ќв–€в–€в•”в•ђв•ђв•ђв•ђв•ќ
|
|
||||||
в–€в–€в•‘в–€в–€в–€в–€в–€в–€в•”в•ќв–€в–€в–€в–€в–€в•— в–€в–€в–€в–€в–€в–€в–€в•—
|
|
||||||
в–€в–€в•‘в–€в–€в•”в•ђв•ђв•ђв•ќ в–€в–€в•”в•ђв•ђв•ќ в•љв•ђв•ђв•ђв•ђв–€в–€в•‘
|
|
||||||
в–€в–€в•‘в–€в–€в•‘ в–€в–€в•‘ в–€в–€в–€в–€в–€в–€в–€в•‘
|
|
||||||
в•љв•ђв•ќв•љв•ђв•ќ в•љв•ђв•ќ в•љв•ђв•ђв•ђв•ђв•ђв•ђв•ќ
|
|
||||||
|
|
||||||
If you're seeing this, you have successfully installed
|
|
||||||
IPFS and are now interfacing with the ipfs merkledag!
|
|
||||||
|
|
||||||
-------------------------------------------------------
|
|
||||||
| Warning: |
|
|
||||||
| This is alpha software. Use at your own discretion! |
|
|
||||||
| Much is missing or lacking polish. There are bugs. |
|
|
||||||
| Not yet secure. Read the security notes for more. |
|
|
||||||
-------------------------------------------------------
|
|
||||||
|
|
||||||
Check out some of the other files in this directory:
|
|
||||||
|
|
||||||
./about
|
|
||||||
./help
|
|
||||||
./quick-start <-- usage examples
|
|
||||||
./readme <-- this file
|
|
||||||
./security-notes
|
|
||||||
Г
|
|
@ -1,3 +0,0 @@
|
|||||||
-
|
|
||||||
" õR ;<3B>—¿ˆfq<66>aU¿õ0[Xè@÷8Ó·O§¦index
|
|
||||||
|
|
1
test/fixtures/ipfs1/blocks/SHARDING.data
vendored
1
test/fixtures/ipfs1/blocks/SHARDING.data
vendored
@ -1 +0,0 @@
|
|||||||
/repo/flatfs/shard/v1/next-to-last/2
|
|
@ -1,54 +0,0 @@
|
|||||||
|
|
||||||
”
Œ
IPFS -- Inter-Planetary File system
|
|
||||||
|
|
||||||
IPFS is a global, versioned, peer-to-peer filesystem. It combines good ideas
|
|
||||||
from Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bit-
|
|
||||||
torrent swarm, exchanging git objects. IPFS provides an interface as simple
|
|
||||||
as the HTTP web, but with permanence built in. You can also mount the world
|
|
||||||
at /ipfs.
|
|
||||||
|
|
||||||
IPFS is a protocol:
|
|
||||||
- defines a content-addressed file system
|
|
||||||
- coordinates content delivery
|
|
||||||
- combines Kademlia + BitTorrent + Git
|
|
||||||
|
|
||||||
IPFS is a filesystem:
|
|
||||||
- has directories and files
|
|
||||||
- mountable filesystem (via FUSE)
|
|
||||||
|
|
||||||
IPFS is a web:
|
|
||||||
- can be used to view documents like the web
|
|
||||||
- files accessible via HTTP at 'http://ipfs.io/<path>'
|
|
||||||
- browsers or extensions can learn to use 'ipfs://' directly
|
|
||||||
- hash-addressed content guarantees authenticity
|
|
||||||
|
|
||||||
IPFS is modular:
|
|
||||||
- connection layer over any network protocol
|
|
||||||
- routing layer
|
|
||||||
- uses a routing layer DHT (kademlia/coral)
|
|
||||||
- uses a path-based naming service
|
|
||||||
- uses bittorrent-inspired block exchange
|
|
||||||
|
|
||||||
IPFS uses crypto:
|
|
||||||
- cryptographic-hash content addressing
|
|
||||||
- block-level deduplication
|
|
||||||
- file integrity + versioning
|
|
||||||
- filesystem-level encryption + signing support
|
|
||||||
|
|
||||||
IPFS is p2p:
|
|
||||||
- worldwide peer-to-peer file transfers
|
|
||||||
- completely decentralized architecture
|
|
||||||
- **no** central point of failure
|
|
||||||
|
|
||||||
IPFS is a cdn:
|
|
||||||
- add a file to the filesystem locally, and it's now available to the world
|
|
||||||
- caching-friendly (content-hash naming)
|
|
||||||
- bittorrent-based bandwidth distribution
|
|
||||||
|
|
||||||
IPFS has a name service:
|
|
||||||
- IPNS, an SFS inspired name system
|
|
||||||
- global namespace based on PKI
|
|
||||||
- serves to build trust chains
|
|
||||||
- compatible with other NSes
|
|
||||||
- can map DNS, .onion, .bit, etc to IPNS
|
|
||||||
Œ
|
|
@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
|
|
22
test/fixtures/ipfs1/blocks/_README.data
vendored
22
test/fixtures/ipfs1/blocks/_README.data
vendored
@ -1,22 +0,0 @@
|
|||||||
This is a repository of IPLD objects. Each IPLD object is in a single file,
|
|
||||||
named <base32 encoding of cid>.data. Where <base32 encoding of cid> is the
|
|
||||||
"base32" encoding of the CID (as specified in
|
|
||||||
https://github.com/multiformats/multibase) without the 'B' prefix.
|
|
||||||
All the object files are placed in a tree of directories, based on a
|
|
||||||
function of the CID. This is a form of sharding similar to
|
|
||||||
the objects directory in git repositories. Previously, we used
|
|
||||||
prefixes, we now use the next-to-last two charters.
|
|
||||||
func NextToLast(base32cid string) {
|
|
||||||
nextToLastLen := 2
|
|
||||||
offset := len(base32cid) - nextToLastLen - 1
|
|
||||||
return str[offset : offset+nextToLastLen]
|
|
||||||
}
|
|
||||||
For example, an object with a base58 CIDv1 of
|
|
||||||
zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f
|
|
||||||
has a base32 CIDv1 of
|
|
||||||
BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA
|
|
||||||
and will be placed at
|
|
||||||
SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data
|
|
||||||
with 'SC' being the last-to-next two characters and the 'B' at the
|
|
||||||
beginning of the CIDv1 string is the multibase prefix that is not
|
|
||||||
stored in the filename.
|
|
82
test/fixtures/ipfs1/config
vendored
82
test/fixtures/ipfs1/config
vendored
@ -1,82 +0,0 @@
|
|||||||
{
|
|
||||||
"Addresses": {
|
|
||||||
"Swarm": [
|
|
||||||
"/ip4/0.0.0.0/tcp/0"
|
|
||||||
],
|
|
||||||
"Announce": [],
|
|
||||||
"NoAnnounce": [],
|
|
||||||
"API": "/ip4/127.0.0.1/tcp/0",
|
|
||||||
"Gateway": "/ip4/0.0.0.0/tcp/0",
|
|
||||||
"RPC": "/ip4/127.0.0.1/tcp/5003",
|
|
||||||
"Delegates": [
|
|
||||||
"/dns4/node0.delegate.ipfs.io/tcp/443/https",
|
|
||||||
"/dns4/node1.delegate.ipfs.io/tcp/443/https",
|
|
||||||
"/dns4/node2.delegate.ipfs.io/tcp/443/https",
|
|
||||||
"/dns4/node3.delegate.ipfs.io/tcp/443/https"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Discovery": {
|
|
||||||
"MDNS": {
|
|
||||||
"Enabled": true,
|
|
||||||
"Interval": 0
|
|
||||||
},
|
|
||||||
"webRTCStar": {
|
|
||||||
"Enabled": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Bootstrap": [],
|
|
||||||
"Pubsub": {
|
|
||||||
"Router": "gossipsub",
|
|
||||||
"Enabled": true
|
|
||||||
},
|
|
||||||
"Swarm": {
|
|
||||||
"ConnMgr": {
|
|
||||||
"LowWater": 50,
|
|
||||||
"HighWater": 200
|
|
||||||
},
|
|
||||||
"DisableNatPortMap": false
|
|
||||||
},
|
|
||||||
"Routing": {
|
|
||||||
"Type": "dhtclient"
|
|
||||||
},
|
|
||||||
"Identity": {
|
|
||||||
"PeerID": "12D3KooWK49VRnddoBhSDsYcwuzeje5XRJ9ZT3r2g5QdLzJbHQwi",
|
|
||||||
"PrivKey": "CAESQBdBLRS/jdSCzti7eJ1aS1khEYTuZgIuOhFyg+2eqfBNiUD6j6fuMapKVqFyuQtQzHXrAEd9bCfZUfhe82wxBqE="
|
|
||||||
},
|
|
||||||
"Datastore": {
|
|
||||||
"Spec": {
|
|
||||||
"type": "mount",
|
|
||||||
"mounts": [
|
|
||||||
{
|
|
||||||
"mountpoint": "/blocks",
|
|
||||||
"type": "measure",
|
|
||||||
"prefix": "flatfs.datastore",
|
|
||||||
"child": {
|
|
||||||
"type": "flatfs",
|
|
||||||
"path": "blocks",
|
|
||||||
"sync": true,
|
|
||||||
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mountpoint": "/",
|
|
||||||
"type": "measure",
|
|
||||||
"prefix": "leveldb.datastore",
|
|
||||||
"child": {
|
|
||||||
"type": "levelds",
|
|
||||||
"path": "datastore",
|
|
||||||
"compression": "none"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Keychain": {
|
|
||||||
"DEK": {
|
|
||||||
"keyLength": 64,
|
|
||||||
"iterationCount": 10000,
|
|
||||||
"salt": "A2lYMmv0i8H3PlH7ejbma30G",
|
|
||||||
"hash": "sha2-512"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
BIN
test/fixtures/ipfs1/datastore/000003.log
vendored
BIN
test/fixtures/ipfs1/datastore/000003.log
vendored
Binary file not shown.
1
test/fixtures/ipfs1/datastore/CURRENT
vendored
1
test/fixtures/ipfs1/datastore/CURRENT
vendored
@ -1 +0,0 @@
|
|||||||
MANIFEST-000002
|
|
0
test/fixtures/ipfs1/datastore/LOCK
vendored
0
test/fixtures/ipfs1/datastore/LOCK
vendored
1
test/fixtures/ipfs1/datastore/LOG
vendored
1
test/fixtures/ipfs1/datastore/LOG
vendored
@ -1 +0,0 @@
|
|||||||
2023/02/01-11:13:27.065492 171997000 Delete type=3 #1
|
|
BIN
test/fixtures/ipfs1/datastore/MANIFEST-000002
vendored
BIN
test/fixtures/ipfs1/datastore/MANIFEST-000002
vendored
Binary file not shown.
1
test/fixtures/ipfs1/datastore_spec
vendored
1
test/fixtures/ipfs1/datastore_spec
vendored
@ -1 +0,0 @@
|
|||||||
{"mounts":[{"mountpoint":"/blocks","path":"blocks","shardFunc":"/repo/flatfs/shard/v1/next-to-last/2","type":"flatfs"},{"mountpoint":"/","path":"datastore","type":"levelds"}],"type":"mount"}
|
|
BIN
test/fixtures/ipfs1/pins/000003.log
vendored
BIN
test/fixtures/ipfs1/pins/000003.log
vendored
Binary file not shown.
1
test/fixtures/ipfs1/pins/CURRENT
vendored
1
test/fixtures/ipfs1/pins/CURRENT
vendored
@ -1 +0,0 @@
|
|||||||
MANIFEST-000002
|
|
0
test/fixtures/ipfs1/pins/LOCK
vendored
0
test/fixtures/ipfs1/pins/LOCK
vendored
1
test/fixtures/ipfs1/pins/LOG
vendored
1
test/fixtures/ipfs1/pins/LOG
vendored
@ -1 +0,0 @@
|
|||||||
2023/02/01-11:13:27.065506 170987000 Delete type=3 #1
|
|
BIN
test/fixtures/ipfs1/pins/MANIFEST-000002
vendored
BIN
test/fixtures/ipfs1/pins/MANIFEST-000002
vendored
Binary file not shown.
1
test/fixtures/ipfs1/version
vendored
1
test/fixtures/ipfs1/version
vendored
@ -1 +0,0 @@
|
|||||||
12
|
|
@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
ŽCome hang out in our IRC chat room if you have any questions.
|
|
||||||
|
|
||||||
Contact the ipfs dev team:
|
|
||||||
- Bugs: https://github.com/ipfs/go-ipfs/issues
|
|
||||||
- Help: irc.freenode.org/#ipfs
|
|
||||||
- Email: dev@ipfs.io
|
|
||||||
½
|
|
Binary file not shown.
@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
¿·Some helpful resources for finding your way around ipfs:
|
|
||||||
|
|
||||||
- quick-start: a quick show of various ipfs features.
|
|
||||||
- ipfs commands: a list of all commands
|
|
||||||
- ipfs --help: every command describes itself
|
|
||||||
- https://github.com/ipfs/go-ipfs -- the src repository
|
|
||||||
- #ipfs on irc.freenode.org -- the community irc channel
|
|
||||||
·
|
|
@ -1,115 +0,0 @@
|
|||||||
|
|
||||||
½
µ
# 0.1 - Quick Start
|
|
||||||
|
|
||||||
This is a set of short examples with minimal explanation. It is meant as
|
|
||||||
a "quick start". Soon, we'll write a longer tour :-)
|
|
||||||
|
|
||||||
|
|
||||||
Add a file to ipfs:
|
|
||||||
|
|
||||||
echo "hello world" >hello
|
|
||||||
ipfs add hello
|
|
||||||
|
|
||||||
|
|
||||||
View it:
|
|
||||||
|
|
||||||
ipfs cat <the-hash-you-got-here>
|
|
||||||
|
|
||||||
|
|
||||||
Try a directory:
|
|
||||||
|
|
||||||
mkdir foo
|
|
||||||
mkdir foo/bar
|
|
||||||
echo "baz" > foo/baz
|
|
||||||
echo "baz" > foo/bar/baz
|
|
||||||
ipfs add -r foo
|
|
||||||
|
|
||||||
|
|
||||||
View things:
|
|
||||||
|
|
||||||
ipfs ls <the-hash-here>
|
|
||||||
ipfs ls <the-hash-here>/bar
|
|
||||||
ipfs cat <the-hash-here>/baz
|
|
||||||
ipfs cat <the-hash-here>/bar/baz
|
|
||||||
ipfs cat <the-hash-here>/bar
|
|
||||||
ipfs ls <the-hash-here>/baz
|
|
||||||
|
|
||||||
|
|
||||||
References:
|
|
||||||
|
|
||||||
ipfs refs <the-hash-here>
|
|
||||||
ipfs refs -r <the-hash-here>
|
|
||||||
ipfs refs --help
|
|
||||||
|
|
||||||
|
|
||||||
Get:
|
|
||||||
|
|
||||||
ipfs get <the-hash-here> -o foo2
|
|
||||||
diff foo foo2
|
|
||||||
|
|
||||||
|
|
||||||
Objects:
|
|
||||||
|
|
||||||
ipfs object get <the-hash-here>
|
|
||||||
ipfs object get <the-hash-here>/foo2
|
|
||||||
ipfs object --help
|
|
||||||
|
|
||||||
|
|
||||||
Pin + GC:
|
|
||||||
|
|
||||||
ipfs pin add <the-hash-here>
|
|
||||||
ipfs repo gc
|
|
||||||
ipfs ls <the-hash-here>
|
|
||||||
ipfs pin rm <the-hash-here>
|
|
||||||
ipfs repo gc
|
|
||||||
|
|
||||||
|
|
||||||
Daemon:
|
|
||||||
|
|
||||||
ipfs daemon (in another terminal)
|
|
||||||
ipfs id
|
|
||||||
|
|
||||||
|
|
||||||
Network:
|
|
||||||
|
|
||||||
(must be online)
|
|
||||||
ipfs swarm peers
|
|
||||||
ipfs id
|
|
||||||
ipfs cat <hash-of-remote-object>
|
|
||||||
|
|
||||||
|
|
||||||
Mount:
|
|
||||||
|
|
||||||
(warning: fuse is finicky!)
|
|
||||||
ipfs mount
|
|
||||||
cd /ipfs/<the-hash-here>
|
|
||||||
ls
|
|
||||||
|
|
||||||
|
|
||||||
Tool:
|
|
||||||
|
|
||||||
ipfs version
|
|
||||||
ipfs update
|
|
||||||
ipfs commands
|
|
||||||
ipfs config --help
|
|
||||||
open http://localhost:5001/webui
|
|
||||||
|
|
||||||
|
|
||||||
Browse:
|
|
||||||
|
|
||||||
webui:
|
|
||||||
|
|
||||||
http://localhost:5001/webui
|
|
||||||
|
|
||||||
video:
|
|
||||||
|
|
||||||
http://localhost:8080/ipfs/QmVc6zuAneKJzicnJpfrqCH9gSy6bz54JhcypfJYhGUFQu/play#/ipfs/QmTKZgRNwDNZwHtJSjCp6r5FYefzpULfy37JvMt9DwvXse
|
|
||||||
|
|
||||||
images:
|
|
||||||
|
|
||||||
http://localhost:8080/ipfs/QmZpc3HvfjEXvLWGQPWbHk3AjD5j8NEN4gmFN8Jmrd5g83/cs
|
|
||||||
|
|
||||||
markdown renderer app:
|
|
||||||
|
|
||||||
http://localhost:8080/ipfs/QmX7M9CiYXjVeFnkfVGf3y5ixTZ2ACeSGyL1vBJY1HvQPp/mdown
|
|
||||||
µ
|
|
@ -1,27 +0,0 @@
|
|||||||
|
|
||||||
’ Š IPFS Alpha Security Notes
|
|
||||||
|
|
||||||
We try hard to ensure our system is safe and robust, but all software
|
|
||||||
has bugs, especially new software. This distribution is meant to be an
|
|
||||||
alpha preview, don't use it for anything mission critical.
|
|
||||||
|
|
||||||
Please note the following:
|
|
||||||
|
|
||||||
- This is alpha software and has not been audited. It is our goal
|
|
||||||
to conduct a proper security audit once we close in on a 1.0 release.
|
|
||||||
|
|
||||||
- ipfs is a networked program, and may have serious undiscovered
|
|
||||||
vulnerabilities. It is written in Go, and we do not execute any
|
|
||||||
user provided data. But please point any problems out to us in a
|
|
||||||
github issue, or email security@ipfs.io privately.
|
|
||||||
|
|
||||||
- security@ipfs.io GPG key:
|
|
||||||
- 4B9665FB 92636D17 7C7A86D3 50AAE8A9 59B13AF3
|
|
||||||
- https://pgp.mit.edu/pks/lookup?op=get&search=0x50AAE8A959B13AF3
|
|
||||||
|
|
||||||
- ipfs uses encryption for all communication, but it's NOT PROVEN SECURE
|
|
||||||
YET! It may be totally broken. For now, the code is included to make
|
|
||||||
sure we benchmark our operations with encryption in mind. In the future,
|
|
||||||
there will be an "unsafe" mode for high performance intranet apps.
|
|
||||||
If this is a blocking feature for you, please contact us.
|
|
||||||
Š
|
|
@ -1,4 +0,0 @@
|
|||||||
.
|
|
||||||
" ’èžsÜL`•>¾P}ãÈD
|
|
||||||
>ÚŸo_¸=¡"´u'Òintro§
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
Index
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
|
|
||||||
¤œWIP
|
|
||||||
|
|
||||||
# 0.0 - Introduction
|
|
||||||
|
|
||||||
Welcome to IPFS! This tour will guide you through a few of the
|
|
||||||
features of this tool, and the most common commands. Then, it will
|
|
||||||
immerse you into the world of merkledags and the amazing things
|
|
||||||
you can do with them.
|
|
||||||
|
|
||||||
|
|
||||||
This tour has many parts, and can be taken in different sequences.
|
|
||||||
Different people learn different ways, so choose your own adventure:
|
|
||||||
|
|
||||||
To start with the concepts, try:
|
|
||||||
- The Merkle DAG
|
|
||||||
- Data Structures on the Merkle DAG
|
|
||||||
- Representing Files with unixfs
|
|
||||||
- add, cat, ls, refs
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
To start with the examples, try:
|
|
||||||
- add, cat, ls, refs
|
|
||||||
- Representing Files with unixfs
|
|
||||||
- Data Structures on the Merkle DAG
|
|
||||||
- The Merkle DAG
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
To start with the network, try:
|
|
||||||
- IPFS Nodes
|
|
||||||
- Running the daemon
|
|
||||||
- The Swarm
|
|
||||||
- The Web
|
|
||||||
œ
|
|
@ -1,28 +0,0 @@
|
|||||||
|
|
||||||
ЛГHello and Welcome to IPFS!
|
|
||||||
|
|
||||||
в–€в–€в•—в–€в–€в–€в–€в–€в–€в•— в–€в–€в–€в–€в–€в–€в–€в•—в–€в–€в–€в–€в–€в–€в–€в•—
|
|
||||||
в–€в–€в•‘в–€в–€в•”в•ђв•ђв–€в–€в•—в–€в–€в•”в•ђв•ђв•ђв•ђв•ќв–€в–€в•”в•ђв•ђв•ђв•ђв•ќ
|
|
||||||
в–€в–€в•‘в–€в–€в–€в–€в–€в–€в•”в•ќв–€в–€в–€в–€в–€в•— в–€в–€в–€в–€в–€в–€в–€в•—
|
|
||||||
в–€в–€в•‘в–€в–€в•”в•ђв•ђв•ђв•ќ в–€в–€в•”в•ђв•ђв•ќ в•љв•ђв•ђв•ђв•ђв–€в–€в•‘
|
|
||||||
в–€в–€в•‘в–€в–€в•‘ в–€в–€в•‘ в–€в–€в–€в–€в–€в–€в–€в•‘
|
|
||||||
в•љв•ђв•ќв•љв•ђв•ќ в•љв•ђв•ќ в•љв•ђв•ђв•ђв•ђв•ђв•ђв•ќ
|
|
||||||
|
|
||||||
If you're seeing this, you have successfully installed
|
|
||||||
IPFS and are now interfacing with the ipfs merkledag!
|
|
||||||
|
|
||||||
-------------------------------------------------------
|
|
||||||
| Warning: |
|
|
||||||
| This is alpha software. Use at your own discretion! |
|
|
||||||
| Much is missing or lacking polish. There are bugs. |
|
|
||||||
| Not yet secure. Read the security notes for more. |
|
|
||||||
-------------------------------------------------------
|
|
||||||
|
|
||||||
Check out some of the other files in this directory:
|
|
||||||
|
|
||||||
./about
|
|
||||||
./help
|
|
||||||
./quick-start <-- usage examples
|
|
||||||
./readme <-- this file
|
|
||||||
./security-notes
|
|
||||||
Г
|
|
@ -1,3 +0,0 @@
|
|||||||
-
|
|
||||||
" õR ;<3B>—¿ˆfq<66>aU¿õ0[Xè@÷8Ó·O§¦index
|
|
||||||
|
|
1
test/fixtures/ipfs2/blocks/SHARDING.data
vendored
1
test/fixtures/ipfs2/blocks/SHARDING.data
vendored
@ -1 +0,0 @@
|
|||||||
/repo/flatfs/shard/v1/next-to-last/2
|
|
@ -1,54 +0,0 @@
|
|||||||
|
|
||||||
”
Œ
IPFS -- Inter-Planetary File system
|
|
||||||
|
|
||||||
IPFS is a global, versioned, peer-to-peer filesystem. It combines good ideas
|
|
||||||
from Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bit-
|
|
||||||
torrent swarm, exchanging git objects. IPFS provides an interface as simple
|
|
||||||
as the HTTP web, but with permanence built in. You can also mount the world
|
|
||||||
at /ipfs.
|
|
||||||
|
|
||||||
IPFS is a protocol:
|
|
||||||
- defines a content-addressed file system
|
|
||||||
- coordinates content delivery
|
|
||||||
- combines Kademlia + BitTorrent + Git
|
|
||||||
|
|
||||||
IPFS is a filesystem:
|
|
||||||
- has directories and files
|
|
||||||
- mountable filesystem (via FUSE)
|
|
||||||
|
|
||||||
IPFS is a web:
|
|
||||||
- can be used to view documents like the web
|
|
||||||
- files accessible via HTTP at 'http://ipfs.io/<path>'
|
|
||||||
- browsers or extensions can learn to use 'ipfs://' directly
|
|
||||||
- hash-addressed content guarantees authenticity
|
|
||||||
|
|
||||||
IPFS is modular:
|
|
||||||
- connection layer over any network protocol
|
|
||||||
- routing layer
|
|
||||||
- uses a routing layer DHT (kademlia/coral)
|
|
||||||
- uses a path-based naming service
|
|
||||||
- uses bittorrent-inspired block exchange
|
|
||||||
|
|
||||||
IPFS uses crypto:
|
|
||||||
- cryptographic-hash content addressing
|
|
||||||
- block-level deduplication
|
|
||||||
- file integrity + versioning
|
|
||||||
- filesystem-level encryption + signing support
|
|
||||||
|
|
||||||
IPFS is p2p:
|
|
||||||
- worldwide peer-to-peer file transfers
|
|
||||||
- completely decentralized architecture
|
|
||||||
- **no** central point of failure
|
|
||||||
|
|
||||||
IPFS is a cdn:
|
|
||||||
- add a file to the filesystem locally, and it's now available to the world
|
|
||||||
- caching-friendly (content-hash naming)
|
|
||||||
- bittorrent-based bandwidth distribution
|
|
||||||
|
|
||||||
IPFS has a name service:
|
|
||||||
- IPNS, an SFS inspired name system
|
|
||||||
- global namespace based on PKI
|
|
||||||
- serves to build trust chains
|
|
||||||
- compatible with other NSes
|
|
||||||
- can map DNS, .onion, .bit, etc to IPNS
|
|
||||||
Œ
|
|
@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
|
|
22
test/fixtures/ipfs2/blocks/_README.data
vendored
22
test/fixtures/ipfs2/blocks/_README.data
vendored
@ -1,22 +0,0 @@
|
|||||||
This is a repository of IPLD objects. Each IPLD object is in a single file,
|
|
||||||
named <base32 encoding of cid>.data. Where <base32 encoding of cid> is the
|
|
||||||
"base32" encoding of the CID (as specified in
|
|
||||||
https://github.com/multiformats/multibase) without the 'B' prefix.
|
|
||||||
All the object files are placed in a tree of directories, based on a
|
|
||||||
function of the CID. This is a form of sharding similar to
|
|
||||||
the objects directory in git repositories. Previously, we used
|
|
||||||
prefixes, we now use the next-to-last two charters.
|
|
||||||
func NextToLast(base32cid string) {
|
|
||||||
nextToLastLen := 2
|
|
||||||
offset := len(base32cid) - nextToLastLen - 1
|
|
||||||
return str[offset : offset+nextToLastLen]
|
|
||||||
}
|
|
||||||
For example, an object with a base58 CIDv1 of
|
|
||||||
zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f
|
|
||||||
has a base32 CIDv1 of
|
|
||||||
BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA
|
|
||||||
and will be placed at
|
|
||||||
SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data
|
|
||||||
with 'SC' being the last-to-next two characters and the 'B' at the
|
|
||||||
beginning of the CIDv1 string is the multibase prefix that is not
|
|
||||||
stored in the filename.
|
|
82
test/fixtures/ipfs2/config
vendored
82
test/fixtures/ipfs2/config
vendored
@ -1,82 +0,0 @@
|
|||||||
{
|
|
||||||
"Addresses": {
|
|
||||||
"Swarm": [
|
|
||||||
"/ip4/0.0.0.0/tcp/0"
|
|
||||||
],
|
|
||||||
"Announce": [],
|
|
||||||
"NoAnnounce": [],
|
|
||||||
"API": "/ip4/127.0.0.1/tcp/0",
|
|
||||||
"Gateway": "/ip4/0.0.0.0/tcp/0",
|
|
||||||
"RPC": "/ip4/127.0.0.1/tcp/5003",
|
|
||||||
"Delegates": [
|
|
||||||
"/dns4/node0.delegate.ipfs.io/tcp/443/https",
|
|
||||||
"/dns4/node1.delegate.ipfs.io/tcp/443/https",
|
|
||||||
"/dns4/node2.delegate.ipfs.io/tcp/443/https",
|
|
||||||
"/dns4/node3.delegate.ipfs.io/tcp/443/https"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Discovery": {
|
|
||||||
"MDNS": {
|
|
||||||
"Enabled": true,
|
|
||||||
"Interval": 0
|
|
||||||
},
|
|
||||||
"webRTCStar": {
|
|
||||||
"Enabled": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Bootstrap": [],
|
|
||||||
"Pubsub": {
|
|
||||||
"Router": "gossipsub",
|
|
||||||
"Enabled": true
|
|
||||||
},
|
|
||||||
"Swarm": {
|
|
||||||
"ConnMgr": {
|
|
||||||
"LowWater": 50,
|
|
||||||
"HighWater": 200
|
|
||||||
},
|
|
||||||
"DisableNatPortMap": false
|
|
||||||
},
|
|
||||||
"Routing": {
|
|
||||||
"Type": "dhtclient"
|
|
||||||
},
|
|
||||||
"Identity": {
|
|
||||||
"PeerID": "12D3KooWP5QaQL2omcRK7FLkWSHCmnUF9b17AJf4YG73vLJx2tnQ",
|
|
||||||
"PrivKey": "CAESQP57AculF+mQdCi+Pw2lC347p9qcNYW35zA9VQTxMftTxQJdZAH/irzFp8r/0kt5LrD6mjGUjciPV0PVY/n7xe0="
|
|
||||||
},
|
|
||||||
"Datastore": {
|
|
||||||
"Spec": {
|
|
||||||
"type": "mount",
|
|
||||||
"mounts": [
|
|
||||||
{
|
|
||||||
"mountpoint": "/blocks",
|
|
||||||
"type": "measure",
|
|
||||||
"prefix": "flatfs.datastore",
|
|
||||||
"child": {
|
|
||||||
"type": "flatfs",
|
|
||||||
"path": "blocks",
|
|
||||||
"sync": true,
|
|
||||||
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mountpoint": "/",
|
|
||||||
"type": "measure",
|
|
||||||
"prefix": "leveldb.datastore",
|
|
||||||
"child": {
|
|
||||||
"type": "levelds",
|
|
||||||
"path": "datastore",
|
|
||||||
"compression": "none"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Keychain": {
|
|
||||||
"DEK": {
|
|
||||||
"keyLength": 64,
|
|
||||||
"iterationCount": 10000,
|
|
||||||
"salt": "DMg1WBkXaZWg7Ez0RSxvZXl6",
|
|
||||||
"hash": "sha2-512"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
BIN
test/fixtures/ipfs2/datastore/000003.log
vendored
BIN
test/fixtures/ipfs2/datastore/000003.log
vendored
Binary file not shown.
1
test/fixtures/ipfs2/datastore/CURRENT
vendored
1
test/fixtures/ipfs2/datastore/CURRENT
vendored
@ -1 +0,0 @@
|
|||||||
MANIFEST-000002
|
|
0
test/fixtures/ipfs2/datastore/LOCK
vendored
0
test/fixtures/ipfs2/datastore/LOCK
vendored
1
test/fixtures/ipfs2/datastore/LOG
vendored
1
test/fixtures/ipfs2/datastore/LOG
vendored
@ -1 +0,0 @@
|
|||||||
2023/02/01-11:13:27.250433 17118f000 Delete type=3 #1
|
|
BIN
test/fixtures/ipfs2/datastore/MANIFEST-000002
vendored
BIN
test/fixtures/ipfs2/datastore/MANIFEST-000002
vendored
Binary file not shown.
1
test/fixtures/ipfs2/datastore_spec
vendored
1
test/fixtures/ipfs2/datastore_spec
vendored
@ -1 +0,0 @@
|
|||||||
{"mounts":[{"mountpoint":"/blocks","path":"blocks","shardFunc":"/repo/flatfs/shard/v1/next-to-last/2","type":"flatfs"},{"mountpoint":"/","path":"datastore","type":"levelds"}],"type":"mount"}
|
|
BIN
test/fixtures/ipfs2/pins/000003.log
vendored
BIN
test/fixtures/ipfs2/pins/000003.log
vendored
Binary file not shown.
1
test/fixtures/ipfs2/pins/CURRENT
vendored
1
test/fixtures/ipfs2/pins/CURRENT
vendored
@ -1 +0,0 @@
|
|||||||
MANIFEST-000002
|
|
0
test/fixtures/ipfs2/pins/LOCK
vendored
0
test/fixtures/ipfs2/pins/LOCK
vendored
1
test/fixtures/ipfs2/pins/LOG
vendored
1
test/fixtures/ipfs2/pins/LOG
vendored
@ -1 +0,0 @@
|
|||||||
2023/02/01-11:13:27.250612 171997000 Delete type=3 #1
|
|
BIN
test/fixtures/ipfs2/pins/MANIFEST-000002
vendored
BIN
test/fixtures/ipfs2/pins/MANIFEST-000002
vendored
Binary file not shown.
1
test/fixtures/ipfs2/version
vendored
1
test/fixtures/ipfs2/version
vendored
@ -1 +0,0 @@
|
|||||||
12
|
|
BIN
test/fixtures/js-ipfs.zip
vendored
BIN
test/fixtures/js-ipfs.zip
vendored
Binary file not shown.
BIN
test/fixtures/keys/000007.ldb
vendored
BIN
test/fixtures/keys/000007.ldb
vendored
Binary file not shown.
0
test/fixtures/keys/000008.log
vendored
0
test/fixtures/keys/000008.log
vendored
1
test/fixtures/keys/CURRENT
vendored
1
test/fixtures/keys/CURRENT
vendored
@ -1 +0,0 @@
|
|||||||
MANIFEST-000006
|
|
0
test/fixtures/keys/LOCK
vendored
0
test/fixtures/keys/LOCK
vendored
5
test/fixtures/keys/LOG
vendored
5
test/fixtures/keys/LOG
vendored
@ -1,5 +0,0 @@
|
|||||||
2019/05/29-12:52:07.013848 7fca7db68700 Recovering log #5
|
|
||||||
2019/05/29-12:52:07.013874 7fca7db68700 Level-0 table #7: started
|
|
||||||
2019/05/29-12:52:07.015813 7fca7db68700 Level-0 table #7: 408 bytes OK
|
|
||||||
2019/05/29-12:52:07.020773 7fca7db68700 Delete type=3 #4
|
|
||||||
2019/05/29-12:52:07.020800 7fca7db68700 Delete type=0 #5
|
|
3
test/fixtures/keys/LOG.old
vendored
3
test/fixtures/keys/LOG.old
vendored
@ -1,3 +0,0 @@
|
|||||||
2019/05/29-12:52:06.991247 7fca7e369700 Recovering log #3
|
|
||||||
2019/05/29-12:52:06.996822 7fca7e369700 Delete type=3 #2
|
|
||||||
2019/05/29-12:52:06.996849 7fca7e369700 Delete type=0 #3
|
|
BIN
test/fixtures/keys/MANIFEST-000006
vendored
BIN
test/fixtures/keys/MANIFEST-000006
vendored
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
{"publicKey":"04b54f6ef529cd2dd2f9c6897a382c492222d42e57826269a38101ffe752aa07260ecd092a970d7eef08c4ddae2b7006ee25f07e4ab62fa5262ae3b51fdea29f78","privateKey":"31cbd0193567605dba4cd27a0fe4de82151be65aac16b58f2337ec2b7ad41b38"}
|
|
BIN
test/fixtures/keys/identity-keys/000005.ldb
vendored
BIN
test/fixtures/keys/identity-keys/000005.ldb
vendored
Binary file not shown.
BIN
test/fixtures/keys/identity-keys/000010.ldb
vendored
BIN
test/fixtures/keys/identity-keys/000010.ldb
vendored
Binary file not shown.
BIN
test/fixtures/keys/identity-keys/000015.ldb
vendored
BIN
test/fixtures/keys/identity-keys/000015.ldb
vendored
Binary file not shown.
BIN
test/fixtures/keys/identity-keys/000020.ldb
vendored
BIN
test/fixtures/keys/identity-keys/000020.ldb
vendored
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
{"publicKey":"030f4141da9bb4bc8d9cc9a6a01cdf0e8bc0c0f90fd28646f93d0de4e93b723e31","privateKey":"7c6140e9ae4c70eb11600b3d550cc6aac45511b5a660f4e75fe9a7c4e6d1c7b7"}
|
|
@ -1 +0,0 @@
|
|||||||
{"publicKey":"0208290bc83e02be25a65be2e067e4d2ecc55ae88e0c073b5d48887d45e7e0e393","privateKey":"2b487a932233c8691024c951faaeac207be161797bdda7bd934c0125012a5551"}
|
|
@ -1 +0,0 @@
|
|||||||
{"publicKey":"0276b51c36dc6a117aef6f8ecaa49c27c309b29bbc97218e21cc0d7c903a21f376","privateKey":"1cd65d23d72932f5ca2328988d19a5b11fbab1f4c921ef2471768f1773bd56de"}
|
|
@ -1 +0,0 @@
|
|||||||
{"publicKey":"038bef2231e64d5c7147bd4b8afb84abd4126ee8d8335e4b069ac0a65c7be711ce","privateKey":"97f64ca2bf7bd6aa2136eb0aa3ce512433bd903b91d48b2208052d6ff286d080"}
|
|
1
test/fixtures/keys/identity-keys/CURRENT
vendored
1
test/fixtures/keys/identity-keys/CURRENT
vendored
@ -1 +0,0 @@
|
|||||||
MANIFEST-000854
|
|
0
test/fixtures/keys/identity-keys/LOCK
vendored
0
test/fixtures/keys/identity-keys/LOCK
vendored
3
test/fixtures/keys/identity-keys/LOG
vendored
3
test/fixtures/keys/identity-keys/LOG
vendored
@ -1,3 +0,0 @@
|
|||||||
2019/03/27-11:44:01.835874 7f06117fa700 Recovering log #853
|
|
||||||
2019/03/27-11:44:01.849182 7f06117fa700 Delete type=3 #852
|
|
||||||
2019/03/27-11:44:01.849215 7f06117fa700 Delete type=0 #853
|
|
3
test/fixtures/keys/identity-keys/LOG.old
vendored
3
test/fixtures/keys/identity-keys/LOG.old
vendored
@ -1,3 +0,0 @@
|
|||||||
2019/03/27-11:44:01.798320 7f06117fa700 Recovering log #851
|
|
||||||
2019/03/27-11:44:01.813702 7f06117fa700 Delete type=0 #851
|
|
||||||
2019/03/27-11:44:01.813995 7f06117fa700 Delete type=3 #850
|
|
BIN
test/fixtures/keys/identity-keys/MANIFEST-000854
vendored
BIN
test/fixtures/keys/identity-keys/MANIFEST-000854
vendored
Binary file not shown.
BIN
test/fixtures/keys/signing-keys/000007.ldb
vendored
BIN
test/fixtures/keys/signing-keys/000007.ldb
vendored
Binary file not shown.
BIN
test/fixtures/keys/signing-keys/000014.ldb
vendored
BIN
test/fixtures/keys/signing-keys/000014.ldb
vendored
Binary file not shown.
BIN
test/fixtures/keys/signing-keys/000021.ldb
vendored
BIN
test/fixtures/keys/signing-keys/000021.ldb
vendored
Binary file not shown.
BIN
test/fixtures/keys/signing-keys/000028.ldb
vendored
BIN
test/fixtures/keys/signing-keys/000028.ldb
vendored
Binary file not shown.
1
test/fixtures/keys/signing-keys/CURRENT
vendored
1
test/fixtures/keys/signing-keys/CURRENT
vendored
@ -1 +0,0 @@
|
|||||||
MANIFEST-000040
|
|
0
test/fixtures/keys/signing-keys/LOCK
vendored
0
test/fixtures/keys/signing-keys/LOCK
vendored
3
test/fixtures/keys/signing-keys/LOG
vendored
3
test/fixtures/keys/signing-keys/LOG
vendored
@ -1,3 +0,0 @@
|
|||||||
2019/03/27-11:43:50.355576 7f06127fc700 Recovering log #39
|
|
||||||
2019/03/27-11:43:50.370199 7f06127fc700 Delete type=0 #39
|
|
||||||
2019/03/27-11:43:50.370296 7f06127fc700 Delete type=3 #38
|
|
3
test/fixtures/keys/signing-keys/LOG.old
vendored
3
test/fixtures/keys/signing-keys/LOG.old
vendored
@ -1,3 +0,0 @@
|
|||||||
2019/03/27-11:43:50.315665 7f0610ff9700 Recovering log #37
|
|
||||||
2019/03/27-11:43:50.331030 7f0610ff9700 Delete type=3 #36
|
|
||||||
2019/03/27-11:43:50.331192 7f0610ff9700 Delete type=0 #37
|
|
BIN
test/fixtures/keys/signing-keys/MANIFEST-000040
vendored
BIN
test/fixtures/keys/signing-keys/MANIFEST-000040
vendored
Binary file not shown.
1
test/fixtures/keys/signing-keys/userA.json
vendored
1
test/fixtures/keys/signing-keys/userA.json
vendored
@ -1 +0,0 @@
|
|||||||
{"publicKey":"03e0480538c2a39951d054e17ff31fde487cb1031d0044a037b53ad2e028a3e77c","privateKey":"0a135ce157a9ccb8375c2fae0d472f1eade4b40b37704c02df923b78ca03c627"}
|
|
1
test/fixtures/keys/signing-keys/userB.json
vendored
1
test/fixtures/keys/signing-keys/userB.json
vendored
@ -1 +0,0 @@
|
|||||||
{"publicKey":"0358df8eb5def772917748fdf8a8b146581ad2041eae48d66cc6865f11783499a6","privateKey":"855f70d3b5224e5af76c23db0792339ca8d968a5a802ff0c5b54d674ef01aaad"}
|
|
1
test/fixtures/keys/signing-keys/userC.json
vendored
1
test/fixtures/keys/signing-keys/userC.json
vendored
@ -1 +0,0 @@
|
|||||||
{"publicKey":"032f7b6ef0432b572b45fcaf27e7f6757cd4123ff5c5266365bec82129b8c5f214","privateKey":"291d4dc915d81e9ebe5627c3f5e7309e819e721ee75e63286baa913497d61c78"}
|
|
1
test/fixtures/keys/signing-keys/userD.json
vendored
1
test/fixtures/keys/signing-keys/userD.json
vendored
@ -1 +0,0 @@
|
|||||||
{"publicKey":"02a38336e3a47f545a172c9f77674525471ebeda7d6c86140e7a778f67ded92260","privateKey":"faa2d697318a6f8daeb8f4189fc657e7ae1b24e18c91c3bb9b95ad3c0cc050f8"}
|
|
BIN
test/fixtures/migration/cache-schema-test/000003.log
vendored
BIN
test/fixtures/migration/cache-schema-test/000003.log
vendored
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
MANIFEST-000002
|
|
@ -1 +0,0 @@
|
|||||||
2019/09/01-11:44:17.005796 7fd834d96700 Delete type=3 #1
|
|
Binary file not shown.
67
test/fixtures/orbit-db-identity-keys.js
vendored
67
test/fixtures/orbit-db-identity-keys.js
vendored
@ -1,67 +0,0 @@
|
|||||||
import KeyStore from '../../src/key-store.js'
|
|
||||||
import { Identities } from '../../src/identities/index.js'
|
|
||||||
import rimraf from 'rimraf'
|
|
||||||
|
|
||||||
const { sync: rmrf } = rimraf
|
|
||||||
import testKeysPath from './test-keys-path.js '
|
|
||||||
|
|
||||||
import userA from "./keys/identity-keys/03e0480538c2a39951d054e17ff31fde487cb1031d0044a037b53ad2e028a3e77c.json" assert { type: "json" }
|
|
||||||
import userB from "./keys/identity-keys/0358df8eb5def772917748fdf8a8b146581ad2041eae48d66cc6865f11783499a6.json" assert { type: "json" }
|
|
||||||
import userC from "./keys/identity-keys/032f7b6ef0432b572b45fcaf27e7f6757cd4123ff5c5266365bec82129b8c5f214.json" assert { type: "json" }
|
|
||||||
import userD from "./keys/identity-keys/02a38336e3a47f545a172c9f77674525471ebeda7d6c86140e7a778f67ded92260.json" assert { type: "json" }
|
|
||||||
|
|
||||||
import userA_ from "./keys/signing-keys/userA.json" assert { type: "json" }
|
|
||||||
import userB_ from "./keys/signing-keys/userB.json" assert { type: "json" }
|
|
||||||
import userC_ from "./keys/signing-keys/userC.json" assert { type: "json" }
|
|
||||||
import userD_ from "./keys/signing-keys/userD.json" assert { type: "json" }
|
|
||||||
|
|
||||||
const identityKeys = {
|
|
||||||
'03e0480538c2a39951d054e17ff31fde487cb1031d0044a037b53ad2e028a3e77c': userA,
|
|
||||||
'0358df8eb5def772917748fdf8a8b146581ad2041eae48d66cc6865f11783499a6': userB,
|
|
||||||
'032f7b6ef0432b572b45fcaf27e7f6757cd4123ff5c5266365bec82129b8c5f214': userC,
|
|
||||||
'02a38336e3a47f545a172c9f77674525471ebeda7d6c86140e7a778f67ded92260': userD,
|
|
||||||
}
|
|
||||||
|
|
||||||
const signingKeys = {
|
|
||||||
userA: userA_,
|
|
||||||
userB: userB_,
|
|
||||||
userC: userC_,
|
|
||||||
userD: userD_,
|
|
||||||
}
|
|
||||||
|
|
||||||
const createTestIdentities = async (ipfs1, ipfs2) => {
|
|
||||||
// rmrf('./keys_1')
|
|
||||||
|
|
||||||
// const keystore = await KeyStore()
|
|
||||||
const keystore = await KeyStore({ path: testKeysPath })
|
|
||||||
// for (const [key, value] of Object.entries(identityKeys)) {
|
|
||||||
// await keystore.addKey(key, value)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for (const [key, value] of Object.entries(signingKeys)) {
|
|
||||||
// await keystore.addKey(key, value)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Create an identity for each peers
|
|
||||||
const identities1 = await Identities({ keystore, ipfs: ipfs1 })
|
|
||||||
const identities2 = await Identities({ keystore, ipfs: ipfs2 })
|
|
||||||
const testIdentity1 = await identities1.createIdentity({ id: 'userA' })
|
|
||||||
const testIdentity2 = await identities2.createIdentity({ id: 'userB' })
|
|
||||||
|
|
||||||
return [[identities1, identities2], [testIdentity1, testIdentity2]]
|
|
||||||
}
|
|
||||||
|
|
||||||
const cleanUpTestIdentities = async (identities) => {
|
|
||||||
for (let identity of identities) {
|
|
||||||
await identity.keystore.close()
|
|
||||||
}
|
|
||||||
rmrf('./keys_1')
|
|
||||||
// rmrf('./orbitdb')
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
identityKeys,
|
|
||||||
signingKeys,
|
|
||||||
createTestIdentities,
|
|
||||||
cleanUpTestIdentities
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user