[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] option for map a local port to different onion port number
commit ebc736be8d8ab0651bd091b0f08787ce0d8d2be6
Author: Juan Ezquerro LLanes <juan@xxxxxxxxxxxxx>
Date: Thu Nov 17 09:48:27 2016 +0100
option for map a local port to different onion port number
---
.../main/java/org/torproject/android/OrbotMainActivity.java | 10 +++++++---
.../java/org/torproject/android/ui/hs/database/HSDatabase.java | 1 +
.../torproject/android/ui/hs/providers/HSContentProvider.java | 1 +
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
index 15506da..06c77cf 100644
--- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
+++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
@@ -565,14 +565,15 @@ public class OrbotMainActivity extends AppCompatActivity
stopVpnService();
}
- private void enableHiddenServicePort (String hsName, int hsPort, boolean getGey) throws RemoteException, InterruptedException
+ private void enableHiddenServicePort (String hsName, int hsPort, int hsRemotePort, boolean getGey) throws RemoteException, InterruptedException
{
String onionHostname="";
String[] mProjection = new String[]{
HSContentProvider.HiddenService._ID,
HSContentProvider.HiddenService.NAME,
HSContentProvider.HiddenService.DOMAIN,
- HSContentProvider.HiddenService.PORT};
+ HSContentProvider.HiddenService.PORT,
+ HSContentProvider.HiddenService.REMOTE_PORT};
if(hsName == null)
hsName = "hs"+hsPort;
@@ -580,6 +581,7 @@ public class OrbotMainActivity extends AppCompatActivity
ContentValues fields = new ContentValues();
fields.put("name", hsName);
fields.put("port", hsPort);
+ fields.put("remote_port", hsRemotePort);
ContentResolver cr = getContentResolver();
Cursor row = cr.query(HSContentProvider.CONTENT_URI, mProjection, "port="+hsPort, null, null);
@@ -621,6 +623,7 @@ public class OrbotMainActivity extends AppCompatActivity
if (action.equals(INTENT_ACTION_REQUEST_HIDDEN_SERVICE))
{
final int hiddenServicePort = getIntent().getIntExtra("hs_port", -1);
+ final int hiddenServiceRemotePort = getIntent().getIntExtra("hs_remote_port", -1);
final String hiddenServiceName = getIntent().getStringExtra("hs_name");
final boolean getHiddenServiceKey = getIntent().getBooleanExtra("hs_key",false);
@@ -632,7 +635,8 @@ public class OrbotMainActivity extends AppCompatActivity
try {
enableHiddenServicePort (
- hiddenServiceName, hiddenServicePort, getHiddenServiceKey
+ hiddenServiceName, hiddenServicePort,
+ hiddenServiceRemotePort, getHiddenServiceKey
);
} catch (RemoteException e) {
// TODO Auto-generated catch block
diff --git a/app/src/main/java/org/torproject/android/ui/hs/database/HSDatabase.java b/app/src/main/java/org/torproject/android/ui/hs/database/HSDatabase.java
index 9cbaacc..0cfb6e5 100644
--- a/app/src/main/java/org/torproject/android/ui/hs/database/HSDatabase.java
+++ b/app/src/main/java/org/torproject/android/ui/hs/database/HSDatabase.java
@@ -15,6 +15,7 @@ public class HSDatabase extends SQLiteOpenHelper {
"_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
"name TEXT, " +
"domain TEXT, " +
+ "remote_port INTEGER, " +
"port INTEGER);";
public HSDatabase(Context context) {
diff --git a/app/src/main/java/org/torproject/android/ui/hs/providers/HSContentProvider.java b/app/src/main/java/org/torproject/android/ui/hs/providers/HSContentProvider.java
index 3714e64..6fec6b0 100644
--- a/app/src/main/java/org/torproject/android/ui/hs/providers/HSContentProvider.java
+++ b/app/src/main/java/org/torproject/android/ui/hs/providers/HSContentProvider.java
@@ -113,6 +113,7 @@ public class HSContentProvider extends ContentProvider {
//Nombres de columnas
public static final String NAME = "name";
public static final String PORT = "port";
+ public static final String REMOTE_PORT = "remote_port";
public static final String DOMAIN = "domain";
private HiddenService() {
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits