import { execSync } from 'child_process' // Returns one of: off, installed, enabled, running, synced, error export function torStatus() { try { const stdout = execSync('systemctl status tor') const isTorRunning = stdout.includes('Active: active (running)') if(isTorRunning) return 'running' else if(stdout.includes('error')) return 'error' else if(stdout.includes('stopped')) return 'installed' } catch(err) { return 'error' } return 'off' } export function isInstalled() { return torStatus() === 'running' } export default { description: 'connect AOs p2p', status: torStatus, isInstalled: isInstalled }