Anon
The Anon
class allows you to run and manage an Anon client with various configuration options.
Constructor
constructor(options?: Partial<AnonConfig>)
constructor(options?: Partial<AnonConfig>)
Creates a new instance of the Anon class.
options
(optional):Partial<AnonConfig>
- An object containing partial configuration options for the Anon client.
AnonConfig Properties
displayLog
:boolean
- Whether to display logs. Default:false
useExecFile
:boolean
- Whether to useexecFile
instead ofspawn
. Default:false
socksPort
:number
- The SOCKS port to use. Default:9050
orPort
:number
- The OR (Onion Routing) port to use. Default:0
controlPort
:number
- The control port to use. Default:9051
binaryPath
:string | undefined
- The path to the Anon binary. Default:undefined
Methods
getSOCKSPort(): number
getSOCKSPort(): number
Retrieves the SOCKS port number configured for the Anon instance.
Returns: The SOCKS port number.
getControlPort(): number
getControlPort(): number
Retrieves the Control port number configured for the Anon instance.
Returns: The Control port number.
getORPort(): number
getORPort(): number
Retrieves the OR (Onion Routing) port number configured for the Anon instance.
Returns: The OR port number.
async start(): Promise<void>
async start(): Promise<void>
Starts the Anon client with the options configured in the constructor.
Throws: An error if the Anon process is already started.
async stop(): Promise<void>
async stop(): Promise<void>
Stops the Anon client.
isRunning(): boolean
isRunning(): boolean
Checks if the Anon client is currently running.
Returns: true
if Anon is running, false
otherwise.
Usage Example
Last updated