set daemon proxy by setting daemon connection
What changed, and why it matters
This commit is a routine feature refactor, not a security fix. It changes how Tor proxy settings are configured in the monero-java library so that the proxy URI is bundled together with the daemon connection object instead of being set separately. There is no indication of a vulnerability being patched.
No security action required; review as normal feature/refactor code.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors proxy configuration by moving proxyUri into MoneroRpcConnection and propagating it through JNI to the underlying monero-cpp wallet. It removes standalone setProxyUri()/setProxyJni() methods in favor of passing proxy_uri alongside uri/username/password when setting the daemon connection. Documentation and sample tests are updated accordingly. No security defect or mitigation is visible in the diff.
Changed components
monero-java JNI bridge (monero_jni_bridge.cpp/.h)MoneroRpcConnectionMoneroDaemonRpcMoneroWalletFullMoneroWalletRpcMoneroWalletConfigTor/proxy configuration documentationInspect captured patch +146 / −82
diff --git a/docs/tor.md b/docs/tor.md
index 433ffd7..7ac52cd 100644
--- a/docs/tor.md
+++ b/docs/tor.md
@@ -2,12 +2,22 @@
First start a TOR node and get its local proxy URI (outside the scope of monero-java).
-Then use `monerod.setProxyUri("<tor proxy uri>")` or `wallet.setProxyUri("<tor proxy uri>")`.
-
## Using TOR with monerod
+### Option 1
+
+```java
+// create client connected to monerod with tor config
+MoneroRpcConnection monerodConnection = new MoneroRpcConnection("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
+ .setCredentials("superuser", "abctesting123")
+ .setProxyUri("<tor proxy uri>");
+MoneroDaemonRpc monerod = new MoneroDaemonRpc(monerodConnection);
+```
+
+### Option 2
+
```java
-// connect to monerod with tor address
+// create client connected to monerod with tor address
MoneroDaemonRpc monerod = new MoneroDaemonRpc("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081"); // can add username and password
// set tor's proxy uri
@@ -20,27 +30,34 @@ monerod.setProxyUri("<tor proxy uri>");
// create client connected to your monero-wallet-rpc instance
MoneroWallet walletRpc = new MoneroWalletRpc("http://localhost:38084"); // can add username and password
-// open or create a wallet with tor address
+// open or create a wallet
// ...
-// set tor's proxy uri
-walletRpc.setProxyUri("<tor proxy uri>");
+// set connection to monerod with tor config
+MoneroRpcConnection monerodConnection = new MoneroRpcConnection("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
+ .setCredentials("superuser", "abctesting123")
+ .setProxyUri("<tor proxy uri>");
+walletRpc.setDaemonConnection(monerodConnection);
```
## Using TOR with client-side wallet
```java
-// create full wallet with tor address
+// option 1: get or create full wallet with tor config
MoneroWallet walletFull = MoneroWalletFull.createWallet(new MoneroWalletConfig()
.setPath("sample_wallet_full")
.setPassword("supersecretpassword123")
.setNetworkType(MoneroNetworkType.MAINNET)
+ .setSeed("hefty value scenic...")
+ .setRestoreHeight(573936l)
.setServerUri("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
.setServerUsername("superuser")
.setServerPassword("abctesting123")
- .setMnemonic("hefty value scenic...")
- .setRestoreHeight(573936l));
+ .setServerProxyUri("<tor proxy uri>"));
-// set tor's proxy uri
-walletFull.setProxyUri("<tor proxy uri>");
+// option 2: set connection to monerod with tor config
+MoneroRpcConnection monerodConnection = new MoneroRpcConnection("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
+ .setCredentials("superuser", "abctesting123")
+ .setProxyUri("<tor proxy uri>");
+walletFull.setDaemonConnection(monerodConnection);
```
\ No newline at end of file
diff --git a/src/main/cpp/monero_jni_bridge.cpp b/src/main/cpp/monero_jni_bridge.cpp
index a8a2d8f..bd620b4 100644
--- a/src/main/cpp/monero_jni_bridge.cpp
+++ b/src/main/cpp/monero_jni_bridge.cpp
@@ -88,22 +88,25 @@ void rethrow_java_exception_as_cpp_exception(JNIEnv* env, jthrowable jexception)
throw runtime_error(msg);
}
-void set_daemon_connection(JNIEnv *env, monero_wallet* wallet, jstring juri, jstring jusername, jstring jpassword) {
+void set_daemon_connection(JNIEnv *env, monero_wallet* wallet, jstring juri, jstring jusername, jstring jpassword, jstring jproxy_uri) {
// collect and release string params
const char* _uri = juri ? env->GetStringUTFChars(juri, NULL) : nullptr;
const char* _username = jusername ? env->GetStringUTFChars(jusername, NULL) : nullptr;
const char* _password = jpassword ? env->GetStringUTFChars(jpassword, NULL) : nullptr;
+ const char* _proxy_uri = jproxy_uri ? env->GetStringUTFChars(jproxy_uri, NULL) : nullptr;
string uri = string(juri ? _uri : "");
string username = string(_username ? _username : "");
string password = string(_password ? _password : "");
+ string proxy_uri = string(_proxy_uri ? _proxy_uri : "");
env->ReleaseStringUTFChars(juri, _uri);
env->ReleaseStringUTFChars(jusername, _username);
env->ReleaseStringUTFChars(jpassword, _password);
+ env->ReleaseStringUTFChars(jproxy_uri, _proxy_uri);
// set daemon connection
try {
- wallet->set_daemon_connection(uri, username, password);
+ wallet->set_daemon_connection(uri, username, password, proxy_uri);
} catch (...) {
rethrow_cpp_exception_as_java_exception(env);
}
@@ -522,24 +525,11 @@ JNIEXPORT jboolean JNICALL Java_monero_wallet_MoneroWalletFull_isViewOnlyJni(JNI
return wallet->is_view_only();
}
-JNIEXPORT void JNICALL Java_monero_wallet_MoneroWalletFull_setDaemonConnectionJni(JNIEnv *env, jobject instance, jstring juri, jstring jusername, jstring jpassword) {
+JNIEXPORT void JNICALL Java_monero_wallet_MoneroWalletFull_setDaemonConnectionJni(JNIEnv *env, jobject instance, jstring juri, jstring jusername, jstring jpassword, jstring jproxy_uri) {
MTRACE("Java_monero_wallet_MoneroWalletFull_setDaemonConnectionJni");
monero_wallet* wallet = get_handle<monero_wallet>(env, instance, JNI_WALLET_HANDLE);
try {
- set_daemon_connection(env, wallet, juri, jusername, jpassword);
- } catch (...) {
- rethrow_cpp_exception_as_java_exception(env);
- }
-}
-
-JNIEXPORT void JNICALL Java_monero_wallet_MoneroWalletFull_setProxyJni(JNIEnv *env, jobject instance, jstring juri) {
- MTRACE("Java_monero_wallet_MoneroWalletFull_setProxyJni");
- monero_wallet* wallet = get_handle<monero_wallet>(env, instance, JNI_WALLET_HANDLE);
- const char* _uri = juri ? env->GetStringUTFChars(juri, NULL) : nullptr;
- string uri = string(_uri ? _uri : "");
- env->ReleaseStringUTFChars(juri, _uri);
- try {
- wallet->set_daemon_proxy(uri);
+ set_daemon_connection(env, wallet, juri, jusername, jpassword, jproxy_uri);
} catch (...) {
rethrow_cpp_exception_as_java_exception(env);
}
@@ -561,6 +551,7 @@ JNIEXPORT jobjectArray JNICALL Java_monero_wallet_MoneroWalletFull_getDaemonConn
if (daemon_connection->m_uri != boost::none && !daemon_connection->m_uri.get().empty()) env->SetObjectArrayElement(vals, 0, env->NewStringUTF(daemon_connection->m_uri.get().c_str()));
if (daemon_connection->m_username != boost::none && !daemon_connection->m_username.get().empty()) env->SetObjectArrayElement(vals, 1, env->NewStringUTF(daemon_connection->m_username.get().c_str()));
if (daemon_connection->m_password != boost::none && !daemon_connection->m_password.get().empty()) env->SetObjectArrayElement(vals, 2, env->NewStringUTF(daemon_connection->m_password.get().c_str()));
+ if (daemon_connection->m_proxy_uri != boost::none && !daemon_connection->m_proxy_uri.get().empty()) env->SetObjectArrayElement(vals, 2, env->NewStringUTF(daemon_connection->m_proxy_uri.get().c_str()));
return vals;
} catch (...) {
rethrow_cpp_exception_as_java_exception(env);
diff --git a/src/main/cpp/monero_jni_bridge.h b/src/main/cpp/monero_jni_bridge.h
index 25853b8..ed25ca8 100644
--- a/src/main/cpp/monero_jni_bridge.h
+++ b/src/main/cpp/monero_jni_bridge.h
@@ -73,9 +73,7 @@ JNIEXPORT jobjectArray JNICALL Java_monero_wallet_MoneroWalletFull_getSeedLangua
JNIEXPORT jboolean JNICALL Java_monero_wallet_MoneroWalletFull_isViewOnlyJni(JNIEnv *, jobject);
-JNIEXPORT void JNICALL Java_monero_wallet_MoneroWalletFull_setDaemonConnectionJni(JNIEnv *, jobject, jstring, jstring, jstring);
-
-JNIEXPORT void JNICALL Java_monero_wallet_MoneroWalletFull_setProxyJni(JNIEnv *, jobject, jstring);
+JNIEXPORT void JNICALL Java_monero_wallet_MoneroWalletFull_setDaemonConnectionJni(JNIEnv *, jobject, jstring, jstring, jstring, jstring);
JNIEXPORT jobjectArray JNICALL Java_monero_wallet_MoneroWalletFull_getDaemonConnectionJni(JNIEnv *, jobject);
diff --git a/src/main/java/monero/common/MoneroRpcConnection.java b/src/main/java/monero/common/MoneroRpcConnection.java
index 2dafe24..158b187 100644
--- a/src/main/java/monero/common/MoneroRpcConnection.java
+++ b/src/main/java/monero/common/MoneroRpcConnection.java
@@ -71,18 +71,18 @@ public class MoneroRpcConnection {
private String username;
private String password;
private String zmqUri;
+ private String proxyUri;
private int priority = 0;
private Long timeoutMs;
private Boolean isOnline;
private Boolean isAuthenticated;
private Long responseTime;
- private String proxyUri;
private boolean printStackTrace;
private Map<String, Object> attributes = new HashMap<String, Object>();
public MoneroRpcConnection(URI uri) {
- this(uri, null, null, null);
+ this(uri, null, null, null, null);
}
public MoneroRpcConnection(String uri) {
@@ -90,24 +90,27 @@ public class MoneroRpcConnection {
}
public MoneroRpcConnection(String uri, String username, String password) {
- this(uri == null ? null : MoneroUtils.parseUri(uri), username, password, null);
+ this(uri == null ? null : MoneroUtils.parseUri(uri), username, password, null, null);
}
- public MoneroRpcConnection(String uri, String username, String password, String zmqUri) {
- this(uri == null ? null : MoneroUtils.parseUri(uri), username, password, zmqUri == null ? null : MoneroUtils.parseUri(zmqUri));
- }
-
public MoneroRpcConnection(URI uri, String username, String password) {
- this(uri, username, password, null);
+ this(uri, username, password, null, null);
+ }
+
+ public MoneroRpcConnection(String uri, String username, String password, String zmqUri, String proxyUri) {
+ this(uri == null ? null : MoneroUtils.parseUri(uri), username, password, zmqUri == null ? null : MoneroUtils.parseUri(zmqUri), proxyUri == null ? null : MoneroUtils.parseUri(proxyUri));
+ this.proxyUri = proxyUri;
}
- public MoneroRpcConnection(URI uri, String username, String password, URI zmqUri) {
+ public MoneroRpcConnection(URI uri, String username, String password, URI zmqUri, URI proxyUri) {
this.uri = uri == null ? null : MoneroUtils.parseUri(uri.toString()).toString();
this.setCredentials(username, password);
+ this.zmqUri = zmqUri == null ? null : MoneroUtils.parseUri(zmqUri.toString()).toString();
+ this.proxyUri = proxyUri == null ? null : MoneroUtils.parseUri(proxyUri.toString()).toString();
}
public MoneroRpcConnection(MoneroRpcConnection connection) {
- this(connection.uri, connection.username, connection.password, connection.zmqUri);
+ this(connection.uri, connection.username, connection.password, connection.zmqUri, connection.proxyUri);
this.priority = connection.priority;
this.isOnline = connection.isOnline;
this.isAuthenticated = connection.isAuthenticated;
@@ -170,7 +173,6 @@ public class MoneroRpcConnection {
return password;
}
-
public String getZmqUri() {
return zmqUri;
}
@@ -180,15 +182,15 @@ public class MoneroRpcConnection {
return this;
}
+ public String getProxyUri() {
+ return proxyUri;
+ }
+
public MoneroRpcConnection setProxyUri(String proxyUri) {
this.proxyUri = proxyUri;
return this;
}
- public String getProxyUri() {
- return proxyUri;
- }
-
/**
* Set the connection's priority relative to other connections. Priority 1 is highest,
* then priority 2, etc. The default priority of 0 is lowest priority.
@@ -584,6 +586,7 @@ public class MoneroRpcConnection {
result = prime * result + ((uri == null) ? 0 : uri.hashCode());
result = prime * result + ((username == null) ? 0 : username.hashCode());
result = prime * result + ((zmqUri == null) ? 0 : zmqUri.hashCode());
+ result = prime * result + ((proxyUri == null) ? 0 : proxyUri.hashCode());
return result;
}
diff --git a/src/main/java/monero/daemon/MoneroDaemonRpc.java b/src/main/java/monero/daemon/MoneroDaemonRpc.java
index 8c56e59..b27eb8e 100644
--- a/src/main/java/monero/daemon/MoneroDaemonRpc.java
+++ b/src/main/java/monero/daemon/MoneroDaemonRpc.java
@@ -191,7 +191,7 @@ public class MoneroDaemonRpc extends MoneroDaemonDefault {
String zmqUri = zmqUriIdx >= 0 ? cmd.get(zmqUriIdx + 1) : null;
// initialize internal state
- rpc = new MoneroRpcConnection(uri, username, password, zmqUri);
+ rpc = new MoneroRpcConnection(uri, username, password, zmqUri, null);
}
/**
@@ -263,6 +263,16 @@ public class MoneroDaemonRpc extends MoneroDaemonDefault {
return this.rpc;
}
+ /**
+ * Set the daemon's RPC connection.
+ *
+ * @param rpc the daemon's rpc connection
+ */
+ public void setRpcConnection(MoneroRpcConnection rpc) {
+ GenUtils.assertNotNull(rpc);
+ this.rpc = rpc;
+ }
+
/**
* Set the Tor proxy to the daemon.
*
diff --git a/src/main/java/monero/wallet/MoneroWallet.java b/src/main/java/monero/wallet/MoneroWallet.java
index f28220c..a6a2a8d 100644
--- a/src/main/java/monero/wallet/MoneroWallet.java
+++ b/src/main/java/monero/wallet/MoneroWallet.java
@@ -138,13 +138,6 @@ public interface MoneroWallet {
*/
public MoneroConnectionManager getConnectionManager();
- /**
- * Set the Tor proxy to the daemon.
- *
- * @param uri the Tor proxy URI
- */
- public void setProxyUri(String uri);
-
/**
* Indicates if the wallet is connected a daemon.
*
diff --git a/src/main/java/monero/wallet/MoneroWalletFull.java b/src/main/java/monero/wallet/MoneroWalletFull.java
index 71aa2a1..728052d 100644
--- a/src/main/java/monero/wallet/MoneroWalletFull.java
+++ b/src/main/java/monero/wallet/MoneroWalletFull.java
@@ -458,28 +458,16 @@ public class MoneroWalletFull extends MoneroWalletDefault {
@Override
public void setDaemonConnection(MoneroRpcConnection daemonConnection) {
assertNotClosed();
- if (daemonConnection == null) setDaemonConnectionJni("", "", "");
+ if (daemonConnection == null) setDaemonConnectionJni("", "", "", "");
else {
try {
- setDaemonConnectionJni(daemonConnection.getUri() == null ? "" : daemonConnection.getUri().toString(), daemonConnection.getUsername(), daemonConnection.getPassword());
+ setDaemonConnectionJni(daemonConnection.getUri() == null ? "" : daemonConnection.getUri().toString(), daemonConnection.getUsername(), daemonConnection.getPassword(), daemonConnection.getProxyUri());
} catch (Exception e) {
throw new MoneroError(e.getMessage());
}
}
}
- @Override
- public void setProxyUri(String uri) {
- assertNotClosed();
- if (uri == null) uri = "";
- try {
- setProxyJni(uri);
- } catch (Exception e) {
- e.printStackTrace();
- throw new MoneroError(e.getMessage());
- }
- }
-
@Override
public MoneroRpcConnection getDaemonConnection() {
assertNotClosed();
@@ -1431,9 +1419,7 @@ public class MoneroWalletFull extends MoneroWalletDefault {
private native boolean isViewOnlyJni();
- private native void setDaemonConnectionJni(String uri, String username, String password);
-
- private native void setProxyJni(String uri);
+ private native void setDaemonConnectionJni(String uri, String username, String password, String proxyUri);
private native String[] getDaemonConnectionJni(); // returns [uri, username, password]
diff --git a/src/main/java/monero/wallet/MoneroWalletRpc.java b/src/main/java/monero/wallet/MoneroWalletRpc.java
index e609170..c089a47 100644
--- a/src/main/java/monero/wallet/MoneroWalletRpc.java
+++ b/src/main/java/monero/wallet/MoneroWalletRpc.java
@@ -116,10 +116,6 @@ public class MoneroWalletRpc extends MoneroWalletDefault {
this(new MoneroRpcConnection(uri, username, password));
}
- public MoneroWalletRpc(String uri, String username, String password, String zmqUri) {
- this(new MoneroRpcConnection(uri, username, password, zmqUri));
- }
-
public MoneroWalletRpc(MoneroRpcConnection rpc) {
super();
this.rpc = rpc;
@@ -201,7 +197,7 @@ public class MoneroWalletRpc extends MoneroWalletDefault {
String zmqUri = zmqUriIdx >= 0 ? cmd.get(zmqUriIdx + 1) : null;
// initialize internal state
- rpc = new MoneroRpcConnection(uri, username, password, zmqUri);
+ rpc = new MoneroRpcConnection(uri, username, password, zmqUri, null);
addressCache = new HashMap<Integer, Map<Integer, String>>();
}
@@ -512,15 +508,11 @@ public class MoneroWalletRpc extends MoneroWalletDefault {
params.put("ssl_ca_file", sslOptions.getCertificateAuthorityFile());
params.put("ssl_allowed_fingerprints", sslOptions.getAllowedFingerprints());
params.put("ssl_allow_any_cert", sslOptions.getAllowAnyCert());
+ params.put("proxy", connection == null ? "" : connection.getProxyUri());
rpc.sendJsonRequest("set_daemon", params);
this.daemonConnection = connection == null || connection.getUri() == null || connection.getUri().isEmpty() ? null : new MoneroRpcConnection(connection);
}
- @Override
- public void setProxyUri(String uri) {
- throw new MoneroError("MoneroWalletRpc.setProxyUri() not supported. Start monero-wallet-rpc with --proxy instead.");
- }
-
@Override
public MoneroRpcConnection getDaemonConnection() {
return daemonConnection;
diff --git a/src/main/java/monero/wallet/model/MoneroWalletConfig.java b/src/main/java/monero/wallet/model/MoneroWalletConfig.java
index 8aaafd6..29c1605 100644
--- a/src/main/java/monero/wallet/model/MoneroWalletConfig.java
+++ b/src/main/java/monero/wallet/model/MoneroWalletConfig.java
@@ -19,6 +19,7 @@ public class MoneroWalletConfig {
private MoneroRpcConnection server;
private String serverUsername;
private String serverPassword;
+ private String serverProxyUri;
private MoneroConnectionManager connectionManager;
private String seed;
private String seedOffset;
@@ -102,6 +103,7 @@ public class MoneroWalletConfig {
this.server = server;
this.serverUsername = server == null ? null : server.getUsername();
this.serverPassword = server == null ? null : server.getPassword();
+ this.serverProxyUri = server == null ? null : server.getProxyUri();
return this;
}
@@ -117,6 +119,7 @@ public class MoneroWalletConfig {
if (server == null) server = new MoneroRpcConnection(serverUri);
else server.setUri(serverUri);
if (serverUsername != null && serverPassword != null) server.setCredentials(serverUsername, serverPassword);
+ server.setProxyUri(serverProxyUri);
return this;
}
@@ -140,6 +143,16 @@ public class MoneroWalletConfig {
return this;
}
+ public String getServerProxyUri() {
+ return server == null ? null : server.getProxyUri();
+ }
+
+ public MoneroWalletConfig setServerProxyUri(String serverProxyUri) {
+ this.serverProxyUri = serverProxyUri;
+ if (server != null) server.setProxyUri(serverProxyUri);
+ return this;
+ }
+
@JsonIgnore
public MoneroConnectionManager getConnectionManager() {
return connectionManager;
diff --git a/src/test/java/TestSampleCode.java b/src/test/java/TestSampleCode.java
index be76626..359c37f 100644
--- a/src/test/java/TestSampleCode.java
+++ b/src/test/java/TestSampleCode.java
@@ -14,6 +14,7 @@ import monero.daemon.MoneroDaemon;
import monero.daemon.MoneroDaemonRpc;
import monero.daemon.model.MoneroNetworkType;
import monero.daemon.model.MoneroTx;
+import monero.wallet.MoneroWallet;
import monero.wallet.MoneroWalletFull;
import monero.wallet.MoneroWalletRpc;
import monero.wallet.model.MoneroOutputWallet;
@@ -170,4 +171,62 @@ public class TestSampleCode {
// clear connection manager
connectionManager.clear();
}
+
+ @SuppressWarnings("unused")
+ private static void proxySampleCodeMonerod1() {
+
+ // create client connected to monerod with tor config
+ MoneroRpcConnection monerodConnection = new MoneroRpcConnection("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
+ .setCredentials("superuser", "abctesting123")
+ .setProxyUri("<tor proxy uri>");
+ MoneroDaemonRpc monerod = new MoneroDaemonRpc(monerodConnection);
+ }
+
+ @SuppressWarnings("unused")
+ private static void proxySampleCodeMonerod2() {
+
+ // connect to monerod with tor address
+ MoneroDaemonRpc monerod = new MoneroDaemonRpc("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081"); // can add username and password
+
+ // set tor's proxy uri
+ monerod.setProxyUri("<tor proxy uri>");
+ }
+
+ @SuppressWarnings("unused")
+ private static void proxySampleCodeWalletRpc() {
+
+ // create client connected to your monero-wallet-rpc instance
+ MoneroWallet walletRpc = new MoneroWalletRpc("http://localhost:38084"); // can add username and password
+
+ // open or create a wallet
+ // ...
+
+ // set connection to monerod with tor config
+ MoneroRpcConnection monerodConnection = new MoneroRpcConnection("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
+ .setCredentials("superuser", "abctesting123")
+ .setProxyUri("<tor proxy uri>");
+ walletRpc.setDaemonConnection(monerodConnection);
+ }
+
+ @SuppressWarnings("unused")
+ private static void proxySampleCodeWalletFull() {
+
+ // option 1: get or create full wallet with tor config
+ MoneroWallet walletFull = MoneroWalletFull.createWallet(new MoneroWalletConfig()
+ .setPath("sample_wallet_full")
+ .setPassword("supersecretpassword123")
+ .setNetworkType(MoneroNetworkType.MAINNET)
+ .setSeed("hefty value scenic...")
+ .setRestoreHeight(573936l)
+ .setServerUri("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
+ .setServerUsername("superuser")
+ .setServerPassword("abctesting123")
+ .setServerProxyUri("<tor proxy uri>"));
+
+ // option 2: set connection to monerod with tor config
+ MoneroRpcConnection monerodConnection = new MoneroRpcConnection("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
+ .setCredentials("superuser", "abctesting123")
+ .setProxyUri("<tor proxy uri>");
+ walletFull.setDaemonConnection(monerodConnection);
+ }
}
diff --git a/src/test/java/utils/TestUtils.java b/src/test/java/utils/TestUtils.java
index c17e6a6..59c7281 100644
--- a/src/test/java/utils/TestUtils.java
+++ b/src/test/java/utils/TestUtils.java
@@ -57,6 +57,8 @@ public class TestUtils {
public static final boolean WALLET_RPC_ZMQ_ENABLED = false;
public static final int WALLET_RPC_ZMQ_PORT_START = 58083;
public static final int WALLET_RPC_ZMQ_BIND_PORT_START = 48083; // TODO: zmq bind port necessary?
+ public static final boolean WALLET_RPC_PROXY_ENABLED = false;
+ public static final String WALLET_RPC_PROXY_URI = null;
public static final String WALLET_RPC_USERNAME = "rpc_user";
public static final String WALLET_RPC_PASSWORD = "abc123";
public static final String WALLET_RPC_ZMQ_DOMAIN = "127.0.0.1";
@@ -118,7 +120,7 @@ public class TestUtils {
if (walletRpc == null) {
// construct wallet rpc instance with daemon connection
- MoneroRpcConnection rpc = new MoneroRpcConnection(WALLET_RPC_URI, WALLET_RPC_USERNAME, WALLET_RPC_PASSWORD, WALLET_RPC_ZMQ_ENABLED ? WALLET_RPC_ZMQ_URI : null);
+ MoneroRpcConnection rpc = new MoneroRpcConnection(WALLET_RPC_URI, WALLET_RPC_USERNAME, WALLET_RPC_PASSWORD, WALLET_RPC_ZMQ_ENABLED ? WALLET_RPC_ZMQ_URI : null, WALLET_RPC_PROXY_ENABLED ? WALLET_RPC_PROXY_URI : null);
walletRpc = new MoneroWalletRpc(rpc);
}
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.