@peerbit/server 5.6.4 → 5.7.0-58d3d09
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/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +2 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +1 -0
- package/dist/src/client.js.map +1 -1
- package/dist/src/nginx-template.conf +0 -64
- package/dist/src/peerbit.d.ts.map +1 -1
- package/dist/src/peerbit.js +17 -4
- package/dist/src/peerbit.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/assets/{index-BeFPnrza.js → index-DO8U-NKu.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +89 -89
- package/src/cli.ts +3 -0
- package/src/client.ts +1 -0
- package/src/nginx-template.conf +0 -64
- package/src/peerbit.ts +19 -6
package/dist/ui/index.html
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
Learn how to configure a non-root public URL by running `npm run build`.
|
|
24
24
|
-->
|
|
25
25
|
<title>Peerbit</title>
|
|
26
|
-
<script type="module" crossorigin src="/assets/index-
|
|
26
|
+
<script type="module" crossorigin src="/assets/index-DO8U-NKu.js"></script>
|
|
27
27
|
<link rel="stylesheet" crossorigin href="/assets/index-CIfVvUo9.css">
|
|
28
28
|
</head>
|
|
29
29
|
|
package/package.json
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
2
|
+
"name": "@peerbit/server",
|
|
3
|
+
"version": "5.7.0-58d3d09",
|
|
4
|
+
"author": "dao.xyz",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/dao-xyz/peerbit"
|
|
8
|
+
},
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"bin": {
|
|
13
|
+
"peerbit": "./dist/src/bin.js"
|
|
14
|
+
},
|
|
15
|
+
"module": "dist/src/index.js",
|
|
16
|
+
"types": "dist/src/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
"import": "./dist/src/index.js"
|
|
19
|
+
},
|
|
20
|
+
"browser": {
|
|
21
|
+
"./dist/src/server.js": "./dist/src/server.browser.js",
|
|
22
|
+
"./server.js": "./dist/src/server.browser.js",
|
|
23
|
+
"./dist/src/config.js": "./dist/src/config.browser.js",
|
|
24
|
+
"./config.js": "./dist/src/config.browser.js",
|
|
25
|
+
"./dist/src/remotes.js": "./dist/src/remotes.browser.js",
|
|
26
|
+
"./remotes.js": "./dist/src/remotes.browser.js",
|
|
27
|
+
"./dist/src/docker.js": "./dist/src/docker.browser.js",
|
|
28
|
+
"./docker.js": "./dist/src/docker.browser.js",
|
|
29
|
+
"./dist/src/aws.js": "./dist/src/aws.browser.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"src",
|
|
34
|
+
"src/nginx-template.conf",
|
|
35
|
+
"!src/test",
|
|
36
|
+
"!src/**/__tests__",
|
|
37
|
+
"!lib/**/__tests__",
|
|
38
|
+
"patches",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=18"
|
|
46
|
+
},
|
|
47
|
+
"eslintConfig": {
|
|
48
|
+
"extends": "peerbit",
|
|
49
|
+
"parserOptions": {
|
|
50
|
+
"project": true,
|
|
51
|
+
"sourceType": "module"
|
|
52
|
+
},
|
|
53
|
+
"ignorePatterns": [
|
|
54
|
+
"!.aegir.js",
|
|
55
|
+
"test/ts-use",
|
|
56
|
+
"*.d.ts"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"clean": "shx rm -rf lib/*",
|
|
61
|
+
"build": "yarn clean && yarn build-lib && yarn build-ui",
|
|
62
|
+
"build-lib": "tsc -p tsconfig.json",
|
|
63
|
+
"build-ui": "cd ../frontend && yarn build && cd ../node",
|
|
64
|
+
"postbuild": "cp src/nginx-template.conf dist/src/ && cp -r ../frontend/dist/. dist/ui",
|
|
65
|
+
"test": "aegir test --t node",
|
|
66
|
+
"lint": "aegir lint"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@peerbit/test-lib": "0.0.1-58d3d09",
|
|
70
|
+
"@peerbit/test-utils": "2.2.0-58d3d09",
|
|
71
|
+
"@types/yargs": "17.0.24",
|
|
72
|
+
"aws-sdk": "^2.1259.0",
|
|
73
|
+
"dotenv": "^16.1.4",
|
|
74
|
+
"@types/tmp": "^0.2.3",
|
|
75
|
+
"@types/tar-stream": "^3.1.3",
|
|
76
|
+
"shx": "^0.3.4"
|
|
77
|
+
},
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"axios": "^1.4.0",
|
|
80
|
+
"chalk": "^5.3.0",
|
|
81
|
+
"peerbit": "4.2.0-58d3d09",
|
|
82
|
+
"yargs": "^17.7.2",
|
|
83
|
+
"tar-stream": "^3.1.7",
|
|
84
|
+
"tmp": "^0.2.1",
|
|
85
|
+
"tty-table": "^4.2.1"
|
|
86
|
+
},
|
|
87
|
+
"optionalDependencies": {
|
|
88
|
+
"@aws-sdk/client-ec2": "^3.390.0",
|
|
89
|
+
"@aws-sdk/client-route-53": "^3.391.0"
|
|
90
|
+
}
|
|
91
91
|
}
|
package/src/cli.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { peerIdFromString } from "@libp2p/peer-id";
|
|
|
6
6
|
import { toBase64 } from "@peerbit/crypto";
|
|
7
7
|
import chalk from "chalk";
|
|
8
8
|
import fs from "fs";
|
|
9
|
+
import sodium from "libsodium-wrappers";
|
|
9
10
|
import path from "path";
|
|
10
11
|
import { exit } from "process";
|
|
11
12
|
import readline from "readline";
|
|
@@ -35,6 +36,8 @@ import { LOCAL_API_PORT } from "./routes.js";
|
|
|
35
36
|
import { startServerWithNode } from "./server.js";
|
|
36
37
|
import type { InstallDependency, StartProgram } from "./types.js";
|
|
37
38
|
|
|
39
|
+
await sodium.ready;
|
|
40
|
+
|
|
38
41
|
const colors = [
|
|
39
42
|
"#00FF00",
|
|
40
43
|
"#0000FF",
|
package/src/client.ts
CHANGED
package/src/nginx-template.conf
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
server_names_hash_bucket_size 128;
|
|
2
2
|
|
|
3
|
-
server {
|
|
4
|
-
server_name %DOMAIN%;
|
|
5
|
-
listen [::]:4002 ssl ipv6only=on;
|
|
6
|
-
listen 4002 ssl;
|
|
7
|
-
|
|
8
|
-
# Load the certificate files.
|
|
9
|
-
ssl_certificate /etc/letsencrypt/live/%DOMAIN%/fullchain.pem;
|
|
10
|
-
ssl_certificate_key /etc/letsencrypt/live/%DOMAIN%/privkey.pem;
|
|
11
|
-
ssl_trusted_certificate /etc/letsencrypt/live/%DOMAIN%/chain.pem;
|
|
12
|
-
|
|
13
|
-
# Load the Diffie-Hellman parameter.
|
|
14
|
-
ssl_dhparam /etc/letsencrypt/dhparams/dhparam.pem;
|
|
15
|
-
|
|
16
|
-
location / {
|
|
17
|
-
proxy_pass http://127.0.0.1:8001;
|
|
18
|
-
proxy_http_version 1.1;
|
|
19
|
-
proxy_set_header Upgrade $http_upgrade;
|
|
20
|
-
proxy_set_header Connection "upgrade";
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
3
|
server {
|
|
25
4
|
server_name %DOMAIN%;
|
|
26
5
|
listen [::]:4003 ssl ipv6only=on;
|
|
@@ -42,49 +21,6 @@ server {
|
|
|
42
21
|
}
|
|
43
22
|
}
|
|
44
23
|
|
|
45
|
-
server {
|
|
46
|
-
server_name %DOMAIN%;
|
|
47
|
-
listen [::]:4004 ssl ipv6only=on;
|
|
48
|
-
listen 4004 ssl;
|
|
49
|
-
|
|
50
|
-
# Load the certificate files.
|
|
51
|
-
ssl_certificate /etc/letsencrypt/live/%DOMAIN%/fullchain.pem;
|
|
52
|
-
ssl_certificate_key /etc/letsencrypt/live/%DOMAIN%/privkey.pem;
|
|
53
|
-
ssl_trusted_certificate /etc/letsencrypt/live/%DOMAIN%/chain.pem;
|
|
54
|
-
|
|
55
|
-
# Load the Diffie-Hellman parameter.
|
|
56
|
-
ssl_dhparam /etc/letsencrypt/dhparams/dhparam.pem;
|
|
57
|
-
|
|
58
|
-
location / {
|
|
59
|
-
proxy_pass http://127.0.0.1:8083;
|
|
60
|
-
proxy_http_version 1.1;
|
|
61
|
-
proxy_set_header Upgrade $http_upgrade;
|
|
62
|
-
proxy_set_header Connection "upgrade";
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
server {
|
|
68
|
-
server_name %DOMAIN%;
|
|
69
|
-
listen [::]:4005 ssl ipv6only=on;
|
|
70
|
-
listen 4005 ssl;
|
|
71
|
-
|
|
72
|
-
# Load the certificate files.
|
|
73
|
-
ssl_certificate /etc/letsencrypt/live/%DOMAIN%/fullchain.pem;
|
|
74
|
-
ssl_certificate_key /etc/letsencrypt/live/%DOMAIN%/privkey.pem;
|
|
75
|
-
ssl_trusted_certificate /etc/letsencrypt/live/%DOMAIN%/chain.pem;
|
|
76
|
-
|
|
77
|
-
# Load the Diffie-Hellman parameter.
|
|
78
|
-
ssl_dhparam /etc/letsencrypt/dhparams/dhparam.pem;
|
|
79
|
-
|
|
80
|
-
location / {
|
|
81
|
-
proxy_pass http://127.0.0.1:8084;
|
|
82
|
-
proxy_http_version 1.1;
|
|
83
|
-
proxy_set_header Upgrade $http_upgrade;
|
|
84
|
-
proxy_set_header Connection "upgrade";
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
24
|
server {
|
|
89
25
|
server_name %DOMAIN%;
|
|
90
26
|
listen [::]:443 ssl ipv6only=on;
|
package/src/peerbit.ts
CHANGED
|
@@ -33,14 +33,27 @@ export const create = (properties: {
|
|
|
33
33
|
? [
|
|
34
34
|
`/dns4/${properties.domain}/tcp/4002`,
|
|
35
35
|
`/dns4/${properties.domain}/tcp/4003/wss`,
|
|
36
|
+
`/dns4/${properties.domain}/udp/4004/webrtc-direct`,
|
|
36
37
|
]
|
|
37
38
|
: undefined,
|
|
38
|
-
listen:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
listen: (() => {
|
|
40
|
+
if (properties.domain) {
|
|
41
|
+
// Direct binds on public ports, keep only local WS for nginx TLS->WS proxy
|
|
42
|
+
return [
|
|
43
|
+
`/ip4/0.0.0.0/tcp/4002`,
|
|
44
|
+
`/ip4/127.0.0.1/tcp/${
|
|
45
|
+
listenPort !== 0 ? listenPort + 1 : listenPort
|
|
46
|
+
}/ws`,
|
|
47
|
+
`/ip4/0.0.0.0/udp/4004/webrtc-direct`,
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
// Local-only defaults (no domain)
|
|
51
|
+
return [
|
|
52
|
+
`/ip4/127.0.0.1/tcp/${listenPort}`,
|
|
53
|
+
`/ip4/127.0.0.1/tcp/${listenPort !== 0 ? listenPort + 1 : listenPort}/ws`,
|
|
54
|
+
`/ip4/127.0.0.1/udp/${listenPort !== 0 ? listenPort + 2 : listenPort}/webrtc-direct`,
|
|
55
|
+
];
|
|
56
|
+
})(),
|
|
44
57
|
},
|
|
45
58
|
connectionMonitor: {
|
|
46
59
|
abortConnectionOnPingFailure: false,
|