summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xres/values/strings.xml19
-rw-r--r--res/values/untranslatable.xml4
-rw-r--r--src/de/blinkt/openvpn/ConfigParser.java2
-rw-r--r--src/de/blinkt/openvpn/LaunchVPN.java4
-rw-r--r--src/de/blinkt/openvpn/LogWindow.java4
-rw-r--r--src/de/blinkt/openvpn/MainActivity.java3
-rw-r--r--src/de/blinkt/openvpn/OpenVPN.java49
-rw-r--r--src/de/blinkt/openvpn/OpenVPNThread.java2
-rw-r--r--src/de/blinkt/openvpn/OpenVpnManagementThread.java4
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java7
10 files changed, 71 insertions, 27 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ab629a00..a101d024 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -226,7 +226,7 @@
<string name="openvpn_log">OpenVPN Log</string>
<string name="import_config">Import OpenVPN configuration</string>
<string name="battery_consumption_title">Battery consumption</string>
- <string name="baterry_consumption">In my personal tests the main reason for high battery consumption of OpenVPN are the keepalive packets. Most OpenVPN servers have a configuration directive like \'keepalive 10 60\' which translates to a keepalive packet from client to server and server to client every ten seconds. &lt;p&gt; While these packets are small and do not use much traffic, they keep the mobile radio network busy and increase the energy consumption. &lt;p&gt; This keepalive setting cannot be changed on the client. Only the system administrator of the OpenVPN can change the setting. &lt;p&gt; Unfortunatly using a keepalive larger than 60 seconds with udp has problems with some NAT gateways which terminate the state for a connnection after a short timeout (60s in my tests). Using TCP with long keepalive timeout works but has the TCP over TCP problem. (See &lt;a href=\"http://sites.inka.de/bigred/devel/tcp-tcp.html\"&gt;Why TCP Over TCP Is A Bad Ide&lt;/a&gt;)</string>
+ <string name="baterry_consumption">In my personal tests the main reason for high battery consumption of OpenVPN are the keepalive packets. Most OpenVPN servers have a configuration directive like \'keepalive 10 60\' which translates to a keepalive packet from client to server and server to client every ten seconds. &lt;p&gt; While these packets are small and do not use much traffic, they keep the mobile radio network busy and increase the energy consumption. &lt;p&gt; This keepalive setting cannot be changed on the client. Only the system administrator of the OpenVPN can change the setting. &lt;p&gt; Unfortunately using a keepalive larger than 60 seconds with udp has problems with some NAT gateways which terminate the state for a connnection after a short timeout (60s in my tests). Using TCP with long keepalive timeout works but has the TCP over TCP problem. (See &lt;a href=\"http://sites.inka.de/bigred/devel/tcp-tcp.html\"&gt;Why TCP Over TCP Is A Bad Ide&lt;/a&gt;)</string>
<string name="faq_tethering">The Android Tethering feature (over WiFi, USB or Bluetooth) and the VPNService API (used by this program) do not work together. For more details see the &lt;a href=\"http://code.google.com/p/ics-openvpn/issues/detail?id=34\">issue #34&lt;/a></string>
<string name="vpn_tethering_title">VPN and Tethering</string>
<string name="connection_retries">Connection retries</string>
@@ -236,5 +236,22 @@
<string name="minidump_generated">OpenVPN crashed unexpectedly. Please consider using the send Minidump option in the main menu</string>
<string name="send_minidump">Send Minidump to developer</string>
<string name="send_minidump_summary">Send debugging information about last crash to developer</string>
+ <string name="notifcation_title">OpenVPN - %s</string>
+ <string name="session_ipv4string">%1$s - %2$s</string>
+ <string name="session_ipv6string">%1$s - %3$s, %2$s</string>
+ <string name="state_connecting">Connecting</string>
+ <string name="state_wait">Waiting for server reply</string>
+ <string name="state_auth">Authenticating</string>
+ <string name="state_get_config">Getting client configuration</string>
+ <string name="state_assign_ip">Assigning IP addresses</string>
+ <string name="state_add_routes">Adding routes</string>
+ <string name="state_connected">Connected</string>
+ <string name="state_reconnecting">Reconnecting</string>
+ <string name="state_exiting">Exiting</string>
+ <string name="state_noprocess">Not running</string>
+ <string name="state_resolve">Resolving host names</string>
+ <string name="state_tcp_connect">Connecting (TCP)</string>
+ <string name="state_auth_failed">Authentication failed</string>
+ <string name="state_nonetwork">Waiting for usable network</string>
</resources>
diff --git a/res/values/untranslatable.xml b/res/values/untranslatable.xml
index d5a30a03..c0a6bb2f 100644
--- a/res/values/untranslatable.xml
+++ b/res/values/untranslatable.xml
@@ -17,7 +17,9 @@
<string name="file_dialog" translatable="false">File Dialog</string>
<string name="lzo" translatable="false">LZO</string>
<string name="openssl" translatable="false">OpenSSL</string>
-
+ <string name="unknown_state" translatable="false">Unknown state</string>
+
+
<string-array name="tls_directions_values" translatable="false">
<item>0</item>
<item>1</item>
diff --git a/src/de/blinkt/openvpn/ConfigParser.java b/src/de/blinkt/openvpn/ConfigParser.java
index faf0dbd9..37741937 100644
--- a/src/de/blinkt/openvpn/ConfigParser.java
+++ b/src/de/blinkt/openvpn/ConfigParser.java
@@ -2,8 +2,6 @@ package de.blinkt.openvpn;
import java.io.BufferedReader;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.Locale;
diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java
index e45bee3b..32ebe33d 100644
--- a/src/de/blinkt/openvpn/LaunchVPN.java
+++ b/src/de/blinkt/openvpn/LaunchVPN.java
@@ -16,10 +16,7 @@
package de.blinkt.openvpn;
-import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.util.Collection;
import java.util.Vector;
@@ -32,7 +29,6 @@ import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.VpnService;
-import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.preference.PreferenceManager;
diff --git a/src/de/blinkt/openvpn/LogWindow.java b/src/de/blinkt/openvpn/LogWindow.java
index ad3af278..88615e12 100644
--- a/src/de/blinkt/openvpn/LogWindow.java
+++ b/src/de/blinkt/openvpn/LogWindow.java
@@ -327,12 +327,12 @@ public class LogWindow extends ListActivity implements StateListener {
}
@Override
- public void updateState(final String status,final String logmessage) {
+ public void updateState(final String status,final String logmessage, final int resid) {
runOnUiThread(new Runnable() {
@Override
public void run() {
- String prefix=status+ ":";
+ String prefix=getString(resid) + ":";
if (status.equals("BYTECOUNT") || status.equals("NOPROCESS") )
prefix="";
mSpeedView.setText(prefix + logmessage);
diff --git a/src/de/blinkt/openvpn/MainActivity.java b/src/de/blinkt/openvpn/MainActivity.java
index 32cf575b..57506c4f 100644
--- a/src/de/blinkt/openvpn/MainActivity.java
+++ b/src/de/blinkt/openvpn/MainActivity.java
@@ -1,11 +1,8 @@
package de.blinkt.openvpn;
-import java.io.File;
-import java.util.ArrayList;
import java.util.List;
import android.content.Intent;
-import android.net.Uri;
import android.preference.PreferenceActivity;
public class MainActivity extends PreferenceActivity {
diff --git a/src/de/blinkt/openvpn/OpenVPN.java b/src/de/blinkt/openvpn/OpenVPN.java
index e11d254f..342f02c0 100644
--- a/src/de/blinkt/openvpn/OpenVPN.java
+++ b/src/de/blinkt/openvpn/OpenVPN.java
@@ -19,6 +19,8 @@ public class OpenVPN {
private static String mLaststate;
+ private static int mLastStateresid=R.string.state_noprocess;
+
static {
logbuffer = new LinkedList<LogItem>();
logListener = new Vector<OpenVPN.LogListener>();
@@ -66,7 +68,7 @@ public class OpenVPN {
}
- String getString(Context c) {
+ public String getString(Context c) {
if(mMessage !=null) {
return mMessage;
} else {
@@ -97,7 +99,7 @@ public class OpenVPN {
}
public interface StateListener {
- void updateState(String state, String logmessage);
+ void updateState(String state, String logmessage, int localizedResId);
}
synchronized static void logMessage(int level,String prefix, String message)
@@ -128,7 +130,35 @@ public class OpenVPN {
public synchronized static void addStateListener(StateListener sl){
stateListener.add(sl);
if(mLaststate!=null)
- sl.updateState(mLaststate, mLaststatemsg);
+ sl.updateState(mLaststate, mLaststatemsg, mLastStateresid);
+ }
+
+ private static int getLocalizedState(String state){
+ if (state.equals("CONNECTING"))
+ return R.string.state_connecting;
+ else if (state.equals("WAIT"))
+ return R.string.state_wait;
+ else if (state.equals("AUTH"))
+ return R.string.state_auth;
+ else if (state.equals("GET_CONFIG"))
+ return R.string.state_get_config;
+ else if (state.equals("ASSIGN_IP"))
+ return R.string.state_assign_ip;
+ else if (state.equals("ADD_ROUTES"))
+ return R.string.state_add_routes;
+ else if (state.equals("CONNECTED"))
+ return R.string.state_connected;
+ else if (state.equals("RECONNECTING"))
+ return R.string.state_reconnecting;
+ else if (state.equals("EXITING"))
+ return R.string.state_exiting;
+ else if (state.equals("RESOLVE"))
+ return R.string.state_resolve;
+ else if (state.equals("TCP_CONNECT"))
+ return R.string.state_tcp_connect;
+ else
+ return R.string.unknown_state;
+
}
public synchronized static void removeStateListener(StateListener sl) {
@@ -157,12 +187,18 @@ public class OpenVPN {
}
- public synchronized static void updateStateString(String state, String msg) {
+ public static void updateStateString (String state, String msg) {
+ int rid = getLocalizedState(state);
+ updateStateString(state, msg,rid);
+ }
+
+ public synchronized static void updateStateString(String state, String msg, int resid) {
mLaststate= state;
mLaststatemsg = msg;
-
+ mLastStateresid = resid;
+
for (StateListener sl : stateListener) {
- sl.updateState(state,msg);
+ sl.updateState(state,msg,resid);
}
}
@@ -196,5 +232,4 @@ public class OpenVPN {
newlogItem(new LogItem(LogItem.ERROR, ressourceId,args));
}
-
}
diff --git a/src/de/blinkt/openvpn/OpenVPNThread.java b/src/de/blinkt/openvpn/OpenVPNThread.java
index 3922e679..1ef04f70 100644
--- a/src/de/blinkt/openvpn/OpenVPNThread.java
+++ b/src/de/blinkt/openvpn/OpenVPNThread.java
@@ -54,7 +54,7 @@ public class OpenVPNThread implements Runnable {
if( exitvalue != 0)
OpenVPN.logError("Process exited with exit value " + exitvalue);
- OpenVPN.updateStateString("NOPROCESS","No process running.");
+ OpenVPN.updateStateString("NOPROCESS","No process running.", R.string.state_noprocess);
if(mDumpPath!=null) {
try {
BufferedWriter logout = new BufferedWriter(new FileWriter(mDumpPath + ".log"));
diff --git a/src/de/blinkt/openvpn/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/OpenVpnManagementThread.java
index e2a183b9..c6a4c73e 100644
--- a/src/de/blinkt/openvpn/OpenVpnManagementThread.java
+++ b/src/de/blinkt/openvpn/OpenVpnManagementThread.java
@@ -220,7 +220,7 @@ public class OpenVpnManagementThread implements Runnable {
releaseHoldCmd();
} else {
mWaitingForRelease=true;
- OpenVPN.updateStateString("NONETWORK", "Waiting for usable network");
+ OpenVPN.updateStateString("NONETWORK", "",R.string.state_nonetwork);
}
}
private void releaseHoldCmd() {
@@ -453,7 +453,7 @@ public class OpenVpnManagementThread implements Runnable {
private void proccessPWFailed(String needed, String args) {
- OpenVPN.updateStateString("AUTH_FAILED", needed + args);
+ OpenVPN.updateStateString("AUTH_FAILED", needed + args,R.string.state_auth_failed);
}
private void logStatusMessage(String command) {
OpenVPN.logMessage(0,"MGMT:", command);
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index dff50e54..908224e5 100644
--- a/src/de/blinkt/openvpn/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/OpenVpnService.java
@@ -19,7 +19,6 @@ package de.blinkt.openvpn;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.Locale;
import java.util.Vector;
import android.app.Notification;
@@ -431,7 +430,7 @@ public class OpenVpnService extends VpnService implements StateListener {
}
@Override
- public void updateState(String state,String logmessage) {
+ public void updateState(String state,String logmessage, int resid) {
// If the process is not running, ignore any state,
// Notification should be invisible in this state
if(mProcessThread==null)
@@ -454,8 +453,8 @@ public class OpenVpnService extends VpnService implements StateListener {
// Other notifications are shown,
// This also mean we are no longer connected, ignore bytecount messages until next
// CONNECTED
- String ticker = state.toLowerCase(Locale.getDefault());
- showNotification(state +" " + logmessage,ticker,false,0);
+ String ticker = getString(resid);
+ showNotification(getString(resid) +" " + logmessage,ticker,false,0);
}
}