一、生成共享秘钥
搭建IPFS私有网络,首先需要使所有节点共享一个密钥swarm.key。
git clone https://github.com/Kubuxu/go-ipfs-swarm-key-gen.git
cd go-ipfs-swarm-key-gen
go run main.go > swarm.key
二、网络搭建
拉取镜像
docker pull ipfs/go-ipfs:latest
启动节点
准备工作
首先,分别创建两个节点目录node1和node2。
其次,在node1和node2目录下再创建ipfs_staging和ipfs_data目录。
最后,把swarm.key文件分别放置node1和node2目录下。启动节点1
进入node1目录,并执行命令
# 启动命令
docker run -d --name ipfs_node1 -e IPFS_SWARM_KEY_FILE=$PWD/swarm.key -v $PWD/ipfs_staging:/export -v $PWD/ipfs_data:/data/ipfs -p 4001:4001 -p 8081:8080 -p 5001:5001 ipfs/go-ipfs:latest
# 清除容器默认的bootstrap
docker exec -it ipfs_node1 ipfs bootstrap rm --all
查看启动日志:
oot@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node1# docker logs ipfs_node1
Changing user to ipfs
ipfs version 0.22.0
Found IPFS fs-repo at /data/ipfs
Initializing daemon...
Kubo version: 0.22.0-3f884d3
Repo version: 14
System version: amd64/linux
Golang version: go1.19.10
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/127.0.0.1/udp/4001/quic
Swarm listening on /ip4/127.0.0.1/udp/4001/quic-v1
Swarm listening on /ip4/127.0.0.1/udp/4001/quic-v1/webtransport/certhash/uEiCHi9Q0d98H9RNRm9PSpbuOzqwFavKSqvI3I9mIpui9fw/certhash/uEiBL3UeS5ivkkLgV3dTEAN9exPeeLQVu1QRPzTzCRDZB9Q
Swarm listening on /ip4/172.17.0.2/tcp/4001
Swarm listening on /ip4/172.17.0.2/udp/4001/quic
Swarm listening on /ip4/172.17.0.2/udp/4001/quic-v1
Swarm listening on /ip4/172.17.0.2/udp/4001/quic-v1/webtransport/certhash/uEiCHi9Q0d98H9RNRm9PSpbuOzqwFavKSqvI3I9mIpui9fw/certhash/uEiBL3UeS5ivkkLgV3dTEAN9exPeeLQVu1QRPzTzCRDZB9Q
Swarm listening on /p2p-circuit
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/127.0.0.1/udp/4001/quic
Swarm announcing /ip4/127.0.0.1/udp/4001/quic-v1
Swarm announcing /ip4/127.0.0.1/udp/4001/quic-v1/webtransport/certhash/uEiCHi9Q0d98H9RNRm9PSpbuOzqwFavKSqvI3I9mIpui9fw/certhash/uEiBL3UeS5ivkkLgV3dTEAN9exPeeLQVu1QRPzTzCRDZB9Q
Swarm announcing /ip4/172.17.0.2/tcp/4001
Swarm announcing /ip4/172.17.0.2/udp/4001/quic
Swarm announcing /ip4/172.17.0.2/udp/4001/quic-v1
Swarm announcing /ip4/172.17.0.2/udp/4001/quic-v1/webtransport/certhash/uEiCHi9Q0d98H9RNRm9PSpbuOzqwFavKSqvI3I9mIpui9fw/certhash/uEiBL3UeS5ivkkLgV3dTEAN9exPeeLQVu1QRPzTzCRDZB9Q
RPC API server listening on /ip4/0.0.0.0/tcp/5001
WebUI: http://0.0.0.0:5001/webui
Gateway server listening on /ip4/0.0.0.0/tcp/8080
Daemon is ready
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node1#
删除默认节点日志:
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node1# docker exec -it ipfs_node1 ipfs bootstrap rm --all
ipfs: Reading from /dev/stdin; send Ctrl-d to stop.
removed /dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN
removed /dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa
removed /dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb
removed /dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt
removed /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
removed /ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node1#
- 启动节点2
进入node2目录,并执行命令
# 启动命令
docker run -d --name ipfs_node2 -e IPFS_SWARM_KEY_FILE=$PWD/swarm.key -v $PWD/ipfs_staging:/export -v $PWD/ipfs_data:/data/ipfs -p 4002:4001 -p 8082:8080 -p 5002:5001 ipfs/go-ipfs:latest
# 清除容器默认的bootstrap
docker exec -it ipfs_node2 ipfs bootstrap rm --all
# 查看node1的id信息
docker exec ipfs_node2 ipfs id
启动日志:
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node2# docker logs ipfs_node2
Changing user to ipfs
ipfs version 0.22.0
Found IPFS fs-repo at /data/ipfs
Initializing daemon...
Kubo version: 0.22.0-3f884d3
Repo version: 14
System version: amd64/linux
Golang version: go1.19.10
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/127.0.0.1/udp/4001/quic
Swarm listening on /ip4/127.0.0.1/udp/4001/quic-v1
Swarm listening on /ip4/127.0.0.1/udp/4001/quic-v1/webtransport/certhash/uEiAXPSdMkTA82JOrbHAWGq0CqS4cTHbU8pRwguTFkOTLgw/certhash/uEiAKjvyQ_pQVOrhePZWpvb4K_xF9gISKW-4XQm0Ltpw1aw
Swarm listening on /ip4/172.17.0.3/tcp/4001
Swarm listening on /ip4/172.17.0.3/udp/4001/quic
Swarm listening on /ip4/172.17.0.3/udp/4001/quic-v1
Swarm listening on /ip4/172.17.0.3/udp/4001/quic-v1/webtransport/certhash/uEiAXPSdMkTA82JOrbHAWGq0CqS4cTHbU8pRwguTFkOTLgw/certhash/uEiAKjvyQ_pQVOrhePZWpvb4K_xF9gISKW-4XQm0Ltpw1aw
Swarm listening on /p2p-circuit
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/127.0.0.1/udp/4001/quic
Swarm announcing /ip4/127.0.0.1/udp/4001/quic-v1
Swarm announcing /ip4/127.0.0.1/udp/4001/quic-v1/webtransport/certhash/uEiAXPSdMkTA82JOrbHAWGq0CqS4cTHbU8pRwguTFkOTLgw/certhash/uEiAKjvyQ_pQVOrhePZWpvb4K_xF9gISKW-4XQm0Ltpw1aw
Swarm announcing /ip4/172.17.0.3/tcp/4001
Swarm announcing /ip4/172.17.0.3/udp/4001/quic
Swarm announcing /ip4/172.17.0.3/udp/4001/quic-v1
Swarm announcing /ip4/172.17.0.3/udp/4001/quic-v1/webtransport/certhash/uEiAXPSdMkTA82JOrbHAWGq0CqS4cTHbU8pRwguTFkOTLgw/certhash/uEiAKjvyQ_pQVOrhePZWpvb4K_xF9gISKW-4XQm0Ltpw1aw
RPC API server listening on /ip4/0.0.0.0/tcp/5001
WebUI: http://0.0.0.0:5001/webui
Gateway server listening on /ip4/0.0.0.0/tcp/8080
Daemon is ready
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node2#
删除默认节点日志:
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node2# docker exec -it ipfs_node2 sh
/ # ipfs bootstrap list
/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN
/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa
/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb
/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt
/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
/ # ipfs bootstrap rm --all
removed /dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN
removed /dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa
removed /dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb
removed /dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt
removed /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
removed /ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
/ #
- 添加bootstrap节点
查看node1的id信息
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node1# docker exec ipfs_node1 ipfs id
{
"ID": "12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"PublicKey": "CAESIP2rQhYBFVC0S7Pm4j0c1fYuF/wxQ/l43e10BnaRWgeP",
"Addresses": [
"/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/127.0.0.1/udp/4001/quic-v1/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/127.0.0.1/udp/4001/quic-v1/webtransport/certhash/uEiCHi9Q0d98H9RNRm9PSpbuOzqwFavKSqvI3I9mIpui9fw/certhash/uEiBL3UeS5ivkkLgV3dTEAN9exPeeLQVu1QRPzTzCRDZB9Q/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/127.0.0.1/udp/4001/quic/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/158.247.207.212/tcp/4001/p2p/12D3KooWEDg5qcwkPGkVNPR7wGUVxLNaLQaruU58hcMSj9gfSLPt/p2p-circuit/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/158.247.207.212/udp/4001/quic-v1/p2p/12D3KooWEDg5qcwkPGkVNPR7wGUVxLNaLQaruU58hcMSj9gfSLPt/p2p-circuit/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/158.247.207.212/udp/4001/quic/p2p/12D3KooWEDg5qcwkPGkVNPR7wGUVxLNaLQaruU58hcMSj9gfSLPt/p2p-circuit/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/172.17.0.2/tcp/4001/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/172.17.0.2/udp/4001/quic-v1/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/172.17.0.2/udp/4001/quic-v1/webtransport/certhash/uEiCHi9Q0d98H9RNRm9PSpbuOzqwFavKSqvI3I9mIpui9fw/certhash/uEiBL3UeS5ivkkLgV3dTEAN9exPeeLQVu1QRPzTzCRDZB9Q/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/172.17.0.2/udp/4001/quic/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/5.161.43.61/tcp/4001/p2p/12D3KooWJjszSPBX3zw178enoigouVjzzFYC91tz5bcuZWWXdhCH/p2p-circuit/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW",
"/ip4/5.161.43.61/udp/4001/quic/p2p/12D3KooWJjszSPBX3zw178enoigouVjzzFYC91tz5bcuZWWXdhCH/p2p-circuit/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW"
],
"AgentVersion": "kubo/0.22.0/3f884d3/docker",
"Protocols": [
"/ipfs/bitswap",
"/ipfs/bitswap/1.0.0",
"/ipfs/bitswap/1.1.0",
"/ipfs/bitswap/1.2.0",
"/ipfs/id/1.0.0",
"/ipfs/id/push/1.0.0",
"/ipfs/lan/kad/1.0.0",
"/ipfs/ping/1.0.0",
"/libp2p/circuit/relay/0.2.0/stop",
"/libp2p/dcutr",
"/x/"
]
}
查看node2的id信息
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node2# docker exec ipfs_node2 ipfs id
{
"ID": "12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"PublicKey": "CAESIJxcnIGDHJPg4q14aTaHQoBE0s71k7KKrkfuxG0dBO/M",
"Addresses": [
"/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/127.0.0.1/udp/4001/quic-v1/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/127.0.0.1/udp/4001/quic-v1/webtransport/certhash/uEiAXPSdMkTA82JOrbHAWGq0CqS4cTHbU8pRwguTFkOTLgw/certhash/uEiAKjvyQ_pQVOrhePZWpvb4K_xF9gISKW-4XQm0Ltpw1aw/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/127.0.0.1/udp/4001/quic/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/172.17.0.3/tcp/4001/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/172.17.0.3/udp/4001/quic-v1/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/172.17.0.3/udp/4001/quic-v1/webtransport/certhash/uEiAXPSdMkTA82JOrbHAWGq0CqS4cTHbU8pRwguTFkOTLgw/certhash/uEiAKjvyQ_pQVOrhePZWpvb4K_xF9gISKW-4XQm0Ltpw1aw/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/172.17.0.3/udp/4001/quic/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/209.182.239.125/tcp/4001/p2p/12D3KooWGwvVPFCXBFTYMdcq2F18jTtXBtEq3SS9Z4wEHUvurGQu/p2p-circuit/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/209.182.239.125/udp/4001/quic/p2p/12D3KooWGwvVPFCXBFTYMdcq2F18jTtXBtEq3SS9Z4wEHUvurGQu/p2p-circuit/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/66.42.78.134/tcp/4001/p2p/12D3KooWDTzARvYtDNuKW1AdRtTjygmVbJ14M7VJExtanwQv8Tv8/p2p-circuit/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/66.42.78.134/udp/4001/quic-v1/p2p/12D3KooWDTzARvYtDNuKW1AdRtTjygmVbJ14M7VJExtanwQv8Tv8/p2p-circuit/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5",
"/ip4/66.42.78.134/udp/4001/quic/p2p/12D3KooWDTzARvYtDNuKW1AdRtTjygmVbJ14M7VJExtanwQv8Tv8/p2p-circuit/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5"
],
"AgentVersion": "kubo/0.22.0/3f884d3/docker",
"Protocols": [
"/ipfs/bitswap",
"/ipfs/bitswap/1.0.0",
"/ipfs/bitswap/1.1.0",
"/ipfs/bitswap/1.2.0",
"/ipfs/id/1.0.0",
"/ipfs/id/push/1.0.0",
"/ipfs/lan/kad/1.0.0",
"/ipfs/ping/1.0.0",
"/libp2p/circuit/relay/0.2.0/stop",
"/libp2p/dcutr",
"/x/"
]
}
分别在两个节点进行bootstrap添加
tips: 仅在一个节点另一个节点可以,会自动发现。但建议多节点时添加多个引导节点。
# 在节点1的bootstrap添加将节点2的地址信息。
# 注意端口号4001需要改成4002
docker exec -it ipfs_node1 ipfs bootstrap add /ip4/172.17.0.3/tcp/4002/p2p/12D3KooWLLjg91CFNBrEV1CoLxo7ceVAxUupGymsCrdfExm8odV5
# 在节点2的bootstrap添加将节点1的地址信息。
docker exec -it ipfs_node1 ipfs bootstrap add /ip4/172.17.0.2/tcp/4001/p2p/12D3KooWStan5Asx1XgqnmKUB2WfbqxWpXY6Rj8i5CfkBzDg8HzW
至此,两个节点的网络搭建完成!!!
三、测试网络
cli 方式
在node1上传一个测试文件'zxltesting.txt',再node2进行下载
- node1 添加文件
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node1# docker exec ipfs_node1 ipfs add /data/ipfs/zxltesting.txt
34 B / 34 B 100.00%added QmR9PYvA7mo1edPU7KGwwdu1dj2pVnHczr4nTyjCPHgA5M zxltesting.txt
- node2下载文件
# 查看文件
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node2# docker exec ipfs_node2 ipfs cat QmR9PYvA7mo1edPU7KGwwdu1dj2pVnHczr4nTyjCPHgA5M
this is an empty file for testing
# 下载文件
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node2/ipfs_data# ll
total 20
drwxr-xr-x 5 opc root 147 Aug 24 16:58 ./
drwxr-xr-x 4 root root 60 Aug 24 15:48 ../
-rw-r--r-- 1 opc users 23 Aug 24 16:56 api
drwxr-xr-x 5 opc users 93 Aug 24 17:30 blocks/
-rw------- 1 opc users 3053 Aug 24 16:58 config
drwxr-xr-x 2 opc users 122 Aug 24 16:56 datastore/
-rw------- 1 opc users 190 Aug 24 16:54 datastore_spec
-rw-r--r-- 1 opc users 21 Aug 24 16:56 gateway
drwx------ 2 opc users 6 Aug 24 16:54 keystore/
-rw-r--r-- 1 opc users 0 Aug 24 16:56 repo.lock
-rw-r--r-- 1 opc users 3 Aug 24 16:54 version
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node2/ipfs_data# docker exec ipfs_node2 ipfs get QmR9PYvA7mo1edPU7KGwwdu1dj2pVnHczr4nTyjCPHgA5M -o /data/ipfs/zxltesting.txt
Saving file(s) to /data/ipfs/zxltesting.txt
34 B / 34 B 100.00% 0s
root@OCI-SIN01-050-ops-bsnbase-com:/bsn/ipfs/node2/ipfs_data# ll
total 24
drwxr-xr-x 5 opc root 169 Aug 24 17:32 ./
drwxr-xr-x 4 root root 60 Aug 24 15:48 ../
-rw-r--r-- 1 opc users 23 Aug 24 16:56 api
drwxr-xr-x 5 opc users 93 Aug 24 17:30 blocks/
-rw------- 1 opc users 3053 Aug 24 16:58 config
drwxr-xr-x 2 opc users 122 Aug 24 16:56 datastore/
-rw------- 1 opc users 190 Aug 24 16:54 datastore_spec
-rw-r--r-- 1 opc users 21 Aug 24 16:56 gateway
drwx------ 2 opc users 6 Aug 24 16:54 keystore/
-rw-r--r-- 1 opc users 0 Aug 24 16:56 repo.lock
-rw-r--r-- 1 opc users 3 Aug 24 16:54 version
-rw------- 1 root root 34 Aug 24 17:32 zxltesting.txt
root@OCI-SIN01-050-ops-bsnbase-c
API方式
https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-add
使用postman 工具
-
上传文件
下载文件
四、使用内置的webui系统(有问题)
- 解决跨域问题
先弄node1
docker exec ipfs_node1 ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://外网ip:5001","http://内网IP:5001"]'
docker exec ipfs_node1 ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]'