diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-07-30 20:43:49 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-07-30 20:43:49 +0200 |
commit | d7ec9395e2f4118a00109a3bffb9fef49bc0f583 (patch) | |
tree | 441bc96d698c2fb643a8d8642b66d6bd3586c6ae /src/de/blinkt/openvpn/VpnProfile.java | |
parent | ead513af3e9b408642a7ad41d2dfd2b24d78c665 (diff) |
Use system proxy settings for openvpn
Diffstat (limited to 'src/de/blinkt/openvpn/VpnProfile.java')
-rw-r--r-- | src/de/blinkt/openvpn/VpnProfile.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index 4e381fcc..199f6b54 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -23,7 +23,9 @@ import org.spongycastle.util.io.pem.PemWriter; import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; +import android.preference.PreferenceManager; import android.security.KeyChain; import android.security.KeyChainException; @@ -144,9 +146,10 @@ public class VpnProfile implements Serializable{ } - public String getConfigFile(File cacheDir) + public String getConfigFile(Context context) { + File cacheDir= context.getCacheDir(); String cfg=""; // Enable managment interface @@ -331,6 +334,14 @@ public class VpnProfile implements Serializable{ if(mUseFloat) cfg+= "float\n"; + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean usesystemproxy = prefs.getBoolean("usesystemproxy", true); + if(usesystemproxy) { + cfg+= "# Use system proxy setting\n"; + cfg+= "management-query-proxy\n"; + } + + if(mUseCustomConfig) { cfg += "# Custom configuration options\n"; cfg += "# You are on your on own here :)\n"; @@ -464,7 +475,7 @@ public class VpnProfile implements Serializable{ try { FileWriter cfg = new FileWriter(context.getCacheDir().getAbsolutePath() + "/" + OVPNCONFIGFILE); - cfg.write(getConfigFile(context.getCacheDir())); + cfg.write(getConfigFile(context)); cfg.flush(); cfg.close(); } catch (IOException e) { |