You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{RconPool}from'@callowayisweird/source-rcon'constpool=newRconPool([{host: '10.0.0.1',port: 27015,password: 'pass1'},{host: '10.0.0.2',port: 27015,password: 'pass2'},{host: '10.0.0.3',port: 27015,password: 'pass3'},])awaitpool.connectAll()// Execute on a specific serverconststatus=awaitpool.execute('10.0.0.1:27015','status')// Execute on all serversconstresults=awaitpool.executeAll('status')for(const[server,response]ofresults){console.log(`${server}: ${response}`)}awaitpool.disconnectAll()
Permission-Gated RCON
import{Rcon,GatedRcon}from'@callowayisweird/source-rcon'constrcon=newRcon({host: '127.0.0.1',port: 27015,password: 'secret',})awaitrcon.connect()constgated=newGatedRcon(rcon,{allowedUsers: ['STEAM_0:1:12345678','STEAM_0:1:87654321'],permissions: {'STEAM_0:1:12345678': ['say *','status','changelevel *'],// admin'STEAM_0:1:87654321': ['say *','status'],// moderator},rateLimit: {windowMs: 60000,// 1 minutemaxCommands: 10,// max 10 commands per minute},onExecute: (steamId,command,response)=>{console.log(`[RCON] ${steamId} executed: ${command}`)},onBlocked: (steamId,command,reason)=>{console.warn(`[RCON] Blocked ${steamId}: ${command} (${reason})`)},})// Will succeed for allowed users with matching permissionsawaitgated.execute('STEAM_0:1:12345678','say Hello everyone!')// Will throw PermissionDeniedErrorawaitgated.execute('STEAM_0:1:87654321','changelevel gm_flatgrass')