Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit ee2fbcd

Browse files
committed
Merge remote-tracking branch 'upstream/master' into shared-worker
2 parents 102b1ae + 16587f1 commit ee2fbcd

File tree

111 files changed

+899
-671
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+899
-671
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Checks
2+
3+
on: [push]
4+
5+
jobs:
6+
checks:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- run: npm i
11+
- uses: ipfs/aegir/actions/bundle-size@master
12+
with:
13+
github_token: ${{ secrets.GITHUB_TOKEN }}

docs/core-api/CONFIG.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# Config API <!-- omit in toc -->
22

3-
- [`ipfs.config.get([key,] [options])`](#ipfsconfiggetkey-options)
3+
- [`ipfs.config.get(key, [options])`](#ipfsconfiggetkey-options)
44
- [Parameters](#parameters)
55
- [Options](#options)
66
- [Returns](#returns)
77
- [Example](#example)
8+
- [`ipfs.config.getAll([options])`](#ipfsconfiggetkey-options)
9+
- [Options](#options)
10+
- [Returns](#returns)
11+
- [Example](#example)
812
- [`ipfs.config.set(key, value, [options])`](#ipfsconfigsetkey-value-options)
913
- [Parameters](#parameters-1)
1014
- [Options](#options-1)
@@ -26,15 +30,15 @@
2630
- [Returns](#returns-4)
2731
- [Example](#example-4)
2832

29-
## `ipfs.config.get([key,] [options])`
33+
## `ipfs.config.get(key, [options])`
3034

3135
> Returns the currently being used config. If the daemon is off, it returns the stored config.
3236
3337
### Parameters
3438

3539
| Name | Type | Description |
3640
| ---- | ---- | ----------- |
37-
| key | `String` | The key of the value that should be fetched from the config file. If no key is passed, then the whole config will be returned. |
41+
| key | `String` | The key of the value that should be fetched from the config file. |
3842

3943
### Options
4044

@@ -60,6 +64,35 @@ console.log(config)
6064

6165
A great source of [examples][] can be found in the tests for this API.
6266

67+
## `ipfs.config.getAll([options])`
68+
69+
> Returns the full config been used. If the daemon is off, it returns the stored config.
70+
71+
### Options
72+
73+
An optional object which may have the following keys:
74+
75+
| Name | Type | Default | Description |
76+
| ---- | ---- | ------- | ----------- |
77+
| timeout | `Number` | `undefined` | A timeout in ms |
78+
| signal | [AbortSignal][] | `undefined` | Can be used to cancel any long running requests started as a result of this call |
79+
80+
### Returns
81+
82+
| Type | Description |
83+
| -------- | -------- |
84+
| `Promise<Object>` | An object containing the configuration of the IPFS node |
85+
86+
### Example
87+
88+
```JavaScript
89+
const config = await ipfs.config.getAll()
90+
console.log(config)
91+
```
92+
93+
A great source of [examples][] can be found in the tests for this API.
94+
95+
6396
## `ipfs.config.set(key, value, [options])`
6497

6598
> Adds or replaces a config value.

docs/core-api/DHT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ A great source of [examples][] can be found in the tests for this API.
126126

127127
| Name | Type | Description |
128128
| ---- | ---- | ----------- |
129-
| key | Buffer | The key associated with the value to find |
129+
| key | `Buffer` or `string` | The key associated with the value to find |
130130

131131
### Options
132132

docs/core-api/FILES.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,6 @@ An optional object which may have the following keys:
916916

917917
| Name | Type | Default | Description |
918918
| ---- | ---- | ------- | ----------- |
919-
| sort | `boolean` | `false` | If true entries will be sorted by filename |
920919
| timeout | `Number` | `undefined` | A timeout in ms |
921920
| signal | [AbortSignal][] | `undefined` | Can be used to cancel any long running requests started as a result of this call |
922921

docs/core-api/KEY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,4 +289,4 @@ A great source of [examples][] can be found in the tests for this API.
289289

290290
[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/key
291291
[cid]: https://www.npmjs.com/package/cids
292-
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
292+
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

examples/browser-add-readable-stream/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"keywords": [],
1313
"license": "MIT",
1414
"devDependencies": {
15-
"ipfs": "^0.45.0",
15+
"ipfs": "^0.46.0",
1616
"test-ipfs-example": "^2.0.3"
1717
}
1818
}

examples/browser-browserify/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"concat-stream": "^2.0.0",
1919
"execa": "^4.0.0",
2020
"http-server": "^0.11.1",
21-
"ipfs": "^0.45.0",
21+
"ipfs": "^0.46.0",
2222
"test-ipfs-example": "^2.0.3"
2323
},
2424
"browser": {

examples/browser-create-react-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"dependencies": {
66
"dot-prop": "^5.0.0",
7-
"ipfs": "^0.45.0",
7+
"ipfs": "^0.46.0",
88
"ipfs-css": "^0.13.1",
99
"react": "^16.8.6",
1010
"react-dom": "^16.8.6",

examples/browser-mfs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"webpack-cli": "^3.3.11"
2222
},
2323
"dependencies": {
24-
"ipfs": "^0.45.0",
24+
"ipfs": "^0.46.0",
2525
"mime-sniffer": "~0.0.3"
2626
}
2727
}

examples/browser-parceljs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"author": "",
1919
"license": "ISC",
2020
"dependencies": {
21-
"ipfs": "^0.45.0"
21+
"ipfs": "^0.46.0"
2222
},
2323
"devDependencies": {
2424
"@babel/cli": "^7.1.5",

examples/browser-readablestream/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"webpack": "^4.28.4"
2121
},
2222
"dependencies": {
23-
"ipfs": "^0.45.0",
23+
"ipfs": "^0.46.0",
2424
"it-to-stream": "^0.1.1",
2525
"videostream": "^3.2.0"
2626
}

examples/browser-script-tag/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
"test-ipfs-example": "^2.0.3"
1717
},
1818
"dependencies": {
19-
"ipfs": "^0.45.0"
19+
"ipfs": "^0.46.0"
2020
}
2121
}

examples/browser-video-streaming/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
"test-ipfs-example": "^2.0.3"
1717
},
1818
"dependencies": {
19-
"ipfs": "^0.45.0"
19+
"ipfs": "^0.46.0"
2020
}
2121
}

examples/browser-vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"dependencies": {
1313
"core-js": "^3.6.4",
14-
"ipfs": "^0.45.0",
14+
"ipfs": "^0.46.0",
1515
"vue": "^2.6.11"
1616
},
1717
"devDependencies": {

examples/browser-webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"webpack-dev-server": "^3.1.14"
2727
},
2828
"dependencies": {
29-
"ipfs": "^0.45.0"
29+
"ipfs": "^0.46.0"
3030
},
3131
"browserslist": [
3232
">1%",

examples/circuit-relaying/README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@ A circuit relay address is a [multiaddress](https://multiformats.io/multiaddr/)
6464

6565
Circuit relay addresses are very flexible and can describe many different aspects of how to esablish the relayed connection. In its simplest form, it looks something like this:
6666

67-
- `/p2p-circuit/ipfs/QmPeer`
67+
- `/p2p-circuit/p2p/QmPeer`
6868

6969
If we want to be specific as to which transport we want to use to establish the relay, we can encode that in the address as well:
7070

71-
- `/ip4/127.0.0.1/tcp/65000/ipfs/QmRelay/p2p-circuit/ipfs/QmPeer`
71+
- `/ip4/127.0.0.1/tcp/65000/p2p/QmRelay/p2p-circuit/ipfs/QmPeer`
7272

7373
This tells us that we want to use `QmRelay` located at address 127.0.0.1 and port 65000.
7474

75-
- `/ip4/127.0.0.1/tcp/65000/ipfs/QmRelay/p2p-circuit/ip4/127.0.0.1/tcp/8080/ws/ipfs/QmPeer`
75+
- `/ip4/127.0.0.1/tcp/65000/p2p/QmRelay/p2p-circuit/ip4/127.0.0.1/tcp/8080/ws/ipfs/QmPeer`
7676

7777
We can take it a step further and encode the same information for the destination peer. In this case, we have it located at 127.0.0.1 on port 8080 and using a Web sockets transport!
7878

79-
- `/ip4/127.0.0.1/tcp/65000/ipfs/QmRelay/p2p-circuit`
79+
- `/ip4/127.0.0.1/tcp/65000/p2p/QmRelay/p2p-circuit`
8080

81-
If a node is configured with this address, it will use the specified host (`/ip4/127.0.0.1/tcp/65000/ipfs/QmRelay`) as a relay and it will be reachable over this relay.
81+
If a node is configured with this address, it will use the specified host (`/ip4/127.0.0.1/tcp/65000/p2p/QmRelay`) as a relay and it will be reachable over this relay.
8282
- There could multiple addresses of this sort specified in the config, in which case the node will be reachable over all of them.
8383
- This is useful if, for example, the node is behind a firewall but wants to be reachable from the outside over a specific relay.
8484

@@ -227,36 +227,36 @@ $ ipfs id
227227
"ID": "QmY73BLYav2gYc9PCEnjQqbfSGiqFv3aMsRXNyKFGtUoGF",
228228
"PublicKey": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC84qPFzqajCfnvaJunqt48S1LIBRthXV60q5QClL+dUfOOU/m7v1ZcpNhvFFUN6tVCDaoT5AxEv0czxZiVx/njl6FVIc6tE1J+HWpc8cbAXNY6QbbyzKl/rjp7V8/QClE0JqgjIk84wnWGTwFhOEt0hnpu2XFt9iHaenSfg3EAa8K9MlbxmbawuxNLJJf7VZXkJrUNl6WOglAVU8Sqc4QaahCLVK5Dzo98zDBq1KDBxMbUgH0LTqzr6i+saxkEHZmBKO+mMVT3LzOUx1DQR4pLAw1qgoJstsIZEaJ2XLh975IiI7OKqWYH7+3NyNK2sldJK/4Zko4rH3irmnkAxLcFAgMBAAE=",
229229
"Addresses": [
230-
"/ip4/127.0.0.1/tcp/4001/ipfs/QmY73BLYav2gYc9PCEnjQqbfSGiqFv3aMsRXNyKFGtUoGF",
231-
"/ip4/192.168.1.132/tcp/4001/ipfs/QmY73BLYav2gYc9PCEnjQqbfSGiqFv3aMsRXNyKFGtUoGF",
232-
"/ip6/::1/tcp/4001/ipfs/QmY73BLYav2gYc9PCEnjQqbfSGiqFv3aMsRXNyKFGtUoGF",
233-
"/ip4/186.4.18.182/tcp/13285/ipfs/QmY73BLYav2gYc9PCEnjQqbfSGiqFv3aMsRXNyKFGtUoGF",
234-
"/ip4/186.4.18.182/tcp/13285/ipfs/QmY73BLYav2gYc9PCEnjQqbfSGiqFv3aMsRXNyKFGtUoGF"
230+
"/ip4/127.0.0.1/tcp/4001/p2p/QmY73BLYav2gYc9PCEnjQqbfSGiqFv3aMsRXNyKFGtUoGF",
231+
"/ip4/192.168.1.132/tcp/4001/p2p/QmY73BLYav2gYc9PCEnjQqbfSGiqFv3aMsRXNyKFGtUoGF",
232+
"/ip6/::1/tcp/4001/p2p/QmY73BLYav2gYc9PCEnjQqbfSGiqFv3aMsRXNyKFGtUoGF",
233+
"/ip4/186.4.18.182/tcp/13285/p2p/QmY73BLYav2gYc9PCEnjQqbfSGiqFv3aMsRXNyKFGtUoGF",
234+
"/ip4/186.4.18.182/tcp/13285/p2p/QmY73BLYav2gYc9PCEnjQqbfSGiqFv3aMsRXNyKFGtUoGF"
235235
],
236236
"AgentVersion": "go-ipfs/0.4.14-dev/cb5bb7dd8",
237237
"ProtocolVersion": "ipfs/0.1.0"
238238
}
239239
```
240240

241-
We can then grab the resolved multiaddr from the `Addresses` array — `/ip4/127.0.0.1/tcp/4004/ws/ipfs/Qm...`. Let's note it down somewhere and move to the next step.
241+
We can then grab the resolved multiaddr from the `Addresses` array — `/ip4/127.0.0.1/tcp/4004/ws/p2p/Qm...`. Let's note it down somewhere and move to the next step.
242242

243243
**js ipfs**
244244

245245
```console
246246
$ jsipfs daemon
247247
Initializing daemon...
248-
Swarm listening on /p2p-circuit/ipfs/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
249-
Swarm listening on /p2p-circuit/ip4/0.0.0.0/tcp/4002/ipfs/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
250-
Swarm listening on /p2p-circuit/ip4/127.0.0.1/tcp/4003/ws/ipfs/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
251-
Swarm listening on /ip4/127.0.0.1/tcp/4003/ws/ipfs/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
252-
Swarm listening on /ip4/127.0.0.1/tcp/4002/ipfs/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
253-
Swarm listening on /ip4/192.168.1.132/tcp/4002/ipfs/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
248+
Swarm listening on /p2p-circuit/p2p/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
249+
Swarm listening on /p2p-circuit/ip4/0.0.0.0/tcp/4002/p2p/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
250+
Swarm listening on /p2p-circuit/ip4/127.0.0.1/tcp/4003/ws/p2p/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
251+
Swarm listening on /ip4/127.0.0.1/tcp/4003/ws/p2p/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
252+
Swarm listening on /ip4/127.0.0.1/tcp/4002/p2p/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
253+
Swarm listening on /ip4/192.168.1.132/tcp/4002/p2p/QmfQj8YwDdy1uP2DpZBa7k38rSGPvhHiC52cdAGWBqoVpq
254254
API is listening on: /ip4/127.0.0.1/tcp/5002
255255
Gateway (readonly) is listening on: /ip4/127.0.0.1/tcp/9090
256256
Daemon is ready
257257
```
258258

259-
Look out for an address similar to `/ip4/127.0.0.1/tcp/4003/ws/ipfs/Qm...`. Note it down somewhere, and let's move on to the next step.
259+
Look out for an address similar to `/ip4/127.0.0.1/tcp/4003/ws/p2p/Qm...`. Note it down somewhere, and let's move on to the next step.
260260

261261
### 2. Configure and run the bundled example
262262

@@ -333,7 +333,7 @@ const ipfs = await IPFS.create({
333333

334334
- We connected the browser nodes to an external node over its websocket transport using the `/ip4/127.0.0.1/tcp/4003/ws/ipfs/...` multiaddr. That external node happens to be a `HOP` node, meaning that it can relay connections for our browsers (and other nodes) allowing them to connect
335335

336-
- And finally we connected the two browser nodes using the `/p2p-circuit/ipfs/...` multiaddr. Take a look at the code below in [src/app.js](src/app.js#L103...L108) - lines 103-108
336+
- And finally we connected the two browser nodes using the `/p2p-circuit/p2p/...` multiaddr. Take a look at the code below in [src/app.js](src/app.js#L103...L108) - lines 103-108
337337

338338
```js
339339
try {

examples/circuit-relaying/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h1>IPFS Simple Messaging</h1>
3434
<ul id="peers"></ul>
3535
</div>
3636
<div class="box peers-box">
37-
<label>Peers Connected:</label>
37+
<label>Swarm Peers:</label>
3838
<ul id="peers-addrs"></ul>
3939
</div>
4040
<div>

examples/circuit-relaying/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
"author": "Dmitriy Ryajov <[email protected]>",
1515
"license": "MIT",
1616
"dependencies": {
17-
"ipfs": "^0.45.0",
17+
"delay": "^4.3.0",
18+
"ipfs": "^0.46.0",
1819
"ipfs-pubsub-room": "^2.0.1"
1920
},
2021
"devDependencies": {
2122
"execa": "^4.0.0",
2223
"ipfs-css": "^0.13.1",
23-
"ipfs-http-client": "^44.1.1",
24+
"ipfs-http-client": "^44.2.0",
2425
"parcel-bundler": "^1.12.4",
2526
"tachyons": "^4.9.1",
2627
"test-ipfs-example": "^2.0.3"

examples/circuit-relaying/src/app.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ document.addEventListener('DOMContentLoaded', async () => {
4747
const sendMsg = helpers.sendMsg
4848
const updatePeers = helpers.updatePeers
4949
const updateAddrs = helpers.updateAddrs
50+
const updateSwarmPeers = helpers.updateSwarmPeers
5051

5152
const info = await ipfs.id()
5253
console.log('IPFS node ready with id ' + info.id)
5354

5455
let room = createRoom(roomName)
5556

5657
$peerId.innerHTML = `<li>${info.id}</li>`
57-
updateAddrs(info.addresses)
5858

5959
$send.addEventListener('click', () => {
6060
sendMsg(room)
@@ -95,13 +95,14 @@ document.addEventListener('DOMContentLoaded', async () => {
9595
})
9696

9797
$connect.addEventListener('click', async () => {
98-
const peer = $peer.value
98+
const peer = $peer.value.trim()
9999
$peer.value = ''
100100
try {
101101
await ipfs.swarm.connect(peer)
102+
await updateAddrs(ipfs)
103+
await updateSwarmPeers(ipfs)
102104
} catch (err) {
103105
return console.error(err)
104106
}
105-
$pAddrs.innerHTML += `<li>${peer.trim()}</li>`
106107
})
107108
})

0 commit comments

Comments
 (0)