@slimevr/firmware-protocol-debugger
Advanced tools
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
+9
-6
| { | ||
| "name": "@slimevr/firmware-protocol-debugger", | ||
| "version": "0.2.13", | ||
| "version": "0.2.14", | ||
| "main": "dist/index.js", | ||
@@ -26,8 +26,8 @@ "license": "(MIT OR Apache-2.0)", | ||
| "strict-event-emitter-types": "2.0.0", | ||
| "@slimevr/common": "0.1.2", | ||
| "@slimevr/firmware-protocol": "0.6.5", | ||
| "@slimevr/firmware-protocol-debugger-utils": "0.0.12", | ||
| "@slimevr/firmware-protocol-debugger-shared": "0.0.12" | ||
| "@slimevr/common": "0.1.3", | ||
| "@slimevr/firmware-protocol": "0.6.6" | ||
| }, | ||
| "devDependencies": { | ||
| "@rollup/plugin-node-resolve": "^16.0.1", | ||
| "@rollup/plugin-typescript": "^12.1.2", | ||
| "@types/node": "17.0.45", | ||
@@ -37,4 +37,7 @@ "concurrently": "7.5.0", | ||
| "nodemon": "^2.0.20", | ||
| "rollup": "^4.40.0", | ||
| "typescript": "4.8.4", | ||
| "wait-for-it": "1.0.0", | ||
| "@slimevr/firmware-protocol-debugger-shared": "0.0.13", | ||
| "@slimevr/firmware-protocol-debugger-utils": "0.0.13", | ||
| "@slimevr/tsconfig": "0.0.1" | ||
@@ -47,5 +50,5 @@ }, | ||
| "dev": "concurrently \"tsc -w\" \"nodemon .\"", | ||
| "build": "tsc", | ||
| "build": "rollup -c", | ||
| "clean": "rimraf dist" | ||
| } | ||
| } |
| > @slimevr/firmware-protocol-debugger@0.2.13 build /home/runner/work/slimevr-node/slimevr-node/apps/firmware-protocol-debugger | ||
| > tsc | ||
-130
| # @slimevr/firmware-protocol-debugger | ||
| ## 0.2.13 | ||
| ### Patch Changes | ||
| - Updated dependencies [b174be6] | ||
| - @slimevr/firmware-protocol@0.6.5 | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.12 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.12 | ||
| ## 0.2.12 | ||
| ### Patch Changes | ||
| - Updated dependencies [3d3b4fb] | ||
| - @slimevr/firmware-protocol@0.6.4 | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.11 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.11 | ||
| ## 0.2.11 | ||
| ### Patch Changes | ||
| - fa0f33c: fixed startup | ||
| ## 0.2.10 | ||
| ### Patch Changes | ||
| - Updated dependencies [876591c] | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.10 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.10 | ||
| - @slimevr/firmware-protocol@0.6.3 | ||
| - @slimevr/common@0.1.2 | ||
| ## 0.2.9 | ||
| ### Patch Changes | ||
| - Updated dependencies [1b2cd7f] | ||
| - @slimevr/firmware-protocol@0.6.2 | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.9 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.9 | ||
| ## 0.2.8 | ||
| ### Patch Changes | ||
| - Updated dependencies [2aef2cb] | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.8 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.8 | ||
| - @slimevr/firmware-protocol@0.6.1 | ||
| - @slimevr/common@0.1.1 | ||
| ## 0.2.7 | ||
| ### Patch Changes | ||
| - d72dd07: fixed that local clients get ignored | ||
| - Updated dependencies [751dab5] | ||
| - @slimevr/firmware-protocol@0.6.0 | ||
| - @slimevr/common@0.1.0 | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.7 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.7 | ||
| ## 0.2.6 | ||
| ### Patch Changes | ||
| - Updated dependencies [227500c] | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.6 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.6 | ||
| - @slimevr/firmware-protocol@0.5.3 | ||
| - @slimevr/common@0.0.5 | ||
| ## 0.2.5 | ||
| ### Patch Changes | ||
| - Updated dependencies [52e3a81] | ||
| - @slimevr/firmware-protocol@0.5.2 | ||
| - @slimevr/common@0.0.4 | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.5 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.5 | ||
| ## 0.2.4 | ||
| ### Patch Changes | ||
| - Updated dependencies [85438bb] | ||
| - @slimevr/common@0.0.3 | ||
| - @slimevr/firmware-protocol@0.5.1 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.4 | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.4 | ||
| ## 0.2.3 | ||
| ### Patch Changes | ||
| - Updated dependencies [6e57adf] | ||
| - @slimevr/firmware-protocol@0.5.0 | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.3 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.3 | ||
| ## 0.2.2 | ||
| ### Patch Changes | ||
| - Updated dependencies [96b22a9] | ||
| - @slimevr/common@0.0.2 | ||
| - @slimevr/firmware-protocol@0.4.1 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.2 | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.2 | ||
| ## 0.2.1 | ||
| ### Patch Changes | ||
| - 2e9a5c2: fix missing packages | ||
| - 2e9a5c2: bump dependencies | ||
| - Updated dependencies [2e9a5c2] | ||
| - Updated dependencies [422164b] | ||
| - Updated dependencies [2e9a5c2] | ||
| - Updated dependencies [2e9a5c2] | ||
| - Updated dependencies [8966103] | ||
| - @slimevr/common@0.0.1 | ||
| - @slimevr/firmware-protocol@0.4.0 | ||
| - @slimevr/firmware-protocol-debugger-shared@0.0.1 | ||
| - @slimevr/firmware-protocol-debugger-utils@0.0.1 |
| import { Server } from './Server.js'; | ||
| const server = new Server(); | ||
| server.start().then(() => { | ||
| console.log('Server started!'); | ||
| }); | ||
| process.on('SIGINT', async () => { | ||
| await server.stop(); | ||
| }); |
| import { ServerStatus } from '@slimevr/firmware-protocol-debugger-shared'; | ||
| import { ConnectionTracker, newEvents, Tracker, utils } from '@slimevr/firmware-protocol-debugger-utils'; | ||
| import { createSocket } from 'node:dgram'; | ||
| const [broadcastBlacklist, addressBlacklist] = utils.getBroadcastAddresses(); | ||
| console.log('Blacklisted broadcast IPs:', broadcastBlacklist.join(', ')); | ||
| console.log('Blacklisted IPs:', addressBlacklist.join(', ')); | ||
| export class Server { | ||
| events = newEvents(); | ||
| socket = createSocket('udp4'); | ||
| connectionTracker = new ConnectionTracker(this.events); | ||
| removeOldConnectionsTimer = null; | ||
| pingConnectionsTimer = null; | ||
| start() { | ||
| this.socket.on('error', (err) => { | ||
| console.log('Server Error:', err); | ||
| }); | ||
| this.socket.on('message', (msg, rinfo) => { | ||
| if (addressBlacklist.includes(rinfo.address) && rinfo.port === 6969) { | ||
| return; | ||
| } | ||
| let tracker = this.connectionTracker.getConnectionByIP(rinfo.address); | ||
| if (!tracker) { | ||
| tracker = new Tracker(this.events, this.socket, this.connectionTracker, rinfo.address, rinfo.port); | ||
| this.connectionTracker.addConnection(tracker); | ||
| } | ||
| tracker.handle(msg); | ||
| }); | ||
| this.removeOldConnectionsTimer = setInterval(() => this.connectionTracker.removeOldConnections(), 500).unref(); | ||
| this.pingConnectionsTimer = setInterval(() => this.connectionTracker.pingConnections(), 1000).unref(); | ||
| return new Promise((resolve) => { | ||
| this.socket | ||
| .once('listening', () => { | ||
| this.events.emit('server:status', ServerStatus.Running); | ||
| resolve(); | ||
| }) | ||
| .bind(6969, '0.0.0.0'); | ||
| }); | ||
| } | ||
| async stop() { | ||
| if (this.removeOldConnectionsTimer) { | ||
| clearInterval(this.removeOldConnectionsTimer); | ||
| } | ||
| if (this.pingConnectionsTimer) { | ||
| clearInterval(this.pingConnectionsTimer); | ||
| } | ||
| this.connectionTracker.removeAllConnections(); | ||
| return new Promise((resolve) => { | ||
| this.socket | ||
| .once('close', () => { | ||
| this.events.emit('server:status', ServerStatus.Stopped); | ||
| resolve(); | ||
| }) | ||
| .close(); | ||
| }); | ||
| } | ||
| } |
-11
| import { Server } from './Server.js'; | ||
| const server = new Server(); | ||
| server.start().then(() => { | ||
| console.log('Server started!'); | ||
| }); | ||
| process.on('SIGINT', async () => { | ||
| await server.stop(); | ||
| }); |
| import { ServerStatus } from '@slimevr/firmware-protocol-debugger-shared'; | ||
| import { ConnectionTracker, newEvents, Tracker, utils } from '@slimevr/firmware-protocol-debugger-utils'; | ||
| import { createSocket } from 'node:dgram'; | ||
| const [broadcastBlacklist, addressBlacklist] = utils.getBroadcastAddresses(); | ||
| console.log('Blacklisted broadcast IPs:', broadcastBlacklist.join(', ')); | ||
| console.log('Blacklisted IPs:', addressBlacklist.join(', ')); | ||
| export class Server { | ||
| readonly events = newEvents(); | ||
| private readonly socket = createSocket('udp4'); | ||
| private readonly connectionTracker = new ConnectionTracker(this.events); | ||
| private removeOldConnectionsTimer: NodeJS.Timeout | null = null; | ||
| private pingConnectionsTimer: NodeJS.Timeout | null = null; | ||
| start(): Promise<void> { | ||
| this.socket.on('error', (err) => { | ||
| console.log('Server Error:', err); | ||
| }); | ||
| this.socket.on('message', (msg, rinfo) => { | ||
| if (addressBlacklist.includes(rinfo.address) && rinfo.port === 6969) { | ||
| return; | ||
| } | ||
| let tracker = this.connectionTracker.getConnectionByIP(rinfo.address); | ||
| if (!tracker) { | ||
| tracker = new Tracker(this.events, this.socket, this.connectionTracker, rinfo.address, rinfo.port); | ||
| this.connectionTracker.addConnection(tracker); | ||
| } | ||
| tracker.handle(msg); | ||
| }); | ||
| this.removeOldConnectionsTimer = setInterval(() => this.connectionTracker.removeOldConnections(), 500).unref(); | ||
| this.pingConnectionsTimer = setInterval(() => this.connectionTracker.pingConnections(), 1000).unref(); | ||
| return new Promise((resolve) => { | ||
| this.socket | ||
| .once('listening', () => { | ||
| this.events.emit('server:status', ServerStatus.Running); | ||
| resolve(); | ||
| }) | ||
| .bind(6969, '0.0.0.0'); | ||
| }); | ||
| } | ||
| async stop(): Promise<void> { | ||
| if (this.removeOldConnectionsTimer) { | ||
| clearInterval(this.removeOldConnectionsTimer); | ||
| } | ||
| if (this.pingConnectionsTimer) { | ||
| clearInterval(this.pingConnectionsTimer); | ||
| } | ||
| this.connectionTracker.removeAllConnections(); | ||
| return new Promise((resolve) => { | ||
| this.socket | ||
| .once('close', () => { | ||
| this.events.emit('server:status', ServerStatus.Stopped); | ||
| resolve(); | ||
| }) | ||
| .close(); | ||
| }); | ||
| } | ||
| } |
| { | ||
| "extends": "@slimevr/tsconfig/node.json", | ||
| "include": ["src/**/*.ts"], | ||
| "exclude": ["dist", "build", "node_modules"], | ||
| "compilerOptions": { | ||
| "target": "ES2022", | ||
| "module": "ESNext", | ||
| "outDir": "./dist" | ||
| } | ||
| } |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
240168
1826.58%3
-40%1910
1190.54%12
71.43%8
-38.46%7
600%1
Infinity%+ Added
+ Added
- Removed
- Removed
Updated