mirror of
https://github.com/tornadocash/tornado-cli.git
synced 2024-10-01 07:15:36 -04:00
Support Onion RPC nodes
This commit is contained in:
parent
7e62cb2000
commit
a9c6a24204
8
cli.js
8
cli.js
@ -906,12 +906,18 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100', torPort,
|
|||||||
senderAccount = (await web3.eth.getAccounts())[0]
|
senderAccount = (await web3.eth.getAccounts())[0]
|
||||||
} else {
|
} else {
|
||||||
let ipOptions = {};
|
let ipOptions = {};
|
||||||
if (torPort) {
|
if (torPort && rpc.includes("https")) {
|
||||||
console.log("Using tor network")
|
console.log("Using tor network")
|
||||||
web3Options = { agent: { https: new SocksProxyAgent('socks5h://127.0.0.1:'+torPort) }, timeout: 60000 }
|
web3Options = { agent: { https: new SocksProxyAgent('socks5h://127.0.0.1:'+torPort) }, timeout: 60000 }
|
||||||
// Use forked web3-providers-http from local file to modify user-agent header value which improves privacy.
|
// Use forked web3-providers-http from local file to modify user-agent header value which improves privacy.
|
||||||
web3 = new Web3(new Web3HttpProvider(rpc, web3Options), null, { transactionConfirmationBlocks: 1 })
|
web3 = new Web3(new Web3HttpProvider(rpc, web3Options), null, { transactionConfirmationBlocks: 1 })
|
||||||
ipOptions = { httpsAgent: new SocksProxyAgent('socks5h://127.0.0.1:'+torPort), headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' } }
|
ipOptions = { httpsAgent: new SocksProxyAgent('socks5h://127.0.0.1:'+torPort), headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' } }
|
||||||
|
} else if (torPort && rpc.includes("http")) {
|
||||||
|
console.log("Using tor network")
|
||||||
|
web3Options = { agent: { http: new SocksProxyAgent('socks5h://127.0.0.1:'+torPort) }, timeout: 60000 }
|
||||||
|
// Use forked web3-providers-http from local file to modify user-agent header value which improves privacy.
|
||||||
|
web3 = new Web3(new Web3HttpProvider(rpc, web3Options), null, { transactionConfirmationBlocks: 1 })
|
||||||
|
ipOptions = { httpsAgent: new SocksProxyAgent('socks5h://127.0.0.1:'+torPort), headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' } }
|
||||||
} else if (rpc.includes("ipc")) {
|
} else if (rpc.includes("ipc")) {
|
||||||
console.log("Using ipc connection")
|
console.log("Using ipc connection")
|
||||||
web3 = new Web3(new Web3.providers.IpcProvider(rpc, net), null, { transactionConfirmationBlocks: 1 })
|
web3 = new Web3(new Web3.providers.IpcProvider(rpc, net), null, { transactionConfirmationBlocks: 1 })
|
||||||
|
Loading…
Reference in New Issue
Block a user