mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-26 04:03:03 +01:00
Trying my hand at implementing desktop voice, magic packets courtesy of that one reverse engineering discord medium post
This commit is contained in:
parent
0bbeca9237
commit
cf97e182df
@ -85,8 +85,8 @@ export class Member extends BaseClassWithoutId {
|
|||||||
@Column()
|
@Column()
|
||||||
joined_at: Date;
|
joined_at: Date;
|
||||||
|
|
||||||
@Column()
|
@Column({ type: "bigint", nullable: true })
|
||||||
premium_since?: Date;
|
premium_since?: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
deaf: boolean;
|
deaf: boolean;
|
||||||
@ -245,7 +245,7 @@ export class Member extends BaseClassWithoutId {
|
|||||||
nick: undefined,
|
nick: undefined,
|
||||||
roles: [guild_id], // @everyone role
|
roles: [guild_id], // @everyone role
|
||||||
joined_at: new Date(),
|
joined_at: new Date(),
|
||||||
premium_since: new Date(),
|
premium_since: (new Date()).getTime(),
|
||||||
deaf: false,
|
deaf: false,
|
||||||
mute: false,
|
mute: false,
|
||||||
pending: false,
|
pending: false,
|
||||||
|
169
webrtc/package-lock.json
generated
169
webrtc/package-lock.json
generated
@ -9,7 +9,10 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/libsodium-wrappers": "^0.7.9",
|
||||||
"dotenv": "^12.0.4",
|
"dotenv": "^12.0.4",
|
||||||
|
"libsodium": "^0.7.10",
|
||||||
|
"libsodium-wrappers": "^0.7.10",
|
||||||
"mediasoup": "^3.9.5",
|
"mediasoup": "^3.9.5",
|
||||||
"node-turn": "^0.0.6",
|
"node-turn": "^0.0.6",
|
||||||
"sdp-transform": "^2.14.1",
|
"sdp-transform": "^2.14.1",
|
||||||
@ -69,23 +72,15 @@
|
|||||||
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==",
|
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/debug": {
|
|
||||||
"version": "4.1.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz",
|
|
||||||
"integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/ms": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@types/json5": {
|
"node_modules/@types/json5": {
|
||||||
"version": "0.0.29",
|
"version": "0.0.29",
|
||||||
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||||
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4="
|
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4="
|
||||||
},
|
},
|
||||||
"node_modules/@types/ms": {
|
"node_modules/@types/libsodium-wrappers": {
|
||||||
"version": "0.7.31",
|
"version": "0.7.9",
|
||||||
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz",
|
"resolved": "https://registry.npmjs.org/@types/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",
|
||||||
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA=="
|
"integrity": "sha512-LisgKLlYQk19baQwjkBZZXdJL0KbeTpdEnrAfz5hQACbklCY0gVFnsKUyjfNWF1UQsCSjw93Sj5jSbiO8RPfdw=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "15.6.1",
|
"version": "15.6.1",
|
||||||
@ -99,11 +94,6 @@
|
|||||||
"integrity": "sha512-GVO0gnmbyO3Oxm2HdPsYUNcyihZE3GyCY8ysMYHuQGfLhGZq89Nm4lSzULWTzZoyHtg+VO/IdrnxZHPnPSGnAg==",
|
"integrity": "sha512-GVO0gnmbyO3Oxm2HdPsYUNcyihZE3GyCY8ysMYHuQGfLhGZq89Nm4lSzULWTzZoyHtg+VO/IdrnxZHPnPSGnAg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/uuid": {
|
|
||||||
"version": "8.3.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz",
|
|
||||||
"integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw=="
|
|
||||||
},
|
|
||||||
"node_modules/@types/ws": {
|
"node_modules/@types/ws": {
|
||||||
"version": "7.4.4",
|
"version": "7.4.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.4.tgz",
|
||||||
@ -148,14 +138,6 @@
|
|||||||
"sprintf-js": "~1.0.2"
|
"sprintf-js": "~1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/awaitqueue": {
|
|
||||||
"version": "2.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/awaitqueue/-/awaitqueue-2.3.3.tgz",
|
|
||||||
"integrity": "sha512-RbzQg6VtPUtyErm55iuQLTrBJ2uihy5BKBOEkyBwv67xm5Fn2o/j+Bz+a5BmfSoe2oZ5dcz9Z3fExS8pL+LLhw==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/base64-js": {
|
"node_modules/base64-js": {
|
||||||
"version": "1.5.1",
|
"version": "1.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
@ -299,14 +281,6 @@
|
|||||||
"node": ">=8.0.0"
|
"node": ">=8.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/has-flag": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ieee754": {
|
"node_modules/ieee754": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||||
@ -357,6 +331,19 @@
|
|||||||
"graceful-fs": "^4.1.6"
|
"graceful-fs": "^4.1.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/libsodium": {
|
||||||
|
"version": "0.7.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz",
|
||||||
|
"integrity": "sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ=="
|
||||||
|
},
|
||||||
|
"node_modules/libsodium-wrappers": {
|
||||||
|
"version": "0.7.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.10.tgz",
|
||||||
|
"integrity": "sha512-pO3F1Q9NPLB/MWIhehim42b/Fwb30JNScCNh8TcQ/kIc+qGLQch8ag8wb0keK3EP5kbGakk1H8Wwo7v+36rNQg==",
|
||||||
|
"dependencies": {
|
||||||
|
"libsodium": "^0.7.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/log4js": {
|
"node_modules/log4js": {
|
||||||
"version": "6.3.0",
|
"version": "6.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/log4js/-/log4js-6.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/log4js/-/log4js-6.3.0.tgz",
|
||||||
@ -399,48 +386,6 @@
|
|||||||
"url": "https://opencollective.com/mediasoup"
|
"url": "https://opencollective.com/mediasoup"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mediasoup-sdp-bridge": {
|
|
||||||
"version": "3.6.5",
|
|
||||||
"resolved": "git+ssh://git@github.com/versatica/mediasoup-sdp-bridge.git#b1a40b97f27b3fd218334f40448a61d704877952",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/debug": "^4.1.5",
|
|
||||||
"@types/node": "^14.0.5",
|
|
||||||
"@types/uuid": "^8.0.0",
|
|
||||||
"awaitqueue": "^2.1.1",
|
|
||||||
"debug": "^4.1.1",
|
|
||||||
"h264-profile-level-id": "^1.0.1",
|
|
||||||
"sdp-transform": "^2.14.0",
|
|
||||||
"supports-color": "^7.1.0",
|
|
||||||
"uuid": "^8.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"type": "opencollective",
|
|
||||||
"url": "https://opencollective.com/mediasoup"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"mediasoup": "^3.5.15"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mediasoup-sdp-bridge/node_modules/@types/node": {
|
|
||||||
"version": "14.18.12",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz",
|
|
||||||
"integrity": "sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A=="
|
|
||||||
},
|
|
||||||
"node_modules/mediasoup-sdp-bridge/node_modules/supports-color": {
|
|
||||||
"version": "7.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
|
||||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
|
||||||
"dependencies": {
|
|
||||||
"has-flag": "^4.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mediasoup/node_modules/@types/node": {
|
"node_modules/mediasoup/node_modules/@types/node": {
|
||||||
"version": "16.11.19",
|
"version": "16.11.19",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.19.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.19.tgz",
|
||||||
@ -680,23 +625,15 @@
|
|||||||
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==",
|
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/debug": {
|
|
||||||
"version": "4.1.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz",
|
|
||||||
"integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==",
|
|
||||||
"requires": {
|
|
||||||
"@types/ms": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@types/json5": {
|
"@types/json5": {
|
||||||
"version": "0.0.29",
|
"version": "0.0.29",
|
||||||
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||||
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4="
|
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4="
|
||||||
},
|
},
|
||||||
"@types/ms": {
|
"@types/libsodium-wrappers": {
|
||||||
"version": "0.7.31",
|
"version": "0.7.9",
|
||||||
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz",
|
"resolved": "https://registry.npmjs.org/@types/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",
|
||||||
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA=="
|
"integrity": "sha512-LisgKLlYQk19baQwjkBZZXdJL0KbeTpdEnrAfz5hQACbklCY0gVFnsKUyjfNWF1UQsCSjw93Sj5jSbiO8RPfdw=="
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "15.6.1",
|
"version": "15.6.1",
|
||||||
@ -710,11 +647,6 @@
|
|||||||
"integrity": "sha512-GVO0gnmbyO3Oxm2HdPsYUNcyihZE3GyCY8ysMYHuQGfLhGZq89Nm4lSzULWTzZoyHtg+VO/IdrnxZHPnPSGnAg==",
|
"integrity": "sha512-GVO0gnmbyO3Oxm2HdPsYUNcyihZE3GyCY8ysMYHuQGfLhGZq89Nm4lSzULWTzZoyHtg+VO/IdrnxZHPnPSGnAg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/uuid": {
|
|
||||||
"version": "8.3.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz",
|
|
||||||
"integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw=="
|
|
||||||
},
|
|
||||||
"@types/ws": {
|
"@types/ws": {
|
||||||
"version": "7.4.4",
|
"version": "7.4.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.4.tgz",
|
||||||
@ -750,11 +682,6 @@
|
|||||||
"sprintf-js": "~1.0.2"
|
"sprintf-js": "~1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"awaitqueue": {
|
|
||||||
"version": "2.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/awaitqueue/-/awaitqueue-2.3.3.tgz",
|
|
||||||
"integrity": "sha512-RbzQg6VtPUtyErm55iuQLTrBJ2uihy5BKBOEkyBwv67xm5Fn2o/j+Bz+a5BmfSoe2oZ5dcz9Z3fExS8pL+LLhw=="
|
|
||||||
},
|
|
||||||
"base64-js": {
|
"base64-js": {
|
||||||
"version": "1.5.1",
|
"version": "1.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
@ -840,11 +767,6 @@
|
|||||||
"debug": "^4.1.1"
|
"debug": "^4.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"has-flag": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
|
|
||||||
},
|
|
||||||
"ieee754": {
|
"ieee754": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||||
@ -875,6 +797,19 @@
|
|||||||
"graceful-fs": "^4.1.6"
|
"graceful-fs": "^4.1.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"libsodium": {
|
||||||
|
"version": "0.7.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz",
|
||||||
|
"integrity": "sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ=="
|
||||||
|
},
|
||||||
|
"libsodium-wrappers": {
|
||||||
|
"version": "0.7.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.10.tgz",
|
||||||
|
"integrity": "sha512-pO3F1Q9NPLB/MWIhehim42b/Fwb30JNScCNh8TcQ/kIc+qGLQch8ag8wb0keK3EP5kbGakk1H8Wwo7v+36rNQg==",
|
||||||
|
"requires": {
|
||||||
|
"libsodium": "^0.7.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"log4js": {
|
"log4js": {
|
||||||
"version": "6.3.0",
|
"version": "6.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/log4js/-/log4js-6.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/log4js/-/log4js-6.3.0.tgz",
|
||||||
@ -913,36 +848,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mediasoup-sdp-bridge": {
|
|
||||||
"version": "git+ssh://git@github.com/versatica/mediasoup-sdp-bridge.git#b1a40b97f27b3fd218334f40448a61d704877952",
|
|
||||||
"from": "git+ssh://git@github.com/versatica/mediasoup-sdp-bridge.git#b1a40b97f27b3fd218334f40448a61d704877952",
|
|
||||||
"requires": {
|
|
||||||
"@types/debug": "^4.1.5",
|
|
||||||
"@types/node": "^14.0.5",
|
|
||||||
"@types/uuid": "^8.0.0",
|
|
||||||
"awaitqueue": "^2.1.1",
|
|
||||||
"debug": "^4.1.1",
|
|
||||||
"h264-profile-level-id": "^1.0.1",
|
|
||||||
"sdp-transform": "^2.14.0",
|
|
||||||
"supports-color": "^7.1.0",
|
|
||||||
"uuid": "^8.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": {
|
|
||||||
"version": "14.18.12",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz",
|
|
||||||
"integrity": "sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A=="
|
|
||||||
},
|
|
||||||
"supports-color": {
|
|
||||||
"version": "7.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
|
||||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
|
||||||
"requires": {
|
|
||||||
"has-flag": "^4.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "1.2.5",
|
"version": "1.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
"typescript": "^4.3.2"
|
"typescript": "^4.3.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/libsodium-wrappers": "^0.7.9",
|
||||||
"dotenv": "^12.0.4",
|
"dotenv": "^12.0.4",
|
||||||
|
"libsodium": "^0.7.10",
|
||||||
|
"libsodium-wrappers": "^0.7.10",
|
||||||
"mediasoup": "^3.9.5",
|
"mediasoup": "^3.9.5",
|
||||||
"node-turn": "^0.0.6",
|
"node-turn": "^0.0.6",
|
||||||
"sdp-transform": "^2.14.1",
|
"sdp-transform": "^2.14.1",
|
||||||
|
@ -5,8 +5,8 @@ import OPCodeHandlers, { Payload } from "./opcodes";
|
|||||||
import { setHeartbeat } from "./util";
|
import { setHeartbeat } from "./util";
|
||||||
import * as mediasoup from "mediasoup";
|
import * as mediasoup from "mediasoup";
|
||||||
import { types as MediasoupTypes } from "mediasoup";
|
import { types as MediasoupTypes } from "mediasoup";
|
||||||
|
|
||||||
import udp from "dgram";
|
import udp from "dgram";
|
||||||
|
import sodium from "libsodium-wrappers";
|
||||||
|
|
||||||
var port = Number(process.env.PORT);
|
var port = Number(process.env.PORT);
|
||||||
if (isNaN(port)) port = 3004;
|
if (isNaN(port)) port = 3004;
|
||||||
@ -47,19 +47,59 @@ export class Server {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// this.testUdp.bind(50001);
|
this.testUdp.bind(50001);
|
||||||
// this.testUdp.on("message", (msg, rinfo) => {
|
this.testUdp.on("message", (msg, rinfo) => {
|
||||||
// if (msg[0] === 0 && msg[1] === 1 && msg[2] === 0) { //idk stun?
|
//random key from like, the libsodium examples on npm lol
|
||||||
|
const decryptKey = sodium.from_hex("724b092810ec86d7e35c9d067702b31ef90bc43a7b598626749914d6a3e033ed");
|
||||||
|
|
||||||
// }
|
//give me my remote port?
|
||||||
// })
|
if (sodium.to_hex(msg) == "0001004600000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") {
|
||||||
|
this.testUdp.send(Buffer.from([rinfo.port, 0]), rinfo.port, rinfo.address);
|
||||||
|
console.log(`got magic packet to send remote port? ${rinfo.address}:${rinfo.port}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Hello
|
||||||
|
if (sodium.to_hex(msg) == "0100000000000000") {
|
||||||
|
console.log(`[UDP] client helloed`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nonce = Buffer.concat([msg.slice(-4), Buffer.from("\x00".repeat(20))]);
|
||||||
|
console.log(`[UDP] nonce for this message: ${nonce}`);
|
||||||
|
|
||||||
|
console.log(sodium.to_hex(msg));
|
||||||
|
if (sodium.to_hex(msg).indexOf("80c8000600000001") == 0) {
|
||||||
|
//call status
|
||||||
|
const encrypted = msg.slice(8, -4);
|
||||||
|
const currentPacket = msg.slice(-4);
|
||||||
|
console.log(`[UDP] Current packet: ${currentPacket}`);
|
||||||
|
try {
|
||||||
|
console.log(`[UDP] Encrypted bytes: ${encrypted.toString("base64")}`);
|
||||||
|
const decrypted = sodium.crypto_secretbox_open_easy(encrypted, nonce, decryptKey);
|
||||||
|
console.log("[UDP] [ call status ]" + decrypted);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.error(`[UDP] decrypt failure\n${e}\n${encrypted.toString("base64")}`);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const decrypted = sodium.crypto_secretbox_open_easy(msg, nonce, decryptKey);
|
||||||
|
console.log("[UDP] " + decrypted);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.error(`[UDP] decrypt failure\n${e}\n${msg.toString("base64")}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async listen(): Promise<void> {
|
async listen(): Promise<void> {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await initDatabase();
|
await initDatabase();
|
||||||
await Config.init();
|
await Config.init();
|
||||||
await this.createWorkers();
|
//await this.createWorkers();
|
||||||
console.log("[DB] connected");
|
console.log("[DB] connected");
|
||||||
console.log(`[WebRTC] online on 0.0.0.0:${port}`);
|
console.log(`[WebRTC] online on 0.0.0.0:${port}`);
|
||||||
}
|
}
|
||||||
@ -86,17 +126,17 @@ export class Server {
|
|||||||
|
|
||||||
transport.on('dtlsstatechange', (dtlsstate) => {
|
transport.on('dtlsstatechange', (dtlsstate) => {
|
||||||
console.log(dtlsstate);
|
console.log(dtlsstate);
|
||||||
})
|
});
|
||||||
|
|
||||||
transport.on("sctpstatechange", (sctpstate) => {
|
transport.on("sctpstatechange", (sctpstate) => {
|
||||||
console.log(sctpstate)
|
console.log(sctpstate);
|
||||||
})
|
});
|
||||||
|
|
||||||
router.observer.on("newrtpobserver", (rtpObserver: MediasoupTypes.RtpObserver) => {
|
router.observer.on("newrtpobserver", (rtpObserver: MediasoupTypes.RtpObserver) => {
|
||||||
console.log("new RTP observer created [id:%s]", rtpObserver.id);
|
console.log("new RTP observer created [id:%s]", rtpObserver.id);
|
||||||
|
|
||||||
// rtpObserver.observer.on("")
|
// rtpObserver.observer.on("")
|
||||||
})
|
});
|
||||||
|
|
||||||
transport.on("connect", () => {
|
transport.on("connect", () => {
|
||||||
console.log("transport connect");
|
console.log("transport connect");
|
||||||
|
@ -33,18 +33,18 @@ export async function onIdentify(this: Server, socket: WebSocket, data: Identify
|
|||||||
if (!guild.members.find(x => x.id === user.id))
|
if (!guild.members.find(x => x.id === user.id))
|
||||||
return socket.close(CLOSECODES.Invalid_intent);
|
return socket.close(CLOSECODES.Invalid_intent);
|
||||||
|
|
||||||
var transport = this.mediasoupTransports[0] || await this.mediasoupRouters[0].createWebRtcTransport({
|
// var transport = this.mediasoupTransports[0] || await this.mediasoupRouters[0].createWebRtcTransport({
|
||||||
listenIps: [{ ip: "10.22.64.63" }],
|
// listenIps: [{ ip: "10.22.64.56" }],
|
||||||
enableUdp: true,
|
// enableUdp: true,
|
||||||
});
|
// });
|
||||||
|
7
|
||||||
socket.send(JSON.stringify({
|
socket.send(JSON.stringify({
|
||||||
op: VoiceOPCodes.READY,
|
op: VoiceOPCodes.READY,
|
||||||
d: {
|
d: {
|
||||||
streams: [...data.d.streams.map(x => ({ ...x, rtx_ssrc: Math.floor(Math.random() * 10000), ssrc: Math.floor(Math.random() * 10000), active: false, }))],
|
streams: data.d.streams ? [...data.d.streams.map(x => ({ ...x, rtx_ssrc: Math.floor(Math.random() * 10000), ssrc: Math.floor(Math.random() * 10000), active: false, }))] : undefined,
|
||||||
ssrc: Math.floor(Math.random() * 10000),
|
ssrc: Math.floor(Math.random() * 10000),
|
||||||
ip: transport.iceCandidates[0].ip,
|
ip: "127.0.0.1",//transport.iceCandidates[0].ip,
|
||||||
port: transport.iceCandidates[0].port,
|
port: 50001,//transport.iceCandidates[0].port,
|
||||||
modes: [
|
modes: [
|
||||||
"aead_aes256_gcm_rtpsize",
|
"aead_aes256_gcm_rtpsize",
|
||||||
"aead_aes256_gcm",
|
"aead_aes256_gcm",
|
||||||
|
@ -5,6 +5,7 @@ import { Server } from "../Server";
|
|||||||
import * as mediasoup from "mediasoup";
|
import * as mediasoup from "mediasoup";
|
||||||
import { RtpCodecCapability } from "mediasoup/node/lib/RtpParameters";
|
import { RtpCodecCapability } from "mediasoup/node/lib/RtpParameters";
|
||||||
import * as sdpTransform from 'sdp-transform';
|
import * as sdpTransform from 'sdp-transform';
|
||||||
|
import sodium from "libsodium-wrappers";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -70,42 +71,66 @@ import * as sdpTransform from 'sdp-transform';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export async function onSelectProtocol(this: Server, socket: WebSocket, data: Payload) {
|
export async function onSelectProtocol(this: Server, socket: WebSocket, data: Payload) {
|
||||||
const rtpCapabilities = this.mediasoupRouters[0].rtpCapabilities;
|
// const rtpCapabilities = this.mediasoupRouters[0].rtpCapabilities;
|
||||||
const codecs = rtpCapabilities.codecs as RtpCodecCapability[];
|
// const codecs = rtpCapabilities.codecs as RtpCodecCapability[];
|
||||||
|
|
||||||
const transport = this.mediasoupTransports[0]; //whatever
|
if (data.d.sdp) {
|
||||||
|
// const transport = this.mediasoupTransports[0]; //whatever
|
||||||
|
|
||||||
const res = sdpTransform.parse(data.d.sdp);
|
// const res = sdpTransform.parse(data.d.sdp);
|
||||||
|
|
||||||
const videoCodec = this.mediasoupRouters[0].rtpCapabilities.codecs!.find((x: any) => x.kind === "video");
|
// const videoCodec = this.mediasoupRouters[0].rtpCapabilities.codecs!.find((x: any) => x.kind === "video");
|
||||||
const audioCodec = this.mediasoupRouters[0].rtpCapabilities.codecs!.find((x: any) => x.kind === "audio");
|
// const audioCodec = this.mediasoupRouters[0].rtpCapabilities.codecs!.find((x: any) => x.kind === "audio");
|
||||||
|
|
||||||
const producer = this.mediasoupProducers[0] || await transport.produce({
|
// const producer = this.mediasoupProducers[0] || await transport.produce({
|
||||||
kind: "audio",
|
// kind: "audio",
|
||||||
rtpParameters: {
|
// rtpParameters: {
|
||||||
mid: "audio",
|
// mid: "audio",
|
||||||
codecs: [{
|
// codecs: [{
|
||||||
clockRate: audioCodec!.clockRate,
|
// clockRate: audioCodec!.clockRate,
|
||||||
payloadType: audioCodec!.preferredPayloadType as number,
|
// payloadType: audioCodec!.preferredPayloadType as number,
|
||||||
mimeType: audioCodec!.mimeType,
|
// mimeType: audioCodec!.mimeType,
|
||||||
channels: audioCodec?.channels,
|
// channels: audioCodec?.channels,
|
||||||
}],
|
// }],
|
||||||
headerExtensions: res.ext?.map(x => ({
|
// headerExtensions: res.ext?.map(x => ({
|
||||||
id: x.value,
|
// id: x.value,
|
||||||
uri: x.uri,
|
// uri: x.uri,
|
||||||
})),
|
// })),
|
||||||
},
|
// },
|
||||||
paused: false,
|
// paused: false,
|
||||||
});
|
// });
|
||||||
|
|
||||||
console.log("can consume: " + this.mediasoupRouters[0].canConsume({ producerId: producer.id, rtpCapabilities: rtpCapabilities }));
|
// console.log("can consume: " + this.mediasoupRouters[0].canConsume({ producerId: producer.id, rtpCapabilities: rtpCapabilities }));
|
||||||
|
|
||||||
// const consumer = this.mediasoupConsumers[0] || await transport.consume({
|
// // const consumer = this.mediasoupConsumers[0] || await transport.consume({
|
||||||
// producerId: producer.id,
|
// // producerId: producer.id,
|
||||||
// paused: false,
|
// // paused: false,
|
||||||
// rtpCapabilities,
|
// // rtpCapabilities,
|
||||||
// });
|
// // });
|
||||||
|
|
||||||
|
// socket.send(JSON.stringify({
|
||||||
|
// op: VoiceOPCodes.SESSION_DESCRIPTION,
|
||||||
|
// d: {
|
||||||
|
// video_codec: videoCodec?.mimeType?.substring(6) || undefined,
|
||||||
|
// // mode: "xsalsa20_poly1305_lite",
|
||||||
|
// media_session_id: transport.id,
|
||||||
|
// audio_codec: audioCodec?.mimeType.substring(6),
|
||||||
|
// secret_key: sodium.from_hex("724b092810ec86d7e35c9d067702b31ef90bc43a7b598626749914d6a3e033ed").buffer,
|
||||||
|
// sdp: `m=audio ${50001} ICE/SDP\n`
|
||||||
|
// + `a=fingerprint:sha-256 ${transport.dtlsParameters.fingerprints.find(x => x.algorithm === "sha-256")?.value}\n`
|
||||||
|
// + `c=IN IP4 ${transport.iceCandidates[0].ip}\n`
|
||||||
|
// + `t=0 0\n`
|
||||||
|
// + `a=ice-lite\n`
|
||||||
|
// + `a=rtcp-mux\n`
|
||||||
|
// + `a=rtcp:${50001}\n`
|
||||||
|
// + `a=ice-ufrag:${transport.iceParameters.usernameFragment}\n`
|
||||||
|
// + `a=ice-pwd:${transport.iceParameters.password}\n`
|
||||||
|
// + `a=fingerprint:sha-256 ${transport.dtlsParameters.fingerprints.find(x => x.algorithm === "sha-256")?.value}\n`
|
||||||
|
// + `a=candidate:1 1 ${transport.iceCandidates[0].protocol.toUpperCase()} ${transport.iceCandidates[0].priority} ${transport.iceCandidates[0].ip} ${50001} typ ${transport.iceCandidates[0].type}`
|
||||||
|
// }
|
||||||
|
// }));
|
||||||
|
return;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
"video_codec":"H264",
|
"video_codec":"H264",
|
||||||
@ -125,24 +150,25 @@ export async function onSelectProtocol(this: Server, socket: WebSocket, data: Pa
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"video_codec": "H264",
|
||||||
|
"secret_key": [36, 80, 96, 53, 95, 149, 253, 16, 137, 186, 238, 222, 251, 180, 94, 150, 112, 137, 192, 109, 69, 79, 218, 111, 217, 197, 56, 74, 18, 41, 51, 140],
|
||||||
|
"mode": "aead_aes256_gcm_rtpsize",
|
||||||
|
"media_session_id": "797575a97a87b63e81e2399348b97ad1",
|
||||||
|
"audio_codec": "opus"
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
socket.send(JSON.stringify({
|
socket.send(JSON.stringify({
|
||||||
op: VoiceOPCodes.SESSION_DESCRIPTION,
|
op:VoiceOPCodes.SESSION_DESCRIPTION,
|
||||||
d: {
|
d: {
|
||||||
video_codec: videoCodec?.mimeType?.substring(6) || undefined,
|
video_codec: "H264",
|
||||||
// mode: "xsalsa20_poly1305_lite",
|
secret_key: [...sodium.from_hex("724b092810ec86d7e35c9d067702b31ef90bc43a7b598626749914d6a3e033ed")],
|
||||||
media_session_id: transport.id,
|
mode: "aead_aes256_gcm_rtpsize",
|
||||||
audio_codec: audioCodec?.mimeType.substring(6),
|
media_session_id: "blah blah blah",
|
||||||
sdp: `m=audio ${transport.iceCandidates[0].port} ICE/SDP\n`
|
audio_codec: "opus",
|
||||||
+ `a=fingerprint:sha-256 ${transport.dtlsParameters.fingerprints.find(x => x.algorithm === "sha-256")?.value}\n`
|
|
||||||
+ `c=IN IP4 ${transport.iceCandidates[0].ip}\n`
|
|
||||||
+ `t=0 0\n`
|
|
||||||
+ `a=ice-lite\n`
|
|
||||||
+ `a=rtcp-mux\n`
|
|
||||||
+ `a=rtcp:${transport.iceCandidates[0].port}\n`
|
|
||||||
+ `a=ice-ufrag:${transport.iceParameters.usernameFragment}\n`
|
|
||||||
+ `a=ice-pwd:${transport.iceParameters.password}\n`
|
|
||||||
+ `a=fingerprint:sha-256 ${transport.dtlsParameters.fingerprints.find(x => x.algorithm === "sha-256")?.value}\n`
|
|
||||||
+ `a=candidate:1 1 ${transport.iceCandidates[0].protocol.toUpperCase()} ${transport.iceCandidates[0].priority} ${transport.iceCandidates[0].ip} ${transport.iceCandidates[0].port} typ ${transport.iceCandidates[0].type}`
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user