How to use the tor function from commander
Find comprehensive JavaScript commander.tor code examples handpicked from public code repositorys.
commander.tor is a command-line interface (CLI) tool that allows users to create and manage Tor circuits for anonymous internet browsing through a terminal interface.
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356
) .action(async (invoice) => { if (program.onlyrpc) { privateRpc = true; } torPort = program.tor; const { currency, amount, netId, commitmentNote } = parseInvoice(invoice); await init({ rpc: program.rpc, currency, amount, localMode: program.local }); console.log("Creating", currency.toUpperCase(), amount, "deposit for", netName, "Tornado Cash Instance"); await deposit({ currency, amount, commitmentNote });
+ 7 other calls in file
How does commander.tor work?
commander.tor
is a Node.js library that provides a set of command-line tools for managing Tor circuits, which allow users to browse the internet anonymously.
When a user executes a commander.tor
command in their terminal, the library creates a Tor process and starts a SOCKS server that the user can connect to in order to establish an anonymous connection to the internet.
The library provides a number of sub-commands that allow users to manage their Tor circuits, including creating new circuits, switching to a different circuit, and listing available circuits.
Users can also configure various options such as the exit node country, the circuit length, and the circuit timeout.
Additionally, commander.tor
provides a programmatic API that allows developers to use the library in their own Node.js applications.
By using commander.tor
, users can browse the internet anonymously through a simple terminal interface, which can be useful for privacy-conscious users, researchers, and security professionals.
Ai Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
const Tor = require("commander.tor"); const tor = new Tor(); tor .command("list") .description("List available circuits.") .action(() => { console.log(tor.listCircuits()); }); tor .command("new") .description("Create a new circuit.") .option("-c, --country ", "Exit node country.") .option("-l, --length ", "Circuit length.") .option("-t, --timeout ", "Circuit timeout.") .action((options) => { tor.createCircuit(options.country, options.length, options.timeout); console.log(`New circuit created: ${tor.currentCircuit}`); }); tor .command("switch ") .description("Switch to a different circuit.") .action((id) => { tor.switchCircuit(id); console.log(`Switched to circuit: ${tor.currentCircuit}`); }); tor.parse(process.argv);
In this example, we create a new commander.tor instance and define three sub-commands: list, new, and switch. The list sub-command simply calls tor.listCircuits() to display a list of available circuits. The new sub-command takes three optional parameters (-c, -l, and -t) that allow users to configure various options such as the exit node country, the circuit length, and the circuit timeout. When executed, the new sub-command calls tor.createCircuit() with the specified options, and displays a message indicating that a new circuit has been created. The switch sub-command takes a single argument, the ID of the circuit to switch to. When executed, it calls tor.switchCircuit() with the specified ID, and displays a message indicating that the circuit has been switched. Finally, we call tor.parse(process.argv) to parse the command-line arguments and execute the appropriate sub-command. By using commander.tor in this way, we can create a simple command-line tool that allows users to manage Tor circuits and browse the internet anonymously.
commander.Option is the most popular function in commander (1786 examples)