option for map a local port to different onion port number
This commit is contained in:
parent
94a3b0b107
commit
ebc736be8d
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue