continued re-integration of VPN feature
This commit is contained in:
parent
1614921e34
commit
ca238c6521
|
@ -30,7 +30,6 @@ public class OrbotApp extends Application implements OrbotConstants
|
||||||
Languages.setup(OrbotMainActivity.class, R.string.menu_settings);
|
Languages.setup(OrbotMainActivity.class, R.string.menu_settings);
|
||||||
Languages.setLanguage(this, Prefs.getDefaultLocale(), true);
|
Languages.setLanguage(this, Prefs.getDefaultLocale(), true);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,13 +4,18 @@ android {
|
||||||
compileSdkVersion 23
|
compileSdkVersion 23
|
||||||
buildToolsVersion "23.0.3"
|
buildToolsVersion "23.0.3"
|
||||||
|
|
||||||
sourceSets.main.jni.srcDirs = []
|
sourceSets {
|
||||||
|
main {
|
||||||
|
jni.srcDirs = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 9
|
minSdkVersion 9
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -22,7 +27,7 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':jsocksAndroid')
|
compile project(':jsocksAndroid')
|
||||||
compile 'com.android.support:appcompat-v7:23.+'
|
compile 'com.android.support:appcompat-v7:23.4.0'
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar','*.so'])
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,8 +182,9 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
if (mNotificationManager != null)
|
if (mNotificationManager != null)
|
||||||
mNotificationManager.cancelAll();
|
mNotificationManager.cancelAll();
|
||||||
|
|
||||||
|
if (mEventHandler != null)
|
||||||
mEventHandler.getNodes().clear();
|
mEventHandler.getNodes().clear();
|
||||||
|
|
||||||
mNotificationShowing = false;
|
mNotificationShowing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +244,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
expandedView.setTextViewText(R.id.info, notifyMsg);
|
expandedView.setTextViewText(R.id.info, notifyMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mEventHandler.getNodes().size() > 0)
|
if (mEventHandler != null && mEventHandler.getNodes().size() > 0)
|
||||||
{
|
{
|
||||||
Set<String> itBuiltNodes = mEventHandler.getNodes().keySet();
|
Set<String> itBuiltNodes = mEventHandler.getNodes().keySet();
|
||||||
for (String key : itBuiltNodes)
|
for (String key : itBuiltNodes)
|
||||||
|
@ -532,6 +533,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
fileTorRc = new File(appBinHome, TorServiceConstants.TORRC_ASSET_KEY);
|
fileTorRc = new File(appBinHome, TorServiceConstants.TORRC_ASSET_KEY);
|
||||||
filePdnsd = new File(appBinHome, TorServiceConstants.PDNSD_ASSET_KEY);
|
filePdnsd = new File(appBinHome, TorServiceConstants.PDNSD_ASSET_KEY);
|
||||||
|
|
||||||
|
mEventHandler = new TorEventHandler(this);
|
||||||
|
|
||||||
if (mNotificationManager == null)
|
if (mNotificationManager == null)
|
||||||
{
|
{
|
||||||
|
@ -735,7 +737,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// make sure there are no stray daemons running
|
// make sure there are no stray daemons running
|
||||||
killAllDaemons();
|
// killAllDaemons();
|
||||||
|
|
||||||
sendCallbackStatus(STATUS_STARTING);
|
sendCallbackStatus(STATUS_STARTING);
|
||||||
sendCallbackLogMessage(getString(R.string.status_starting_up));
|
sendCallbackLogMessage(getString(R.string.status_starting_up));
|
||||||
|
@ -1146,16 +1148,16 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEventHandler () throws Exception
|
public synchronized void addEventHandler () throws Exception
|
||||||
{
|
{
|
||||||
// We extend NullEventHandler so that we don't need to provide empty
|
// We extend NullEventHandler so that we don't need to provide empty
|
||||||
// implementations for all the events we don't care about.
|
// implementations for all the events we don't care about.
|
||||||
// ...
|
// ...
|
||||||
logNotice( "adding control port event handler");
|
logNotice( "adding control port event handler");
|
||||||
|
|
||||||
mEventHandler = new TorEventHandler(this);
|
|
||||||
conn.setEventHandler(mEventHandler);
|
conn.setEventHandler(mEventHandler);
|
||||||
|
|
||||||
|
|
||||||
conn.setEvents(Arrays.asList(new String[]{
|
conn.setEvents(Arrays.asList(new String[]{
|
||||||
"ORCONN", "CIRC", "NOTICE", "WARN", "ERR","BW"}));
|
"ORCONN", "CIRC", "NOTICE", "WARN", "ERR","BW"}));
|
||||||
// conn.setEvents(Arrays.asList(new String[]{
|
// conn.setEvents(Arrays.asList(new String[]{
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.torproject.android.service.vpn;
|
package org.torproject.android.service.vpn;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
|
import android.app.Application;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -74,18 +75,19 @@ public class OrbotVpnManager implements Handler.Callback {
|
||||||
private final static String DEFAULT_ACTUAL_DNS_HOST = "127.0.0.1";
|
private final static String DEFAULT_ACTUAL_DNS_HOST = "127.0.0.1";
|
||||||
private final static int DEFAULT_ACTUAL_DNS_PORT = TorServiceConstants.TOR_DNS_PORT_DEFAULT;
|
private final static int DEFAULT_ACTUAL_DNS_PORT = TorServiceConstants.TOR_DNS_PORT_DEFAULT;
|
||||||
|
|
||||||
|
|
||||||
|
File filePdnsd = null;
|
||||||
|
|
||||||
private boolean isRestart = false;
|
private boolean isRestart = false;
|
||||||
|
|
||||||
private VpnService mService;
|
private VpnService mService;
|
||||||
|
|
||||||
|
|
||||||
static{
|
|
||||||
System.loadLibrary("tun2socks");
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrbotVpnManager (VpnService service)
|
public OrbotVpnManager (VpnService service)
|
||||||
{
|
{
|
||||||
mService = service;
|
mService = service;
|
||||||
|
filePdnsd = mService.getDir(TorServiceConstants.DIRECTORY_TOR_BINARY, Application.MODE_PRIVATE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//public int onStartCommand(Intent intent, int flags, int startId) {
|
//public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
|
@ -394,12 +396,8 @@ public class OrbotVpnManager implements Handler.Callback {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
File filePdnsd = null;
|
|
||||||
|
|
||||||
private void startDNS (String dns, int port) throws IOException, TimeoutException
|
private void startDNS (String dns, int port) throws IOException, TimeoutException
|
||||||
{
|
{
|
||||||
File filePdnsd = null;//getDir(TorServiceConstants.DIRECTORY_TOR_BINARY, Application.MODE_PRIVATE);
|
|
||||||
|
|
||||||
makePdnsdConf(mService, dns, port,filePdnsd.getParentFile() );
|
makePdnsdConf(mService, dns, port,filePdnsd.getParentFile() );
|
||||||
|
|
||||||
ArrayList<String> customEnv = new ArrayList<String>();
|
ArrayList<String> customEnv = new ArrayList<String>();
|
||||||
|
|
|
@ -30,6 +30,11 @@ import java.net.Socket;
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
|
||||||
public class Tun2Socks
|
public class Tun2Socks
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static{
|
||||||
|
System.loadLibrary("tun2socks");
|
||||||
|
}
|
||||||
|
|
||||||
public static interface IProtectSocket
|
public static interface IProtectSocket
|
||||||
{
|
{
|
||||||
boolean doVpnProtect(Socket socket);
|
boolean doVpnProtect(Socket socket);
|
||||||
|
@ -52,8 +57,6 @@ public class Tun2Socks
|
||||||
// than one instance due to the use of global state (the lwip
|
// than one instance due to the use of global state (the lwip
|
||||||
// module, etc.) in the native code.
|
// module, etc.) in the native code.
|
||||||
|
|
||||||
private static boolean mLibLoaded = false;
|
|
||||||
|
|
||||||
public static void Start(
|
public static void Start(
|
||||||
ParcelFileDescriptor vpnInterfaceFileDescriptor,
|
ParcelFileDescriptor vpnInterfaceFileDescriptor,
|
||||||
int vpnInterfaceMTU,
|
int vpnInterfaceMTU,
|
||||||
|
@ -64,12 +67,6 @@ public class Tun2Socks
|
||||||
boolean udpgwTransparentDNS)
|
boolean udpgwTransparentDNS)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!mLibLoaded)
|
|
||||||
{
|
|
||||||
System.loadLibrary("tun2socks");
|
|
||||||
mLibLoaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
mVpnInterfaceFileDescriptor = vpnInterfaceFileDescriptor;
|
mVpnInterfaceFileDescriptor = vpnInterfaceFileDescriptor;
|
||||||
mVpnInterfaceMTU = vpnInterfaceMTU;
|
mVpnInterfaceMTU = vpnInterfaceMTU;
|
||||||
mVpnIpAddress = vpnIpAddress;
|
mVpnIpAddress = vpnIpAddress;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#APP_ABI := armeabi x86
|
#APP_ABI := armeabi x86
|
||||||
APP_ABI := armeabi
|
APP_ABI := armeabi
|
||||||
APP_PLATFORM := android-10
|
APP_PLATFORM := android-14
|
||||||
APP_STL := stlport_static
|
APP_STL := stlport_static
|
||||||
NDK_TOOLCHAIN_VERSION := 4.8
|
NDK_TOOLCHAIN_VERSION := 4.8
|
||||||
|
|
Loading…
Reference in New Issue