summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/VpnProfile.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-05-13 01:16:27 +0200
committerArne Schwabe <arne@rfc2549.org>2012-05-13 01:16:27 +0200
commit9e2afc72b16125f7c365b8d600f6f5df36aa8f48 (patch)
treef2733212c02f8816a6188c70fd0e358876b90d0e /src/de/blinkt/openvpn/VpnProfile.java
parent5a65e0c5e80d147909acffa14b04d3c99d48de1a (diff)
Config Import useable (closes issue #14)
Correct save/restore state in Basic Settings (closes issue #17)
Diffstat (limited to 'src/de/blinkt/openvpn/VpnProfile.java')
-rw-r--r--src/de/blinkt/openvpn/VpnProfile.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java
index b7297e89..aed9ca03 100644
--- a/src/de/blinkt/openvpn/VpnProfile.java
+++ b/src/de/blinkt/openvpn/VpnProfile.java
@@ -37,14 +37,10 @@ public class VpnProfile implements Serializable{
public static final int TYPE_USERPASS_CERTIFICATES = 5;
public static final int TYPE_USERPASS_PKCS12 = 6;
public static final int TYPE_USERPASS_KEYSTORE = 7;
-
+
// Don't change this, not all parts of the program use this constant
public static final String EXTRA_PROFILEUUID = "de.blinkt.openvpn.profileUUID";
-
-
-
-
-
+ public static final String INLINE_TAG = "[[INLINE]]";
private static final String OVPNCONFIGFILE = "android.conf";
protected transient String mTransientPW=null;
@@ -52,6 +48,8 @@ public class VpnProfile implements Serializable{
private static transient String mTempPKCS12Password;
+ public static String DEFAULT_DNS1="131.234.137.23";
+ public static String DEFAULT_DNS2="131.234.137.24";
// Public attributes, since I got mad with getter/setter
// set members to default values
@@ -71,8 +69,8 @@ public class VpnProfile implements Serializable{
public String mPKCS12Password;
public boolean mUseTLSAuth = false;
public String mServerName = "openvpn.blinkt.de" ;
- public String mDNS1="131.234.137.23";
- public String mDNS2="131.234.137.24";
+ public String mDNS1=DEFAULT_DNS1;
+ public String mDNS2=DEFAULT_DNS2;
public String mIPv4Address;
public String mIPv6Address;
public boolean mOverrideDNS=false;
@@ -92,9 +90,8 @@ public class VpnProfile implements Serializable{
public String mCustomConfigOptions="";
public String mVerb="1";
public String mCipher="";
- public static final String INLINE_TAG = "[[INLINE]]";
+ public boolean mNobind=false;
-
public void clearDefaults() {
mServerName="unkown";
@@ -266,6 +263,9 @@ public class VpnProfile implements Serializable{
cfg+="dhcp-option DNS " + mDNS2 + "\n";
}
+
+ if(mNobind)
+ cfg+="nobind\n";
@@ -307,7 +307,9 @@ public class VpnProfile implements Serializable{
//! Put inline data inline and other data as normal escaped filename
private String insertFileData(String cfgentry, String filedata) {
- if(filedata.startsWith(VpnProfile.INLINE_TAG)){
+ if(filedata==null) {
+ return String.format("%s %s\n",cfgentry,"missing");
+ }else if(filedata.startsWith(VpnProfile.INLINE_TAG)){
String datawoheader = filedata.substring(VpnProfile.INLINE_TAG.length());
return String.format("<%s>\n%s\n</%s>\n",cfgentry,datawoheader,cfgentry);
} else {