tturn 0.1.2 → 0.1.4
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/README.md +10 -4
- package/README.zh-CN.md +7 -3
- package/dist/app.js +5 -4
- package/dist/cli.js +6 -1
- package/index.node +0 -0
- package/package.json +5 -3
- package/tturn.win32-x64-msvc.node +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tturn
|
|
2
2
|
|
|
3
|
-
[English (default)](./README.md) | [中文](./README.zh-CN.md)
|
|
3
|
+
[English (default)](./README.md) | [中文](./README.zh-CN.md) | [Changelog](./CHANGELOG.md)
|
|
4
4
|
|
|
5
5
|
`tturn` is a high-performance TURN server package for Node.js.
|
|
6
6
|
It embeds a native Rust core via N-API, so you can install from npm and run directly.
|
|
@@ -93,10 +93,12 @@ Optional env:
|
|
|
93
93
|
|
|
94
94
|
- `TURN_PUBLIC_IP`
|
|
95
95
|
- `TURN_PORT`
|
|
96
|
+
- `TURN_MIN_PORT` (must be provided together with `TURN_MAX_PORT`)
|
|
97
|
+
- `TURN_MAX_PORT` (must be provided together with `TURN_MIN_PORT`)
|
|
96
98
|
- `TTURN_TTL_SEC`
|
|
97
99
|
- `TTURN_USER_ID`
|
|
98
100
|
- `TTURN_USERNAME` (or `TURN_USERNAME`)
|
|
99
|
-
- `TTURN_DISABLE_CREDENTIAL_EXPIRY` (`1`
|
|
101
|
+
- `TTURN_DISABLE_CREDENTIAL_EXPIRY` (`1`/`true` keeps credentials non-expiring; set `0`/`false` to enable expiry)
|
|
100
102
|
|
|
101
103
|
## API options
|
|
102
104
|
|
|
@@ -108,8 +110,12 @@ Optional env:
|
|
|
108
110
|
- `listeningIp` (default `0.0.0.0`): bind address.
|
|
109
111
|
- `username` / `userId` (optional): default credential username seed. `username` has higher priority.
|
|
110
112
|
- `ttlSec` (optional): default credential TTL used by `start()` and `issueCredential()`.
|
|
111
|
-
- `disableCredentialExpiry` (optional): disable timestamp expiry check and issue non-expiring credentials.
|
|
112
|
-
- `minPort` / `maxPort`:
|
|
113
|
+
- `disableCredentialExpiry` (optional, default `true`): disable timestamp expiry check and issue non-expiring credentials. Set to `false` to enforce expiry.
|
|
114
|
+
- `minPort` / `maxPort`: relay allocation port range (must be configured as a pair).
|
|
115
|
+
|
|
116
|
+
Transport note:
|
|
117
|
+
|
|
118
|
+
- Current native implementation exposes UDP relay URLs only (`turn:...?...transport=udp`).
|
|
113
119
|
|
|
114
120
|
At least one of `authSecret` or `password` must be provided.
|
|
115
121
|
|
package/README.zh-CN.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tturn(中文)
|
|
2
2
|
|
|
3
|
-
[English(主文档)](./README.md) | [中文](./README.zh-CN.md)
|
|
3
|
+
[English(主文档)](./README.md) | [中文](./README.zh-CN.md) | [更新日志](./CHANGELOG.md)
|
|
4
4
|
|
|
5
5
|
`tturn` 是一个高性能的 Node.js TURN 服务包。
|
|
6
6
|
它使用内嵌原生核心(Rust + N-API),可以直接通过 npm 安装并运行,不依赖 Docker,也不需要额外安装 `turnserver.exe` 作为运行时。
|
|
@@ -91,8 +91,12 @@ TURN_REALM=turn.example.com TURN_USERNAME=alice TURN_PASSWORD=alice-pass TTURN_D
|
|
|
91
91
|
- `listeningIp`(默认 `0.0.0.0`):本地绑定地址。
|
|
92
92
|
- `username` / `userId`(可选):默认凭证用户名种子,`username` 优先级更高。
|
|
93
93
|
- `ttlSec`(可选):`start()` 与 `issueCredential()` 的默认凭证时效。
|
|
94
|
-
- `disableCredentialExpiry
|
|
95
|
-
- `minPort` / `maxPort
|
|
94
|
+
- `disableCredentialExpiry`(可选,默认 `true`):禁用时间戳过期校验,生成不过期凭证。设置为 `false` 时启用过期校验。
|
|
95
|
+
- `minPort` / `maxPort`:中继分配端口范围(必须成对配置)。
|
|
96
|
+
|
|
97
|
+
传输协议说明:
|
|
98
|
+
|
|
99
|
+
- 当前 native 实现只返回 UDP 中继地址(`turn:...?...transport=udp`)。
|
|
96
100
|
|
|
97
101
|
`authSecret` 和 `password` 至少需要提供一个。
|
|
98
102
|
|
package/dist/app.js
CHANGED
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const index_1 = require("./index");
|
|
4
4
|
const APP_CONFIG = {
|
|
5
5
|
realm: "turn.example.com",
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
authSecret: "",
|
|
7
|
+
password: "replace-with-your-password",
|
|
8
|
+
publicIp: "1.2.3.4",
|
|
9
|
+
listenPort: 3478,
|
|
10
|
+
username: "google-test",
|
|
10
11
|
ttlSec: 600,
|
|
11
12
|
disableCredentialExpiry: true
|
|
12
13
|
};
|
package/dist/cli.js
CHANGED
|
@@ -12,6 +12,9 @@ async function run() {
|
|
|
12
12
|
authSecret: authOptions.authSecret,
|
|
13
13
|
password: authOptions.password,
|
|
14
14
|
publicIp: process.env.TURN_PUBLIC_IP,
|
|
15
|
+
listenPort: process.env.TURN_PORT ? Number(process.env.TURN_PORT) : 3478,
|
|
16
|
+
minPort: process.env.TURN_MIN_PORT ? Number(process.env.TURN_MIN_PORT) : undefined,
|
|
17
|
+
maxPort: process.env.TURN_MAX_PORT ? Number(process.env.TURN_MAX_PORT) : undefined,
|
|
15
18
|
disableCredentialExpiry: readBoolEnv("TTURN_DISABLE_CREDENTIAL_EXPIRY") ?? Boolean(authOptions.password)
|
|
16
19
|
});
|
|
17
20
|
const ice = service.issueCredential({
|
|
@@ -31,6 +34,8 @@ async function run() {
|
|
|
31
34
|
password: authOptions.password,
|
|
32
35
|
publicIp: process.env.TURN_PUBLIC_IP,
|
|
33
36
|
listenPort: process.env.TURN_PORT ? Number(process.env.TURN_PORT) : 3478,
|
|
37
|
+
minPort: process.env.TURN_MIN_PORT ? Number(process.env.TURN_MIN_PORT) : undefined,
|
|
38
|
+
maxPort: process.env.TURN_MAX_PORT ? Number(process.env.TURN_MAX_PORT) : undefined,
|
|
34
39
|
ttlSec: process.env.TTURN_TTL_SEC ? Number(process.env.TTURN_TTL_SEC) : 3600,
|
|
35
40
|
username: readUsernameEnv(),
|
|
36
41
|
userId: process.env.TTURN_USER_ID,
|
|
@@ -64,7 +69,7 @@ function printUsage() {
|
|
|
64
69
|
" TURN_REALM",
|
|
65
70
|
" TURN_SECRET or TURN_PASSWORD",
|
|
66
71
|
"optional env:",
|
|
67
|
-
" TURN_PUBLIC_IP, TURN_PORT, TTURN_TTL_SEC, TTURN_USER_ID, TTURN_USERNAME (or TURN_USERNAME), TTURN_DISABLE_CREDENTIAL_EXPIRY"
|
|
72
|
+
" TURN_PUBLIC_IP, TURN_PORT, TURN_MIN_PORT, TURN_MAX_PORT, TTURN_TTL_SEC, TTURN_USER_ID, TTURN_USERNAME (or TURN_USERNAME), TTURN_DISABLE_CREDENTIAL_EXPIRY"
|
|
68
73
|
].join("\n") + "\n");
|
|
69
74
|
}
|
|
70
75
|
function readUsernameEnv() {
|
package/index.node
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tturn",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "High-performance TURN server for Node.js with embedded native core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"turn",
|
|
@@ -42,9 +42,11 @@
|
|
|
42
42
|
"build": "npm run build:native && tsc -p tsconfig.json",
|
|
43
43
|
"build:ts": "tsc -p tsconfig.json"
|
|
44
44
|
},
|
|
45
|
-
"dependencies": {},
|
|
46
45
|
"devDependencies": {
|
|
47
|
-
"@types/node": "^22.13
|
|
46
|
+
"@types/node": "^22.19.13",
|
|
48
47
|
"typescript": "^5.8.2"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"superpowers": "^0.0.2"
|
|
49
51
|
}
|
|
50
52
|
}
|
|
Binary file
|