An interactive command-line interface (CLI) tool to help you install, use, and administer an AO instance.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
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
|
|
|
|
}
|