@leofcoin/peernet 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.esdoc.json +10 -10
- package/.eslintrc.json +24 -24
- package/.travis.yml +27 -25
- package/LICENSE +21 -21
- package/README.md +64 -64
- package/deploy.js +8 -8
- package/exports/browser/browser-10ffabe1.js +56 -0
- package/exports/browser/{browser-2f0b2829.js → browser-e1cd4e67.js} +46 -38
- package/exports/browser/{client-95423644.js → client-471408b6.js} +3 -3
- package/exports/browser/dht/dht.d.ts +30 -30
- package/exports/browser/discovery/peer-discovery.d.ts +7 -7
- package/exports/browser/errors/errors.d.ts +3 -3
- package/exports/browser/handlers/data.d.ts +2 -2
- package/exports/browser/handlers/message.d.ts +30 -30
- package/exports/browser/index-601960df.js +58 -0
- package/exports/browser/messages/chat.d.ts +6 -6
- package/exports/browser/messages/data-response.d.ts +6 -6
- package/exports/browser/messages/data.d.ts +10 -10
- package/exports/browser/messages/dht-response.d.ts +6 -6
- package/exports/browser/messages/dht.d.ts +14 -14
- package/exports/browser/messages/file-link.d.ts +10 -10
- package/exports/browser/messages/file.d.ts +10 -10
- package/exports/browser/messages/peer-response.d.ts +6 -6
- package/exports/browser/messages/peer.d.ts +6 -6
- package/exports/browser/messages/peernet.d.ts +6 -6
- package/exports/browser/messages/ps.d.ts +6 -6
- package/exports/browser/messages/request.d.ts +6 -6
- package/exports/browser/messages/response.d.ts +6 -6
- package/exports/browser/{messages-2214fcbb.js → messages-cf68bfb3.js} +153 -153
- package/exports/browser/messages.d.ts +12 -12
- package/exports/browser/peer-info.d.ts +4 -4
- package/exports/browser/{peernet-e74b2091.js → peernet-e1e0a046.js} +13021 -9963
- package/exports/browser/peernet.js +1 -1
- package/exports/browser/prompts/password/browser.d.ts +2 -2
- package/exports/browser/prompts/password/node.d.ts +2 -2
- package/exports/browser/proto/chat-message.proto.d.ts +7 -7
- package/exports/browser/proto/data-response.proto.d.ts +5 -5
- package/exports/browser/proto/data.proto.d.ts +5 -5
- package/exports/browser/proto/dht-response.proto.d.ts +5 -5
- package/exports/browser/proto/dht.proto.d.ts +5 -5
- package/exports/browser/proto/file-link.proto.d.ts +6 -6
- package/exports/browser/proto/file.proto.d.ts +6 -6
- package/exports/browser/proto/peer-response.proto.d.ts +4 -4
- package/exports/browser/proto/peer.proto.d.ts +4 -4
- package/exports/browser/proto/peernet.proto.d.ts +8 -8
- package/exports/browser/proto/ps.proto.d.ts +5 -5
- package/exports/browser/proto/request.proto.d.ts +4 -4
- package/exports/browser/proto/response.proto.d.ts +4 -4
- package/exports/browser/qr-scanner-worker.min-c002e984.js +100 -0
- package/exports/browser/utils/utils.d.ts +7 -7
- package/exports/dht/dht.d.ts +30 -30
- package/exports/discovery/peer-discovery.d.ts +7 -7
- package/exports/errors/errors.d.ts +3 -3
- package/exports/handlers/data.d.ts +2 -2
- package/exports/handlers/message.d.ts +30 -30
- package/exports/messages/chat.d.ts +6 -6
- package/exports/messages/data-response.d.ts +6 -6
- package/exports/messages/data.d.ts +10 -10
- package/exports/messages/dht-response.d.ts +6 -6
- package/exports/messages/dht.d.ts +14 -14
- package/exports/messages/file-link.d.ts +10 -10
- package/exports/messages/file.d.ts +10 -10
- package/exports/messages/peer-response.d.ts +6 -6
- package/exports/messages/peer.d.ts +6 -6
- package/exports/messages/peernet.d.ts +6 -6
- package/exports/messages/ps.d.ts +6 -6
- package/exports/messages/request.d.ts +6 -6
- package/exports/messages/response.d.ts +6 -6
- package/exports/{messages-75fe56a4.js → messages-65501ef9.js} +152 -152
- package/exports/messages.d.ts +12 -12
- package/exports/peer-info.d.ts +4 -4
- package/exports/peernet.js +969 -968
- package/exports/prompts/password/browser.d.ts +2 -2
- package/exports/prompts/password/node.d.ts +2 -2
- package/exports/proto/chat-message.proto.d.ts +7 -7
- package/exports/proto/data-response.proto.d.ts +5 -5
- package/exports/proto/data.proto.d.ts +5 -5
- package/exports/proto/dht-response.proto.d.ts +5 -5
- package/exports/proto/dht.proto.d.ts +5 -5
- package/exports/proto/file-link.proto.d.ts +6 -6
- package/exports/proto/file.proto.d.ts +6 -6
- package/exports/proto/peer-response.proto.d.ts +4 -4
- package/exports/proto/peer.proto.d.ts +4 -4
- package/exports/proto/peernet.proto.d.ts +8 -8
- package/exports/proto/ps.proto.d.ts +5 -5
- package/exports/proto/request.proto.d.ts +4 -4
- package/exports/proto/response.proto.d.ts +4 -4
- package/exports/src/prompts/password.js +3 -3
- package/exports/utils/utils.d.ts +7 -7
- package/index.html +19 -19
- package/package.json +59 -55
- package/rollup.config.js +53 -53
- package/src/dht/dht.js +119 -119
- package/src/discovery/peer-discovery.js +75 -75
- package/src/handlers/data.js +12 -12
- package/src/handlers/message.js +34 -34
- package/src/identity.ts +81 -80
- package/src/messages/chat.js +14 -14
- package/src/messages/data-response.js +14 -14
- package/src/messages/data.js +18 -18
- package/src/messages/dht-response.js +14 -14
- package/src/messages/dht.js +22 -22
- package/src/messages/file-link.js +18 -18
- package/src/messages/file.js +18 -18
- package/src/messages/peer-response.js +14 -14
- package/src/messages/peer.js +13 -13
- package/src/messages/peernet.js +14 -14
- package/src/messages/ps.js +13 -13
- package/src/messages/request.js +14 -14
- package/src/messages/response.js +14 -14
- package/src/messages.js +13 -13
- package/src/peer-info.js +9 -9
- package/src/peernet.ts +699 -699
- package/src/prompts/password/node.js +5 -5
- package/src/proto/chat-message.proto.js +6 -6
- package/src/utils/utils.js +78 -78
- package/test/client.js +6 -6
- package/test/codec.js +56 -56
- package/test/hash.js +13 -13
- package/test/index.js +3 -3
- package/test/lastBlock.js +7 -7
- package/test/messages.js +26 -26
- package/test/peernet.js +17 -17
- package/test.js +47 -47
- package/test2.js +9 -9
- package/test3.js +15 -15
- package/test4.js +7 -7
- package/tsconfig.json +12 -12
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/codec-format-interface.js.html +0 -637
- package/coverage/lcov-report/dht-response.js.html +0 -193
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -131
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -199
- package/exports/browser/browser-3c1d0477.js +0 -73
- package/exports/browser/index-3699fac4.js +0 -34
package/.esdoc.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
{
|
|
2
|
-
"source": "./src",
|
|
3
|
-
"destination": "./docs",
|
|
4
|
-
"plugins": [{
|
|
5
|
-
"name": "esdoc-standard-plugin"
|
|
6
|
-
}, {
|
|
7
|
-
"name": "esdoc-ecmascript-proposal-plugin",
|
|
8
|
-
"option": {"all": true}
|
|
9
|
-
}]
|
|
10
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"source": "./src",
|
|
3
|
+
"destination": "./docs",
|
|
4
|
+
"plugins": [{
|
|
5
|
+
"name": "esdoc-standard-plugin"
|
|
6
|
+
}, {
|
|
7
|
+
"name": "esdoc-ecmascript-proposal-plugin",
|
|
8
|
+
"option": {"all": true}
|
|
9
|
+
}]
|
|
10
|
+
}
|
package/.eslintrc.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"es2022": true
|
|
4
|
-
},
|
|
5
|
-
"parserOptions": {
|
|
6
|
-
"ecmaVersion": "latest",
|
|
7
|
-
"sourceType": "module"
|
|
8
|
-
},
|
|
9
|
-
"extends": "plugin:unicorn/recommended",
|
|
10
|
-
|
|
11
|
-
"globals": {
|
|
12
|
-
"globalThis": true,
|
|
13
|
-
"accountStore": true,
|
|
14
|
-
"walletStore": true,
|
|
15
|
-
"blockStore": true,
|
|
16
|
-
"pubsub": true,
|
|
17
|
-
"peerMap": true,
|
|
18
|
-
"connections": true,
|
|
19
|
-
"recentConnections": true,
|
|
20
|
-
"chainStore": true,
|
|
21
|
-
"dataStore": true,
|
|
22
|
-
"transactionStore": true
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"es2022": true
|
|
4
|
+
},
|
|
5
|
+
"parserOptions": {
|
|
6
|
+
"ecmaVersion": "latest",
|
|
7
|
+
"sourceType": "module"
|
|
8
|
+
},
|
|
9
|
+
"extends": "plugin:unicorn/recommended",
|
|
10
|
+
|
|
11
|
+
"globals": {
|
|
12
|
+
"globalThis": true,
|
|
13
|
+
"accountStore": true,
|
|
14
|
+
"walletStore": true,
|
|
15
|
+
"blockStore": true,
|
|
16
|
+
"pubsub": true,
|
|
17
|
+
"peerMap": true,
|
|
18
|
+
"connections": true,
|
|
19
|
+
"recentConnections": true,
|
|
20
|
+
"chainStore": true,
|
|
21
|
+
"dataStore": true,
|
|
22
|
+
"transactionStore": true
|
|
23
|
+
}
|
|
24
|
+
}
|
package/.travis.yml
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
os:
|
|
2
|
-
- linux
|
|
3
|
-
- windows
|
|
4
|
-
- osx
|
|
5
|
-
|
|
6
|
-
language: node_js
|
|
7
|
-
node_js:
|
|
8
|
-
- 14
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- npm run
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
os:
|
|
2
|
+
- linux
|
|
3
|
+
- windows
|
|
4
|
+
- osx
|
|
5
|
+
|
|
6
|
+
language: node_js
|
|
7
|
+
node_js:
|
|
8
|
+
- 14
|
|
9
|
+
- 16
|
|
10
|
+
- 19
|
|
11
|
+
|
|
12
|
+
script:
|
|
13
|
+
- npm run c
|
|
14
|
+
- npm run doc
|
|
15
|
+
- npm run test
|
|
16
|
+
|
|
17
|
+
after_success:
|
|
18
|
+
- npm run coverage
|
|
19
|
+
- npm run coveralls
|
|
20
|
+
- node deploy.js success $WEBHOOK_URL
|
|
21
|
+
|
|
22
|
+
after_failure:
|
|
23
|
+
- node deploy.js failure $WEBHOOK_URL
|
|
24
|
+
|
|
25
|
+
branches:
|
|
26
|
+
only:
|
|
27
|
+
- master
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 vandeurenglenn
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 vandeurenglenn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
# peernet
|
|
2
|
-
|
|
3
|
-
## Usage
|
|
4
|
-
```js
|
|
5
|
-
import Peernet from '@leofcoin/peernet'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const config = {
|
|
9
|
-
network: 'leofcoin:peach',
|
|
10
|
-
networkVersion: 'peach',
|
|
11
|
-
stars: ['wss://peach.leofcoin.org']
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
await new Peernet(config)
|
|
15
|
-
|
|
16
|
-
console.log(globalThis.peernet)
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## API
|
|
22
|
-
#### addRequestHandler
|
|
23
|
-
|
|
24
|
-
examples
|
|
25
|
-
```js
|
|
26
|
-
peernet.addRequestHandler('lastBlock', () => {
|
|
27
|
-
let response;
|
|
28
|
-
const height = await chainStore.get('localIndex')
|
|
29
|
-
const hash = await chainStore.get('localBlock')
|
|
30
|
-
response = JSON.stringify({ height: height.toString(), hash: hash.toString() })
|
|
31
|
-
return new ResponseMessage({ response })
|
|
32
|
-
// or
|
|
33
|
-
return new peernet.protos['peernet-response']({ response })
|
|
34
|
-
})
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
peernet.addRequestHandler('hello', () => {
|
|
39
|
-
return new ResponseMessage({ response: 'hi' })
|
|
40
|
-
// or
|
|
41
|
-
return new peernet.protos['peernet-response']({ response: 'hi' })
|
|
42
|
-
})
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Development
|
|
46
|
-
|
|
47
|
-
`note: you need to install jsproject`
|
|
48
|
-
```sh
|
|
49
|
-
npm i -g @vandeurenglenn/project
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### watch
|
|
53
|
-
```sh
|
|
54
|
-
npm run w
|
|
55
|
-
```
|
|
56
|
-
### compile
|
|
57
|
-
```sh
|
|
58
|
-
npm run c
|
|
59
|
-
```
|
|
60
|
-
### serve html
|
|
61
|
-
```sh
|
|
62
|
-
npm run demo
|
|
63
|
-
```
|
|
64
|
-
|
|
1
|
+
# peernet
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
```js
|
|
5
|
+
import Peernet from '@leofcoin/peernet'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const config = {
|
|
9
|
+
network: 'leofcoin:peach',
|
|
10
|
+
networkVersion: 'peach',
|
|
11
|
+
stars: ['wss://peach.leofcoin.org']
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
await new Peernet(config)
|
|
15
|
+
|
|
16
|
+
console.log(globalThis.peernet)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## API
|
|
22
|
+
#### addRequestHandler
|
|
23
|
+
|
|
24
|
+
examples
|
|
25
|
+
```js
|
|
26
|
+
peernet.addRequestHandler('lastBlock', () => {
|
|
27
|
+
let response;
|
|
28
|
+
const height = await chainStore.get('localIndex')
|
|
29
|
+
const hash = await chainStore.get('localBlock')
|
|
30
|
+
response = JSON.stringify({ height: height.toString(), hash: hash.toString() })
|
|
31
|
+
return new ResponseMessage({ response })
|
|
32
|
+
// or
|
|
33
|
+
return new peernet.protos['peernet-response']({ response })
|
|
34
|
+
})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
peernet.addRequestHandler('hello', () => {
|
|
39
|
+
return new ResponseMessage({ response: 'hi' })
|
|
40
|
+
// or
|
|
41
|
+
return new peernet.protos['peernet-response']({ response: 'hi' })
|
|
42
|
+
})
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Development
|
|
46
|
+
|
|
47
|
+
`note: you need to install jsproject`
|
|
48
|
+
```sh
|
|
49
|
+
npm i -g @vandeurenglenn/project
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### watch
|
|
53
|
+
```sh
|
|
54
|
+
npm run w
|
|
55
|
+
```
|
|
56
|
+
### compile
|
|
57
|
+
```sh
|
|
58
|
+
npm run c
|
|
59
|
+
```
|
|
60
|
+
### serve html
|
|
61
|
+
```sh
|
|
62
|
+
npm run demo
|
|
63
|
+
```
|
|
64
|
+
|
package/deploy.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const {execSync} = require('child_process');
|
|
2
|
-
const status = process.argv[2]
|
|
3
|
-
|
|
4
|
-
if (process.version.split('.')[0] === '
|
|
5
|
-
execSync('wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh')
|
|
6
|
-
execSync('chmod +x send.sh')
|
|
7
|
-
execSync(`./send.sh ${status} ` + process.argv[3])
|
|
8
|
-
}
|
|
1
|
+
const {execSync} = require('child_process');
|
|
2
|
+
const status = process.argv[2]
|
|
3
|
+
|
|
4
|
+
if (process.version.split('.')[0] === 'v19' && process.platform === 'linux') {
|
|
5
|
+
execSync('wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh')
|
|
6
|
+
execSync('chmod +x send.sh')
|
|
7
|
+
execSync(`./send.sh ${status} ` + process.argv[3])
|
|
8
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
function _mergeNamespaces(n, m) {
|
|
2
|
+
m.forEach(function (e) {
|
|
3
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
4
|
+
if (k !== 'default' && !(k in n)) {
|
|
5
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
6
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () { return e[k]; }
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
return Object.freeze(n);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var browser$1 = {};
|
|
17
|
+
|
|
18
|
+
var MediaStream = browser$1.MediaStream = window.MediaStream;
|
|
19
|
+
var MediaStreamTrack = browser$1.MediaStreamTrack = window.MediaStreamTrack;
|
|
20
|
+
var RTCDataChannel = browser$1.RTCDataChannel = window.RTCDataChannel;
|
|
21
|
+
var RTCDataChannelEvent = browser$1.RTCDataChannelEvent = window.RTCDataChannelEvent;
|
|
22
|
+
var RTCDtlsTransport = browser$1.RTCDtlsTransport = window.RTCDtlsTransport;
|
|
23
|
+
var RTCIceCandidate = browser$1.RTCIceCandidate = window.RTCIceCandidate;
|
|
24
|
+
var RTCIceTransport = browser$1.RTCIceTransport = window.RTCIceTransport;
|
|
25
|
+
var RTCPeerConnection = browser$1.RTCPeerConnection = window.RTCPeerConnection;
|
|
26
|
+
var RTCPeerConnectionIceEvent = browser$1.RTCPeerConnectionIceEvent = window.RTCPeerConnectionIceEvent;
|
|
27
|
+
var RTCRtpReceiver = browser$1.RTCRtpReceiver = window.RTCRtpReceiver;
|
|
28
|
+
var RTCRtpSender = browser$1.RTCRtpSender = window.RTCRtpSender;
|
|
29
|
+
var RTCRtpTransceiver = browser$1.RTCRtpTransceiver = window.RTCRtpTransceiver;
|
|
30
|
+
var RTCSctpTransport = browser$1.RTCSctpTransport = window.RTCSctpTransport;
|
|
31
|
+
var RTCSessionDescription = browser$1.RTCSessionDescription = window.RTCSessionDescription;
|
|
32
|
+
var getUserMedia = browser$1.getUserMedia = window.getUserMedia;
|
|
33
|
+
var mediaDevices = browser$1.mediaDevices = navigator.mediaDevices;
|
|
34
|
+
|
|
35
|
+
var browser = /*#__PURE__*/_mergeNamespaces({
|
|
36
|
+
__proto__: null,
|
|
37
|
+
MediaStream: MediaStream,
|
|
38
|
+
MediaStreamTrack: MediaStreamTrack,
|
|
39
|
+
RTCDataChannel: RTCDataChannel,
|
|
40
|
+
RTCDataChannelEvent: RTCDataChannelEvent,
|
|
41
|
+
RTCDtlsTransport: RTCDtlsTransport,
|
|
42
|
+
RTCIceCandidate: RTCIceCandidate,
|
|
43
|
+
RTCIceTransport: RTCIceTransport,
|
|
44
|
+
RTCPeerConnection: RTCPeerConnection,
|
|
45
|
+
RTCPeerConnectionIceEvent: RTCPeerConnectionIceEvent,
|
|
46
|
+
RTCRtpReceiver: RTCRtpReceiver,
|
|
47
|
+
RTCRtpSender: RTCRtpSender,
|
|
48
|
+
RTCRtpTransceiver: RTCRtpTransceiver,
|
|
49
|
+
RTCSctpTransport: RTCSctpTransport,
|
|
50
|
+
RTCSessionDescription: RTCSessionDescription,
|
|
51
|
+
default: browser$1,
|
|
52
|
+
getUserMedia: getUserMedia,
|
|
53
|
+
mediaDevices: mediaDevices
|
|
54
|
+
}, [browser$1]);
|
|
55
|
+
|
|
56
|
+
export { browser as b };
|
|
@@ -13,41 +13,49 @@ function _mergeNamespaces(n, m) {
|
|
|
13
13
|
return Object.freeze(n);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
16
|
+
var global;
|
|
17
|
+
var hasRequiredGlobal;
|
|
18
|
+
|
|
19
|
+
function requireGlobal () {
|
|
20
|
+
if (hasRequiredGlobal) return global;
|
|
21
|
+
hasRequiredGlobal = 1;
|
|
22
|
+
var naiveFallback = function () {
|
|
23
|
+
if (typeof self === "object" && self) return self;
|
|
24
|
+
if (typeof window === "object" && window) return window;
|
|
25
|
+
throw new Error("Unable to resolve global `this`");
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
global = (function () {
|
|
29
|
+
if (this) return this;
|
|
30
|
+
|
|
31
|
+
// Unexpected strict mode (may happen if e.g. bundled into ESM module)
|
|
32
|
+
|
|
33
|
+
// Fallback to standard globalThis if available
|
|
34
|
+
if (typeof globalThis === "object" && globalThis) return globalThis;
|
|
35
|
+
|
|
36
|
+
// Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
|
|
37
|
+
// In all ES5+ engines global object inherits from Object.prototype
|
|
38
|
+
// (if you approached one that doesn't please report)
|
|
39
|
+
try {
|
|
40
|
+
Object.defineProperty(Object.prototype, "__global__", {
|
|
41
|
+
get: function () { return this; },
|
|
42
|
+
configurable: true
|
|
43
|
+
});
|
|
44
|
+
} catch (error) {
|
|
45
|
+
// Unfortunate case of updates to Object.prototype being restricted
|
|
46
|
+
// via preventExtensions, seal or freeze
|
|
47
|
+
return naiveFallback();
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
// Safari case (window.__global__ works, but __global__ does not)
|
|
51
|
+
if (!__global__) return naiveFallback();
|
|
52
|
+
return __global__;
|
|
53
|
+
} finally {
|
|
54
|
+
delete Object.prototype.__global__;
|
|
55
|
+
}
|
|
56
|
+
})();
|
|
57
|
+
return global;
|
|
58
|
+
}
|
|
51
59
|
|
|
52
60
|
var name = "websocket";
|
|
53
61
|
var description = "Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.";
|
|
@@ -132,7 +140,7 @@ if (typeof globalThis === 'object') {
|
|
|
132
140
|
_globalThis = globalThis;
|
|
133
141
|
} else {
|
|
134
142
|
try {
|
|
135
|
-
_globalThis =
|
|
143
|
+
_globalThis = requireGlobal();
|
|
136
144
|
} catch (error) {
|
|
137
145
|
} finally {
|
|
138
146
|
if (!_globalThis && typeof window !== 'undefined') { _globalThis = window; }
|
|
@@ -141,7 +149,7 @@ if (typeof globalThis === 'object') {
|
|
|
141
149
|
}
|
|
142
150
|
|
|
143
151
|
var NativeWebSocket = _globalThis.WebSocket || _globalThis.MozWebSocket;
|
|
144
|
-
|
|
152
|
+
var websocket_version = version;
|
|
145
153
|
|
|
146
154
|
|
|
147
155
|
/**
|
|
@@ -179,7 +187,7 @@ if (NativeWebSocket) {
|
|
|
179
187
|
*/
|
|
180
188
|
var browser = {
|
|
181
189
|
'w3cwebsocket' : NativeWebSocket ? W3CWebSocket : null,
|
|
182
|
-
'version' :
|
|
190
|
+
'version' : websocket_version
|
|
183
191
|
};
|
|
184
192
|
|
|
185
193
|
var browser$1 = /*#__PURE__*/_mergeNamespaces({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LittlePubSub } from './peernet-
|
|
1
|
+
import { L as LittlePubSub } from './peernet-e1e0a046.js';
|
|
2
2
|
import './value-157ab062.js';
|
|
3
3
|
|
|
4
4
|
var clientApi = _pubsub => {
|
|
@@ -190,7 +190,7 @@ const socketRequestClient = (url, protocols = 'echo-protocol', options = { retry
|
|
|
190
190
|
const init = async () => {
|
|
191
191
|
let ws;
|
|
192
192
|
if (typeof process === 'object' && !globalThis.WebSocket) {
|
|
193
|
-
ws = (await import('./browser-
|
|
193
|
+
ws = (await import('./browser-e1cd4e67.js').then(function (n) { return n.b; })).default;
|
|
194
194
|
ws = ws.w3cwebsocket;
|
|
195
195
|
} else {
|
|
196
196
|
ws = WebSocket;
|
|
@@ -520,7 +520,7 @@ class Client {
|
|
|
520
520
|
this.starsConfig = stars;
|
|
521
521
|
// reconnectJob()
|
|
522
522
|
if (!globalThis.RTCPeerConnection)
|
|
523
|
-
globalThis.wrtc = (await import('./browser-
|
|
523
|
+
globalThis.wrtc = (await import('./browser-10ffabe1.js').then(function (n) { return n.b; })).default;
|
|
524
524
|
else
|
|
525
525
|
globalThis.wrtc = {
|
|
526
526
|
RTCPeerConnection,
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
export default class DhtEarth {
|
|
2
|
-
providerMap: Map<any, any>;
|
|
3
|
-
/**
|
|
4
|
-
* @param {Object} address
|
|
5
|
-
* @return {Object} {latitude: lat, longitude: lon}
|
|
6
|
-
*/
|
|
7
|
-
getCoordinates(address: any): any;
|
|
8
|
-
/**
|
|
9
|
-
* @param {Object} peer
|
|
10
|
-
* @param {Object} provider
|
|
11
|
-
* @return {Object} {provider, distance}
|
|
12
|
-
*/
|
|
13
|
-
getDistance(peer: any, provider: any): any;
|
|
14
|
-
/**
|
|
15
|
-
* @param {Array} providers
|
|
16
|
-
* @return {Object} closestPeer
|
|
17
|
-
*/
|
|
18
|
-
closestPeer(providers: any[]): any;
|
|
19
|
-
/**
|
|
20
|
-
* @param {String} hash
|
|
21
|
-
* @return {Array} providers
|
|
22
|
-
*/
|
|
23
|
-
providersFor(hash: string): any[];
|
|
24
|
-
/**
|
|
25
|
-
* @param {String} address
|
|
26
|
-
* @param {String} hash
|
|
27
|
-
* @return {Array} providers
|
|
28
|
-
*/
|
|
29
|
-
addProvider(address: string, hash: string): any[];
|
|
30
|
-
}
|
|
1
|
+
export default class DhtEarth {
|
|
2
|
+
providerMap: Map<any, any>;
|
|
3
|
+
/**
|
|
4
|
+
* @param {Object} address
|
|
5
|
+
* @return {Object} {latitude: lat, longitude: lon}
|
|
6
|
+
*/
|
|
7
|
+
getCoordinates(address: any): any;
|
|
8
|
+
/**
|
|
9
|
+
* @param {Object} peer
|
|
10
|
+
* @param {Object} provider
|
|
11
|
+
* @return {Object} {provider, distance}
|
|
12
|
+
*/
|
|
13
|
+
getDistance(peer: any, provider: any): any;
|
|
14
|
+
/**
|
|
15
|
+
* @param {Array} providers
|
|
16
|
+
* @return {Object} closestPeer
|
|
17
|
+
*/
|
|
18
|
+
closestPeer(providers: any[]): any;
|
|
19
|
+
/**
|
|
20
|
+
* @param {String} hash
|
|
21
|
+
* @return {Array} providers
|
|
22
|
+
*/
|
|
23
|
+
providersFor(hash: string): any[];
|
|
24
|
+
/**
|
|
25
|
+
* @param {String} address
|
|
26
|
+
* @param {String} hash
|
|
27
|
+
* @return {Array} providers
|
|
28
|
+
*/
|
|
29
|
+
addProvider(address: string, hash: string): any[];
|
|
30
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export default class PeerDiscovery {
|
|
2
|
-
constructor(id: any);
|
|
3
|
-
id: any;
|
|
4
|
-
_getPeerId(id: any): any;
|
|
5
|
-
discover(peer: any): Promise<any>;
|
|
6
|
-
discoverHandler(message: any, peer: any): Promise<void>;
|
|
7
|
-
}
|
|
1
|
+
export default class PeerDiscovery {
|
|
2
|
+
constructor(id: any);
|
|
3
|
+
id: any;
|
|
4
|
+
_getPeerId(id: any): any;
|
|
5
|
+
discover(peer: any): Promise<any>;
|
|
6
|
+
discoverHandler(message: any, peer: any): Promise<void>;
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export function encapsulatedError(): Error;
|
|
2
|
-
export function dhtError(proto: any): Error;
|
|
3
|
-
export function nothingFoundError(hash: any): Error;
|
|
1
|
+
export function encapsulatedError(): Error;
|
|
2
|
+
export function dhtError(proto: any): Error;
|
|
3
|
+
export function nothingFoundError(hash: any): Error;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default dataHandler;
|
|
2
|
-
declare function dataHandler(message: any): Promise<void>;
|
|
1
|
+
export default dataHandler;
|
|
2
|
+
declare function dataHandler(message: any): Promise<void>;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
export default class MessageHandler {
|
|
2
|
-
constructor(network: any);
|
|
3
|
-
network: any;
|
|
4
|
-
/**
|
|
5
|
-
* hash and sign message
|
|
6
|
-
*
|
|
7
|
-
* @param {object} message
|
|
8
|
-
* @param {Buffer} message.from peer id
|
|
9
|
-
* @param {Buffer} message.to peer id
|
|
10
|
-
* @param {string} message.data Peernet message
|
|
11
|
-
* (PeernetMessage excluded) encoded as a string
|
|
12
|
-
* @return message
|
|
13
|
-
*/
|
|
14
|
-
hashAndSignMessage(message: {
|
|
15
|
-
from: Buffer;
|
|
16
|
-
to: Buffer;
|
|
17
|
-
data: string;
|
|
18
|
-
}): Promise<{
|
|
19
|
-
from: Buffer;
|
|
20
|
-
to: Buffer;
|
|
21
|
-
data: string;
|
|
22
|
-
}>;
|
|
23
|
-
/**
|
|
24
|
-
* @param {String} from - peer id
|
|
25
|
-
* @param {String} to - peer id
|
|
26
|
-
* @param {String|PeernetMessage} data - data encoded message string
|
|
27
|
-
* or the messageNode itself
|
|
28
|
-
*/
|
|
29
|
-
prepareMessage(message: any): Promise<any>;
|
|
30
|
-
}
|
|
1
|
+
export default class MessageHandler {
|
|
2
|
+
constructor(network: any);
|
|
3
|
+
network: any;
|
|
4
|
+
/**
|
|
5
|
+
* hash and sign message
|
|
6
|
+
*
|
|
7
|
+
* @param {object} message
|
|
8
|
+
* @param {Buffer} message.from peer id
|
|
9
|
+
* @param {Buffer} message.to peer id
|
|
10
|
+
* @param {string} message.data Peernet message
|
|
11
|
+
* (PeernetMessage excluded) encoded as a string
|
|
12
|
+
* @return message
|
|
13
|
+
*/
|
|
14
|
+
hashAndSignMessage(message: {
|
|
15
|
+
from: Buffer;
|
|
16
|
+
to: Buffer;
|
|
17
|
+
data: string;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
from: Buffer;
|
|
20
|
+
to: Buffer;
|
|
21
|
+
data: string;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* @param {String} from - peer id
|
|
25
|
+
* @param {String} to - peer id
|
|
26
|
+
* @param {String|PeernetMessage} data - data encoded message string
|
|
27
|
+
* or the messageNode itself
|
|
28
|
+
*/
|
|
29
|
+
prepareMessage(message: any): Promise<any>;
|
|
30
|
+
}
|