IPFS
约 2 分钟阅读
标签:协议
- the InterPlanetary File System
- ipfsGitHub Orgipfsthe InterPlanetary File System · ipfs · ipfs.pics · Distributed image hosting · ipfstube · Why · 提供块级去重, 使得总体数据量得到压缩 · 参考笔记:IPFS
- ipfs.picsGitHubipfspics/ipfspics-serverthe InterPlanetary File System · ipfs · ipfs.pics · Distributed image hosting · ipfstube · Why · 提供块级去重, 使得总体数据量得到压缩 · 参考笔记:IPFS
- Distributed image hosting
- ipfstubeGitHubdownload13/ipfstubethe InterPlanetary File System · ipfs · ipfs.pics · Distributed image hosting · ipfstube · Why · 提供块级去重, 使得总体数据量得到压缩 · 参考笔记:IPFS
- Why
- 提供块级去重, 使得总体数据量得到压缩
- 参考
- Comparison of IPFS and BitTorrent for ArchivesGitHub Issueipfs/notes#208the InterPlanetary File System · ipfs · ipfs.pics · Distributed image hosting · ipfstube · Why · 提供块级去重, 使得总体数据量得到压缩 · 参考笔记:IPFS
- How does IPFS compare with X?Linkdiscuss.ipfs.io/t/how-does-ipfs-compare-with-x/465the InterPlanetary File System · ipfs · ipfs.pics · Distributed image hosting · ipfstube · Why · 提供块级去重, 使得总体数据量得到压缩 · 参考笔记:IPFS
- 端口
- 4001 - Swarm TCP
- 4002 - Swarm uTP
- 5001 - API
/webuiWeb 管理端
- 8080 - Gateway
- 8081 - Swarm Websockets
- 参考
- IPFS 公共网关检测
- 优势
- 支持 gateway - 可以通过 HTTP 直接访问
- 支持 MFS/虚拟目录
- 目标是替代 internet 而不是单纯的 P2P 文件共享
- ipns 替代 dns,ipfs 替代 internet
- 劣势
- IPFS 网络相对 torrent 没那么成熟
- 意味着节点少
- 资源少
- 文件分发较慢
- 开发公司重心转向 filecoin
- IPFS 网络相对 torrent 没那么成熟
- 参考
# macOS
brew install ipfs
# https://docs.ipfs.io/reference/api/cli/
# 生成配置文件
# 默认位于 $HOME/.ipfs 可通过 IPFS_PATH 更改
export IPFS_PATH=$PWD/repo
# 也可以使用 --config 或 -c 指定
ipfs init
# 获取配置
ipfs config -c $PWD/repo --json Addresses.API
# 修改配置
# 默认只监听 127.0.0.1
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
# 启动服务端
ipfs daemon
# 可使用 --api 指定远程接口
# 查看节点
ipfs --api /ip4/127.0.0.1/tcp/5001 swarm peers
# 容器环境中使用 ipfs
docker run --rm -it -v $PWD:/host --entrypoint sh --workdir /host ipfs/go-ipfs
# 启动服务
# -e IPFS_LOGGING=debug 显示调试日志
docker run -it --rm \
-v $PWD/repo:/data/ipfs \
-p 8080:8080 -p 4001:4001 -p 5001:5001 \
--name ipfs_host ipfs/go-ipfs
# 生成 hash 不添加文件 - HASH 对应 IPLD file data
echo 'Hello IPFS!' | ipfs add -nq
# MFS 里文件的 hash - 是一个 LINK - HASH 对应 IPLD 多个 file block - 最后的一个 block 对应 raw 数据 - 相同数据但不同 hsah
ipfs files stat /myfile
# cp 可以支持从 add 的复制到 mfs
ipfs files cp /ipfs/$(echo 'Hello IPFS!' | ipfs add -q) /hello.txt
ipfs files read /hello.txtlibp2p
| 功能 | 目的 | 实现 |
|---|---|---|
| 使用数据 | applications | IPFS |
| 定义数据 | naming merkledag | IPNS IPLD |
| 移动数据 | exchange routing network | libp2p |
ipld/specs/ipldGitHub Fileipld/specs/ipld blog.cloudflare.com/distributed-web-gateway developers.cloudflare.com/distributed-web/ipfs-gateway
filestore
# 启用特性
ipfs config --json Experimental.FilestoreEnabled truegateway
- ipfs/go-ipfs/docs/gateway.mdGitHub Fileipfs/go-ipfs/docs/gateway.md
- ipfs/infra/ipfs/gateway/nginx.confGitHub Fileipfs/infra/ipfs/gateway/nginx.conf
- rklaehn.github.io/2018/06/08/running-ipfs-gateway
ipfs swarm connect $peer
ipfs bootstrap add $peer关联信息
反向链接、本文链接的其他页面和外部资料。
References
GitHub10 条
- cloudflare/ipfs-extgithub.com/cloudflare/ipfs-ext
- download13/ipfstubegithub.com/download13/ipfstube
- ipfsgithub.com/ipfs
- ipfs/go-ipfs/docs/gateway.mdgithub.com/ipfs/go-ipfs/blob/master/docs/gateway.md
- ipfs/infra/ipfs/gateway/nginx.confgithub.com/ipfs/infra/blob/master/ipfs/gateway/nginx.conf
- ipfs/notes#208github.com/ipfs/notes/issues/208
- ipfspics/ipfspics-servergithub.com/ipfspics/ipfspics-server
- ipld/specs/ipldgithub.com/ipld/specs/tree/master/ipld
- libp2p/go-libp2pgithub.com/libp2p/go-libp2p
- libp2p/libp2pgithub.com/libp2p/libp2p
其他外链6 条
- apis.wener.me/ipfs/gateway/checkerapis.wener.me/ipfs/gateway/checker
- blog.cloudflare.com/distributed-web-gatewayblog.cloudflare.com/distributed-web-gateway
- developers.cloudflare.com/distributed-web/ipfs-gatewaydevelopers.cloudflare.com/distributed-web/ipfs-gateway
- discuss.ipfs.io/t/how-does-ipfs-compare-with-x/465discuss.ipfs.io/t/how-does-ipfs-compare-with-x/465
- discuss.ipfs.io/t/is-it-possible-to-use-ipfs-for-live-video-streaming/1115discuss.ipfs.io/t/is-it-possible-to-use-ipfs-for-live-video-streaming/1115
- rklaehn.github.io/2018/06/08/running-ipfs-gatewayrklaehn.github.io/2018/06/08/running-ipfs-gateway