@peerbit/server 5.6.4-ec49bca → 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/nginx-template.conf +0 -18
- package/dist/src/peerbit.d.ts.map +1 -1
- package/dist/src/peerbit.js +17 -6
- package/dist/src/peerbit.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/nginx-template.conf +0 -18
- package/src/peerbit.ts +19 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peerbit/server",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0-58d3d09",
|
|
4
4
|
"author": "dao.xyz",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"lint": "aegir lint"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@peerbit/test-lib": "0.0.1-
|
|
70
|
-
"@peerbit/test-utils": "2.
|
|
69
|
+
"@peerbit/test-lib": "0.0.1-58d3d09",
|
|
70
|
+
"@peerbit/test-utils": "2.2.0-58d3d09",
|
|
71
71
|
"@types/yargs": "17.0.24",
|
|
72
72
|
"aws-sdk": "^2.1259.0",
|
|
73
73
|
"dotenv": "^16.1.4",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"axios": "^1.4.0",
|
|
80
80
|
"chalk": "^5.3.0",
|
|
81
|
-
"peerbit": "4.
|
|
81
|
+
"peerbit": "4.2.0-58d3d09",
|
|
82
82
|
"yargs": "^17.7.2",
|
|
83
83
|
"tar-stream": "^3.1.7",
|
|
84
84
|
"tmp": "^0.2.1",
|
package/src/nginx-template.conf
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
server_names_hash_bucket_size 128;
|
|
2
2
|
|
|
3
|
-
# --- stream (TCP/UDP) layer ---
|
|
4
|
-
stream {
|
|
5
|
-
# libp2p TCP forward: /dns4/%DOMAIN%/tcp/4002 -> 127.0.0.1:8001
|
|
6
|
-
server {
|
|
7
|
-
listen 4002;
|
|
8
|
-
proxy_connect_timeout 10s;
|
|
9
|
-
proxy_timeout 1h;
|
|
10
|
-
proxy_pass 127.0.0.1:8001;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
# webrtc-direct UDP forward: /dns4/%DOMAIN%/udp/4004/webrtc-direct -> 127.0.0.1:8004
|
|
14
|
-
server {
|
|
15
|
-
listen 4003 udp;
|
|
16
|
-
proxy_timeout 1h;
|
|
17
|
-
proxy_pass 127.0.0.1:8003;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
3
|
server {
|
|
22
4
|
server_name %DOMAIN%;
|
|
23
5
|
listen [::]:4003 ssl ipv6only=on;
|
package/src/peerbit.ts
CHANGED
|
@@ -33,16 +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}/
|
|
36
|
+
`/dns4/${properties.domain}/udp/4004/webrtc-direct`,
|
|
37
37
|
]
|
|
38
38
|
: undefined,
|
|
39
|
-
listen:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
+
})(),
|
|
46
57
|
},
|
|
47
58
|
connectionMonitor: {
|
|
48
59
|
abortConnectionOnPingFailure: false,
|